1. 21 Aug, 2024 4 commits
    • Srinivasan Shanmugam's avatar
      drm/amdgpu: Add PACKET3_RUN_CLEANER_SHADER for cleaner shader execution · 22ff907d
      Srinivasan Shanmugam authored
      This commit adds the PACKET3_RUN_CLEANER_SHADER definition. This packet
      is a command packet used to instruct the GPU to execute the cleaner
      shader.
      
      The cleaner shader is a piece of GPU code that is used to clear or
      initialize certain GPU resources, such as Local Data Share (LDS), Vector
      General Purpose Registers (VGPRs), and Scalar General Purpose Registers
      (SGPRs). Clearing these resources is important for ensuring data
      isolation between different workloads running on the GPU.
      
      The PACKET3_RUN_CLEANER_SHADER packet is used to trigger the execution
      of the cleaner shader on the GPU. The packet consists of a header
      followed by a RESERVED field, which is programmed to zero. When the GPU
      receives this packet, it fetches and executes the cleaner shader
      instructions from the location specified in the packet.
      
      The cleaner shader feature helps to enhances security and reliability by
      preventing data leaks between workloads.
      
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      22ff907d
    • Srinivasan Shanmugam's avatar
      drm/amdgpu: Add sysfs interface for running cleaner shader · d361ad5d
      Srinivasan Shanmugam authored
      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: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      d361ad5d
    • Srinivasan Shanmugam's avatar
      drm/amdgpu: Add enforce_isolation sysfs attribute · e189be9b
      Srinivasan Shanmugam authored
      This commit adds a new sysfs attribute 'enforce_isolation' to control
      the 'enforce_isolation' setting per GPU. The attribute can be read and
      written, and accepts values 0 (disabled) and 1 (enabled).
      
      When 'enforce_isolation' is enabled, reserved VMIDs are allocated for
      each ring. When it's disabled, the reserved VMIDs are freed.
      
      The set function locks a mutex before changing the 'enforce_isolation'
      flag and the VMIDs, and unlocks it afterwards. This ensures that these
      operations are atomic and prevents race conditions and other concurrency
      issues.
      
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      Suggested-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      e189be9b
    • Srinivasan Shanmugam's avatar
      drm/amdgpu: Enforce isolation as part of the job · dba1a6cf
      Srinivasan Shanmugam authored
      This patch adds a new parameter 'enforce_isolation' to the amdgpu_job
      structure. This parameter is used to determine whether shader isolation
      should be enforced for a job. The enforce_isolation parameter is then
      stored in the amdgpu_job structure and used when flushing the VM.
      
      The enforce_isolation field of the amdgpu_job structure is set directly
      after the job is allocated
      
      This change allows more fine-grained control over shader isolation,
      making it possible to enforce isolation on a per-job basis rather than
      globally. This can be useful in scenarios where only certain jobs
      require isolation.
      
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      Suggested-by: default avatarChristian König <christian.koenig@amd.com>
      dba1a6cf
  2. 16 Aug, 2024 36 commits