]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu/gfx9: Add Cleaner Shader Support for GFX9.x GPUs
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Thu, 12 Jun 2025 14:41:14 +0000 (20:11 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 24 Jun 2025 13:54:23 +0000 (09:54 -0400)
Enable the cleaner shader for other GFX9.x series of GPUs to provide
data isolation between GPU workloads. The cleaner shader is responsible
for clearing the Local Data Store (LDS), Vector General Purpose
Registers (VGPRs), and Scalar General Purpose Registers (SGPRs), which
helps prevent data leakage and ensures accurate computation results.

This update extends cleaner shader support to GFX9.x GPUs, previously
available for GFX9.4.2. It enhances security by clearing GPU memory
between processes and maintains a consistent GPU state across KGD and
KFD workloads.

Cc: Manu Rastogi <manu.rastogi@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

index d50e125fd3e0dc04468eeba6d0900eb87f0dc145..866e39f6fab3f1ed3aaed8b3bed838e415774e35 100644 (file)
@@ -2235,6 +2235,25 @@ static int gfx_v9_0_sw_init(struct amdgpu_ip_block *ip_block)
        }
 
        switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
+       case IP_VERSION(9, 0, 1):
+       case IP_VERSION(9, 2, 1):
+       case IP_VERSION(9, 4, 0):
+       case IP_VERSION(9, 2, 2):
+       case IP_VERSION(9, 1, 0):
+       case IP_VERSION(9, 3, 0):
+               adev->gfx.cleaner_shader_ptr = gfx_9_4_2_cleaner_shader_hex;
+               adev->gfx.cleaner_shader_size = sizeof(gfx_9_4_2_cleaner_shader_hex);
+               if (adev->gfx.me_fw_version  >= 167 &&
+                   adev->gfx.pfp_fw_version >= 196 &&
+                   adev->gfx.mec_fw_version >= 474) {
+                       adev->gfx.enable_cleaner_shader = true;
+                       r = amdgpu_gfx_cleaner_shader_sw_init(adev, adev->gfx.cleaner_shader_size);
+                       if (r) {
+                               adev->gfx.enable_cleaner_shader = false;
+                               dev_err(adev->dev, "Failed to initialize cleaner shader\n");
+                       }
+               }
+               break;
        case IP_VERSION(9, 4, 2):
                adev->gfx.cleaner_shader_ptr = gfx_9_4_2_cleaner_shader_hex;
                adev->gfx.cleaner_shader_size = sizeof(gfx_9_4_2_cleaner_shader_hex);