Commit 68071eb0 authored by Srinivasan Shanmugam's avatar Srinivasan Shanmugam Committed by Alex Deucher
Browse files

drm/amdgpu: Add Support for enforcing isolation without Cleaner Shader



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: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 575ec9b0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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,
};


+4 −0
Original line number Diff line number Diff line
@@ -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];
+5 −0
Original line number Diff line number Diff line
@@ -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;
		}
	}

+2 −2
Original line number Diff line number Diff line
@@ -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)
+13 −5
Original line number Diff line number Diff line
@@ -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);