[PATCH] drm/amdgpu/gfx10: Add Cleaner Shader Support for GFX10.3.x GPUs

Alex Deucher alexdeucher at gmail.com
Wed Mar 26 15:19:13 UTC 2025


On Wed, Mar 26, 2025 at 4:02 AM Srinivasan Shanmugam
<srinivasan.shanmugam at amd.com> wrote:
>
> 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 at amd.com>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>

Acked-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 30 ++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
> index 6d514efb0a6d..1010d78e4628 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
> @@ -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;
> --
> 2.34.1
>


More information about the amd-gfx mailing list