Skip to content

Commit 5c2b322

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amdgpu: Add wrapper function for dpc state
Use wrapper functions to set/indicate dpc status. Signed-off-by: Lijo Lazar <[email protected]> Reviewed-by: Ce Sun <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 9b331f0 commit 5c2b322

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5699,7 +5699,7 @@ int amdgpu_device_link_reset(struct amdgpu_device *adev)
56995699

57005700
dev_info(adev->dev, "GPU link reset\n");
57015701

5702-
if (!adev->pcie_reset_ctx.occurs_dpc)
5702+
if (!amdgpu_reset_in_dpc(adev))
57035703
ret = amdgpu_dpm_link_reset(adev);
57045704

57055705
if (ret)
@@ -6150,7 +6150,7 @@ static void amdgpu_device_recovery_prepare(struct amdgpu_device *adev,
61506150
list_add_tail(&tmp_adev->reset_list, device_list);
61516151
if (adev->shutdown)
61526152
tmp_adev->shutdown = true;
6153-
if (adev->pcie_reset_ctx.occurs_dpc)
6153+
if (amdgpu_reset_in_dpc(adev))
61546154
tmp_adev->pcie_reset_ctx.in_link_reset = true;
61556155
}
61566156
if (!list_is_first(&adev->reset_list, device_list))
@@ -6226,9 +6226,8 @@ static void amdgpu_device_halt_activities(struct amdgpu_device *adev,
62266226
drm_client_dev_suspend(adev_to_drm(tmp_adev), false);
62276227

62286228
/* disable ras on ALL IPs */
6229-
if (!need_emergency_restart &&
6230-
(!adev->pcie_reset_ctx.occurs_dpc) &&
6231-
amdgpu_device_ip_need_full_reset(tmp_adev))
6229+
if (!need_emergency_restart && !amdgpu_reset_in_dpc(adev) &&
6230+
amdgpu_device_ip_need_full_reset(tmp_adev))
62326231
amdgpu_ras_suspend(tmp_adev);
62336232

62346233
for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
@@ -6256,10 +6255,10 @@ static int amdgpu_device_asic_reset(struct amdgpu_device *adev,
62566255

62576256
retry: /* Rest of adevs pre asic reset from XGMI hive. */
62586257
list_for_each_entry(tmp_adev, device_list, reset_list) {
6259-
if (adev->pcie_reset_ctx.occurs_dpc)
6258+
if (amdgpu_reset_in_dpc(adev))
62606259
tmp_adev->no_hw_access = true;
62616260
r = amdgpu_device_pre_asic_reset(tmp_adev, reset_context);
6262-
if (adev->pcie_reset_ctx.occurs_dpc)
6261+
if (amdgpu_reset_in_dpc(adev))
62636262
tmp_adev->no_hw_access = false;
62646263
/*TODO Should we stop ?*/
62656264
if (r) {
@@ -6901,7 +6900,7 @@ pci_ers_result_t amdgpu_pci_error_detected(struct pci_dev *pdev, pci_channel_sta
69016900

69026901
if (hive)
69036902
mutex_lock(&hive->hive_lock);
6904-
adev->pcie_reset_ctx.occurs_dpc = true;
6903+
amdgpu_reset_set_dpc_status(adev, true);
69056904
memset(&reset_context, 0, sizeof(reset_context));
69066905
INIT_LIST_HEAD(&device_list);
69076906

@@ -7064,7 +7063,7 @@ void amdgpu_pci_resume(struct pci_dev *pdev)
70647063
amdgpu_device_sched_resume(&device_list, NULL, NULL);
70657064
amdgpu_device_gpu_resume(adev, &device_list, false);
70667065
amdgpu_device_recovery_put_reset_lock(adev, &device_list);
7067-
adev->pcie_reset_ctx.occurs_dpc = false;
7066+
amdgpu_reset_set_dpc_status(adev, false);
70687067

70697068
if (hive) {
70707069
mutex_unlock(&hive->hive_lock);

drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,15 @@ int amdgpu_reset_do_xgmi_reset_on_init(
160160

161161
bool amdgpu_reset_in_recovery(struct amdgpu_device *adev);
162162

163+
static inline void amdgpu_reset_set_dpc_status(struct amdgpu_device *adev,
164+
bool status)
165+
{
166+
adev->pcie_reset_ctx.occurs_dpc = status;
167+
}
168+
169+
static inline bool amdgpu_reset_in_dpc(struct amdgpu_device *adev)
170+
{
171+
return adev->pcie_reset_ctx.occurs_dpc;
172+
}
173+
163174
#endif

0 commit comments

Comments
 (0)