]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu/gfx10: Add Cleaner Shader Support for GFX10.3.x GPUs
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Wed, 26 Mar 2025 07:23:01 +0000 (12:53 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 7 Apr 2025 19:18:34 +0000 (15:18 -0400)
Enable the cleaner shader for other GFX10.3.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 GFX10.3.x GPUs, previously
available for GFX10.3.0. It enhances security by clearing GPU memory
between processes and maintains a consistent GPU state across KGD and
KFD workloads.

Cc: Mario Sopena-Novales <mario.novales@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_v10_0.c

index a63ce747863f10d9586cf058a7d114d888ea3808..d1c04de0f633d02c2a6e001408abaca25cb26966 100644 (file)
@@ -4810,7 +4810,9 @@ static int gfx_v10_0_sw_init(struct amdgpu_ip_block *ip_block)
                }
                break;
        case IP_VERSION(10, 3, 0):
+       case IP_VERSION(10, 3, 1):
        case IP_VERSION(10, 3, 2):
+       case IP_VERSION(10, 3, 3):
        case IP_VERSION(10, 3, 4):
        case IP_VERSION(10, 3, 5):
                adev->gfx.cleaner_shader_ptr = gfx_10_3_0_cleaner_shader_hex;
@@ -4826,6 +4828,34 @@ static int gfx_v10_0_sw_init(struct amdgpu_ip_block *ip_block)
                        }
                }
                break;
+       case IP_VERSION(10, 3, 6):
+               adev->gfx.cleaner_shader_ptr = gfx_10_3_0_cleaner_shader_hex;
+               adev->gfx.cleaner_shader_size = sizeof(gfx_10_3_0_cleaner_shader_hex);
+               if (adev->gfx.me_fw_version >= 14 &&
+                   adev->gfx.pfp_fw_version >= 17 &&
+                   adev->gfx.mec_fw_version >= 24) {
+                       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(10, 3, 7):
+               adev->gfx.cleaner_shader_ptr = gfx_10_3_0_cleaner_shader_hex;
+               adev->gfx.cleaner_shader_size = sizeof(gfx_10_3_0_cleaner_shader_hex);
+               if (adev->gfx.me_fw_version >= 4 &&
+                   adev->gfx.pfp_fw_version >= 9 &&
+                   adev->gfx.mec_fw_version >= 12) {
+                       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;
        default:
                adev->gfx.enable_cleaner_shader = false;
                break;