]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/amdgpu: Add sysfs interface for running cleaner shader
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Mon, 27 May 2024 02:08:21 +0000 (07:38 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 21 Aug 2024 02:06:56 +0000 (22:06 -0400)
commitd361ad5d2fc0e4d59d5d538092c9b37889756642
tree946a0421229a2e228597d9dfe0dac6f4acd98559
parente189be9b2e3820c88164d95090f1fd6343cd77fc
drm/amdgpu: Add sysfs interface for running cleaner shader

This patch adds a new sysfs interface for running the cleaner shader on
AMD GPUs. The cleaner shader is used to clear GPU memory before it's
reused, which can help prevent data leakage between different processes.

The new sysfs file is write-only and is named `run_cleaner_shader`.
Write the number of the partition to this file to trigger the cleaner shader
on that partition. There is only one partition on GPUs which do not
support partitioning.

Changes made in this patch:

- Added `amdgpu_set_run_cleaner_shader` function to handle writes to the
  `run_cleaner_shader` sysfs file.
- Added `run_cleaner_shader` to the list of device attributes in
  `amdgpu_device_attrs`.
- Updated `default_attr_update` to handle `run_cleaner_shader`.
- Added `AMDGPU_DEVICE_ATTR_WO` macro to create write-only device
  attributes.

v2: fix error handling (Alex)

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