diff options
| author | Lijo Lazar <[email protected]> | 2025-04-16 06:53:44 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2025-04-30 22:03:02 +0000 |
| commit | 75f138db48c5c493f0ac198c2579d52fc6a4c4a0 (patch) | |
| tree | 3751c7303e570b082ad586957f2036933fa30d2c /drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | |
| parent | drm/amd/display: Fix NULL pointer dereferences in dm_update_crtc_state() v2 (diff) | |
| download | kernel-75f138db48c5c493f0ac198c2579d52fc6a4c4a0.tar.gz kernel-75f138db48c5c493f0ac198c2579d52fc6a4c4a0.zip | |
drm/amdgpu: Disallow partition query during reset
Reject queries to get current partition modes during reset. Also, don't
accept sysfs interface requests to switch compute partition mode while
in reset.
Signed-off-by: Lijo Lazar <[email protected]>
Reviewed-by: Hawking Zhang <[email protected]>
Reviewed-by: Asad Kamal <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c index e1dca45a152b..cb9ffb17ab98 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c @@ -1353,6 +1353,10 @@ static ssize_t amdgpu_gfx_get_current_compute_partition(struct device *dev, struct amdgpu_device *adev = drm_to_adev(ddev); int mode; + /* Only minimal precaution taken to reject requests while in reset.*/ + if (amdgpu_in_reset(adev)) + return -EPERM; + mode = amdgpu_xcp_query_partition_mode(adev->xcp_mgr, AMDGPU_XCP_FL_NONE); @@ -1396,8 +1400,14 @@ static ssize_t amdgpu_gfx_set_compute_partition(struct device *dev, return -EINVAL; } + /* Don't allow a switch while under reset */ + if (!down_read_trylock(&adev->reset_domain->sem)) + return -EPERM; + ret = amdgpu_xcp_switch_partition_mode(adev->xcp_mgr, mode); + up_read(&adev->reset_domain->sem); + if (ret) return ret; |
