drm/amd/ras: initialize CPER after XGMI reset on init
Subsystems (2)
PATCH v2 1/1 drm/amd/ras: initialize CPER after XGMI reset on init
The XGMI reset-on-init path can run while the device is still at the minimal init level, such as during an NPS memory partition switch. In that flow the normal RAS IP block hw_init is skipped, so unified RAS is not enabled when the early CPER initialization is attempted, leaving CPER disabled for the rest of the device's lifetime.
Resume RAS after the XGMI reset-on-init completes and use deferred CPER initialization for devices that still do not have CPER enabled. This lets the CPER ring come up once RAS is ready while keeping the path a no-op for devices where CPER was already initialized.
Keep the deferred CPER retry and its debugfs registration together in a CPER helper. The normal debugfs ring walk skips the CPER ring until CPER is enabled, so the ring debugfs entry is created either by the deferred helper when debugfs is already available or by the normal debugfs walk.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c | 19 +++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_cper.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 5 +++++ 4 files changed, 27 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c +19 -0
@@ -498,6 +498,25 @@ int amdgpu_cper_init(struct amdgpu_device *adev)return 0 ; } +int amdgpu_cper_deferred_init (struct amdgpu_device *adev) +{ +int r; + +if (adev->cper.enabled) +return 0 ; + + r =amdgpu_cper_init (adev); +if (r || !adev->cper.enabled) +return r; + +#if defined(CONFIG_DEBUG_FS ) +if (adev_to_drm (adev)->primary->debugfs_root) +amdgpu_debugfs_ring_init (adev, &adev->cper.ring_buf); +#endif + +return 0 ; +} +int amdgpu_cper_fini (struct amdgpu_device *adev) {if (amdgpu_sriov_vf (adev))
drivers/gpu/drm/amd/amdgpu/amdgpu_cper.h +1 -0
@@ -92,6 +92,7 @@ int amdgpu_cper_generate_bp_threshold_record(struct amdgpu_device *adev);void amdgpu_cper_ring_write (struct amdgpu_ring *ring,void *src,int count);int amdgpu_cper_init (struct amdgpu_device *adev); +int amdgpu_cper_deferred_init (struct amdgpu_device *adev);int amdgpu_cper_fini (struct amdgpu_device *adev);#endif
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2 -0
@@ -2184,6 +2184,8 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)if (!ring)continue ; +if (ring == &adev->cper.ring_buf && !adev->cper.enabled) +continue ;amdgpu_debugfs_ring_init (adev, ring); }
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +5 -0
@@ -1400,6 +1400,11 @@ static void amdgpu_xgmi_reset_on_init_work(struct work_struct *work)* initialized, and for non-uniras devices. */ amdgpu_ras_resume_after_reset (tmp_adev); + + r =amdgpu_cper_deferred_init (tmp_adev); +if (r) +dev_err (tmp_adev->dev, +"failed to initialize CPER after XGMI reset-on-init\n" ); } }
Signature · 1 line
2.34.1