mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
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>
This commit is contained in:
parent
b5be054c58
commit
76acba7b7f
@ -4059,6 +4059,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
|
||||
mutex_init(&adev->notifier_lock);
|
||||
mutex_init(&adev->pm.stable_pstate_ctx_lock);
|
||||
mutex_init(&adev->benchmark_mutex);
|
||||
mutex_init(&adev->gfx.reset_sem_mutex);
|
||||
|
||||
amdgpu_device_init_apu_flags(adev);
|
||||
|
||||
|
@ -444,6 +444,8 @@ struct amdgpu_gfx {
|
||||
uint32_t *ip_dump_core;
|
||||
uint32_t *ip_dump_compute_queues;
|
||||
uint32_t *ip_dump_gfx_queues;
|
||||
|
||||
struct mutex reset_sem_mutex;
|
||||
};
|
||||
|
||||
struct amdgpu_gfx_ras_reg_entry {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user