mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 07:03:03 +02:00
drm/amdgpu: Add lock to serialize sriov command execution
Add lock to serialize sriov command execution. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
c0e870407b
commit
2b198d459f
|
|
@ -917,6 +917,7 @@ static void amdgpu_virt_init_ras(struct amdgpu_device *adev)
|
|||
RATELIMIT_MSG_ON_RELEASE);
|
||||
|
||||
mutex_init(&adev->virt.ras.ras_telemetry_mutex);
|
||||
mutex_init(&adev->virt.access_req_mutex);
|
||||
|
||||
adev->virt.ras.cper_rptr = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -325,6 +325,8 @@ struct amdgpu_virt {
|
|||
/* Spinlock to protect access to the RLCG register interface */
|
||||
spinlock_t rlcg_reg_lock;
|
||||
|
||||
struct mutex access_req_mutex;
|
||||
|
||||
union amd_sriov_ras_caps ras_en_caps;
|
||||
union amd_sriov_ras_caps ras_telemetry_en_caps;
|
||||
struct amdgpu_virt_ras ras;
|
||||
|
|
|
|||
|
|
@ -173,13 +173,17 @@ static void xgpu_nv_mailbox_trans_msg (struct amdgpu_device *adev,
|
|||
static int xgpu_nv_send_access_requests_with_param(struct amdgpu_device *adev,
|
||||
enum idh_request req, u32 data1, u32 data2, u32 data3)
|
||||
{
|
||||
int r, retry = 1;
|
||||
struct amdgpu_virt *virt = &adev->virt;
|
||||
int r = 0, retry = 1;
|
||||
enum idh_event event = -1;
|
||||
|
||||
mutex_lock(&virt->access_req_mutex);
|
||||
send_request:
|
||||
|
||||
if (amdgpu_ras_is_rma(adev))
|
||||
return -ENODEV;
|
||||
if (amdgpu_ras_is_rma(adev)) {
|
||||
r = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
xgpu_nv_mailbox_trans_msg(adev, req, data1, data2, data3);
|
||||
|
||||
|
|
@ -217,7 +221,7 @@ static int xgpu_nv_send_access_requests_with_param(struct amdgpu_device *adev,
|
|||
|
||||
if (req != IDH_REQ_GPU_INIT_DATA) {
|
||||
dev_err(adev->dev, "Doesn't get msg:%d from pf, error=%d\n", event, r);
|
||||
return r;
|
||||
goto out;
|
||||
} else /* host doesn't support REQ_GPU_INIT_DATA handshake */
|
||||
adev->virt.req_init_data_ver = 0;
|
||||
} else {
|
||||
|
|
@ -246,7 +250,10 @@ static int xgpu_nv_send_access_requests_with_param(struct amdgpu_device *adev,
|
|||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
out:
|
||||
mutex_unlock(&virt->access_req_mutex);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int xgpu_nv_send_access_requests(struct amdgpu_device *adev,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user