summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2024-07-12 16:37:33 -0400
committerAlex Deucher <alexander.deucher@amd.com>2024-08-16 14:24:33 -0400
commit76acba7b7f12517990f326fabfecb6f55e334233 (patch)
tree4a27d4669ec275a931c543570d66c38511675a4f /drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
parentb5be054c585110b2c5c1b180136800e8c41c7bb4 (diff)
drm/amdgpu/gfx11: add a mutex for the gfx semaphore
This will be used in more places in the future so add a mutex. Acked-by: Vitaly Prosyak <vitaly.prosyak@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index 98261000e022..01f220ee4561 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -4743,10 +4743,12 @@ static int gfx_v11_0_wait_for_idle(void *handle)
}
static int gfx_v11_0_request_gfx_index_mutex(struct amdgpu_device *adev,
- int req)
+ bool req)
{
u32 i, tmp, val;
+ if (req)
+ mutex_lock(&adev->gfx.reset_sem_mutex);
for (i = 0; i < adev->usec_timeout; i++) {
/* Request with MeId=2, PipeId=0 */
tmp = REG_SET_FIELD(0, CP_GFX_INDEX_MUTEX, REQUEST, req);
@@ -4767,6 +4769,8 @@ static int gfx_v11_0_request_gfx_index_mutex(struct amdgpu_device *adev,
}
udelay(1);
}
+ if (!req)
+ mutex_unlock(&adev->gfx.reset_sem_mutex);
if (i >= adev->usec_timeout)
return -EINVAL;
@@ -4814,7 +4818,7 @@ static int gfx_v11_0_soft_reset(void *handle)
mutex_unlock(&adev->srbm_mutex);
/* Try to acquire the gfx mutex before access to CP_VMID_RESET */
- r = gfx_v11_0_request_gfx_index_mutex(adev, 1);
+ r = gfx_v11_0_request_gfx_index_mutex(adev, true);
if (r) {
DRM_ERROR("Failed to acquire the gfx mutex during soft reset\n");
return r;
@@ -4829,7 +4833,7 @@ static int gfx_v11_0_soft_reset(void *handle)
RREG32_SOC15(GC, 0, regCP_VMID_RESET);
/* release the gfx mutex */
- r = gfx_v11_0_request_gfx_index_mutex(adev, 0);
+ r = gfx_v11_0_request_gfx_index_mutex(adev, false);
if (r) {
DRM_ERROR("Failed to release the gfx mutex during soft reset\n");
return r;