[PATCH 1/2] drm/amdgpu: Disable compute partition switch under SRIOV

Rajneesh Bhardwaj rajneesh.bhardwaj at amd.com
Fri Jun 21 22:04:01 UTC 2024


Do not allow the compute partition mode switch from the guest driver.

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 82452606ae6c..722c3fef09a5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -1292,6 +1292,9 @@ static ssize_t amdgpu_gfx_set_compute_partition(struct device *dev,
 	enum amdgpu_gfx_partition mode;
 	int ret = 0, num_xcc;
 
+	if (amdgpu_sriov_vf(adev))
+		return -EINVAL;
+
 	num_xcc = NUM_XCC(adev->gfx.xcc_mask);
 	if (num_xcc % 2 != 0)
 		return -EINVAL;
-- 
2.34.1



More information about the amd-gfx mailing list