drm/amdgpu: Add Support for enforcing isolation without Cleaner Shader
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Mon, 28 Apr 2025 10:46:34 +0000 (16:16 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 5 May 2025 17:29:53 +0000 (13:29 -0400)
Adjusted the enforce isolation setting handling to include the ability
to disable the cleaner shader without affecting isolation between tasks.

v2: Updated enforce isolation documentation and parameters. (Alex)

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

index cc26cf1bd843ee6445a35153a7767e4c162b4da9..7e5ae8f1f0a91b2efee553c94713e174ccffe93b 100644 (file)
@@ -878,6 +878,7 @@ enum amdgpu_enforce_isolation_mode {
        AMDGPU_ENFORCE_ISOLATION_DISABLE = 0,
        AMDGPU_ENFORCE_ISOLATION_ENABLE = 1,
        AMDGPU_ENFORCE_ISOLATION_ENABLE_LEGACY = 2,
+       AMDGPU_ENFORCE_ISOLATION_NO_CLEANER_SHADER = 3,
 };
 
 
index 0941b3495b2ca0c0168923091870f9b0dbaaccd3..9ea0d9b71f48db53119ccccdd5a5b309940c091e 100644 (file)
@@ -310,6 +310,10 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
                        p->jobs[i]->enforce_isolation = true;
                        p->jobs[i]->run_cleaner_shader = false;
                        break;
+               case AMDGPU_ENFORCE_ISOLATION_NO_CLEANER_SHADER:
+                       p->jobs[i]->enforce_isolation = true;
+                       p->jobs[i]->run_cleaner_shader = false;
+                       break;
                }
        }
        p->gang_leader = p->jobs[p->gang_leader_idx];
index fe68ba9997ae42318db39ed84096d477206fc89a..8330e30f0cafee26528d054fa93ae43580069523 100644 (file)
@@ -2163,6 +2163,11 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev)
                        adev->enforce_isolation[i] =
                                AMDGPU_ENFORCE_ISOLATION_ENABLE_LEGACY;
                        break;
+               case 3:
+                       /* enable only process isolation without submitting cleaner shader */
+                       adev->enforce_isolation[i] =
+                               AMDGPU_ENFORCE_ISOLATION_NO_CLEANER_SHADER;
+                       break;
                }
        }
 
index ec8057597c5aada0415ba1bffd583982fd41e201..8e45f18ad4702d349c19cb66419a47b277d447dc 100644 (file)
@@ -1040,11 +1040,11 @@ module_param_named(user_partt_mode, amdgpu_user_partt_mode, uint, 0444);
 /**
  * DOC: enforce_isolation (int)
  * enforce process isolation between graphics and compute.
- * (-1 = auto, 0 = disable, 1 = enable, 2 = enable legacy mode)
+ * (-1 = auto, 0 = disable, 1 = enable, 2 = enable legacy mode, 3 = enable without cleaner shader)
  */
 module_param_named(enforce_isolation, amdgpu_enforce_isolation, int, 0444);
 MODULE_PARM_DESC(enforce_isolation,
-"enforce process isolation between graphics and compute. (-1 = auto, 0 = disable, 1 = enable, 2 = enable legacy mode)");
+"enforce process isolation between graphics and compute. (-1 = auto, 0 = disable, 1 = enable, 2 = enable legacy mode, 3 = enable without cleaner shader)");
 
 /**
  * DOC: modeset (int)
index 8f1a2f7b03c1c396d6cf3b8f69454cb975925770..1db1e6ec0184fcd93dd8f2f8f9a365d08e91d0f6 100644 (file)
@@ -1612,7 +1612,8 @@ static ssize_t amdgpu_gfx_set_run_cleaner_shader(struct device *dev,
  * Provides the sysfs read interface to get the current settings of the 'enforce_isolation'
  * feature for each GPU partition. Reading from the 'enforce_isolation'
  * sysfs file returns the isolation settings for all partitions, where '0'
- * indicates disabled, '1' indicates enabled, and '2' indicates enabled in legacy mode.
+ * indicates disabled, '1' indicates enabled, and '2' indicates enabled in legacy mode,
+ * and '3' indicates enabled without cleaner shader.
  *
  * Return: The number of bytes read from the sysfs file.
  */
@@ -1647,9 +1648,11 @@ static ssize_t amdgpu_gfx_get_enforce_isolation(struct device *dev,
  * @count: The size of the input data
  *
  * This function allows control over the 'enforce_isolation' feature, which
- * serializes access to the graphics engine. Writing '1', '2', or '0' to the
- * 'enforce_isolation' sysfs file enables (full or legacy) or disables process
- * isolation for each partition. The input should specify the setting for all
+ * serializes access to the graphics engine. Writing '0' to disable, '1' to
+ * enable isolation with cleaner shader, '2' to enable legacy isolation without
+ * cleaner shader, or '3' to enable process isolation without submitting the
+ * cleaner shader to the 'enforce_isolation' sysfs file sets the isolation mode
+ * for each partition. The input should specify the setting for all
  * partitions.
  *
  * Return: The number of bytes written to the sysfs file.
@@ -1689,7 +1692,8 @@ static ssize_t amdgpu_gfx_set_enforce_isolation(struct device *dev,
        for (i = 0; i < num_partitions; i++) {
                if (partition_values[i] != 0 &&
                    partition_values[i] != 1 &&
-                   partition_values[i] != 2)
+                   partition_values[i] != 2 &&
+                   partition_values[i] != 3)
                        return -EINVAL;
        }
 
@@ -1708,6 +1712,10 @@ static ssize_t amdgpu_gfx_set_enforce_isolation(struct device *dev,
                        adev->enforce_isolation[i] =
                                AMDGPU_ENFORCE_ISOLATION_ENABLE_LEGACY;
                        break;
+               case 3:
+                       adev->enforce_isolation[i] =
+                               AMDGPU_ENFORCE_ISOLATION_NO_CLEANER_SHADER;
+                       break;
                }
        }
        mutex_unlock(&adev->enforce_isolation_mutex);