drm/amdgpu: Save VCN shared memory with init reset
Subsystems (2)
PATCH v2 1/1 drm/amdgpu: Save VCN shared memory with init reset
VCN shared memory is in framebuffer and there are some flags initialized during sw_init. Ideally, such programming should be during hw_init.
Make sure the flags are saved during reset on initialization since that reset will affect frame buffer region. For clarity, separate it out to another function.
---
v2: Rename save function to a more appropriate amdgpu_vcn_save_vcpu_bo (Leo)
drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 26 ++++++++++++++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 1 + 3 files changed, 23 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c +6 -0
@@ -49,6 +49,12 @@ static int amdgpu_reset_xgmi_reset_on_init_suspend(struct amdgpu_device *adev) adev->ip_blocks[i].status.hw = false; } +/* VCN FW shared region is in frambuffer, there are some flags +* initialized in that region during sw_init. Make sure the region is +* backed up. +*/ +amdgpu_vcn_save_vcpu_bo (adev); +return 0 ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +16 -10
@@ -294,21 +294,12 @@ bool amdgpu_vcn_is_disabled_vcn(struct amdgpu_device *adev, enum vcn_ring_type treturn ret; } -int amdgpu_vcn_suspend (struct amdgpu_device *adev) +int amdgpu_vcn_save_vcpu_bo (struct amdgpu_device *adev) {unsigned int size;void *ptr;int i, idx; -bool in_ras_intr =amdgpu_ras_intr_triggered (); - -cancel_delayed_work_sync (&adev->vcn.idle_work); - -/* err_event_athub will corrupt VCPU buffer, so we need to -* restore fw data and clear buffer in amdgpu_vcn_resume() */ -if (in_ras_intr) -return 0 ; -for (i =0 ; i < adev->vcn.num_vcn_inst; ++i) {if (adev->vcn.harvest_config & (1 << i))continue ;
@@ -327,9 +318,24 @@ int amdgpu_vcn_suspend(struct amdgpu_device *adev)drm_dev_exit (idx); } } +return 0 ; } +int amdgpu_vcn_suspend (struct amdgpu_device *adev) +{ +bool in_ras_intr =amdgpu_ras_intr_triggered (); + +cancel_delayed_work_sync (&adev->vcn.idle_work); + +/* err_event_athub will corrupt VCPU buffer, so we need to +* restore fw data and clear buffer in amdgpu_vcn_resume() */ +if (in_ras_intr) +return 0 ; + +return amdgpu_vcn_save_vcpu_bo (adev); +} +int amdgpu_vcn_resume (struct amdgpu_device *adev) {unsigned int size;
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1 -0
@@ -518,5 +518,6 @@ int amdgpu_vcn_ras_sw_init(struct amdgpu_device *adev);int amdgpu_vcn_psp_update_sram (struct amdgpu_device *adev,int inst_idx,enum AMDGPU_UCODE_ID ucode_id); +int amdgpu_vcn_save_vcpu_bo (struct amdgpu_device *adev);#endif
Signature · 1 line
2.25.1
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 117 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lijo Lazar
Sent: October 18, 2024 2:41 AM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Bhardwaj, Rajneesh <[email protected]>; Errabolu, Ramesh <[email protected]>; Zhou, Hao (Claire) <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Save VCN shared memory with init resetVCN shared memory is in framebuffer and there are some flags initialized during
sw_init. Ideally, such programming should be duringhw_init.Make sure the flags are saved during reset on initialization since that reset will affect frame buffer region. For clarity, separate it out to another function.
Signed-off-by Lijo Lazar <[email protected]>Reported-by Hao Zhou <[email protected]>Fixes 1b665567fd6d ("drm/amdgpu: Add reset on init handler for XGMI")---
v2: Rename save function to a more appropriateamdgpu_vcn_save_vcpu_bo(Leo)drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 26 ++++++++++++++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 1 + 3 files changed, 23 insertions(+), 10 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c +6
-0@@ -49,6 +49,12 @@ static int amdgpu_reset_xgmi_reset_on_init_suspend(struct amdgpu_device *adev) adev->ip_blocks[i].status.hw = false; } +/* VCN FW shared region is in frambuffer, there are some flags +* initialized in that region during sw_init. Make sure the region is +* backed up. +*/ +amdgpu_vcn_save_vcpu_bo (adev); +return 0 ; }drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-0@@ -294,21 +294,12 @@ bool amdgpu_vcn_is_disabled_vcn(struct
amdgpu_device*adev, enumvcn_ring_typetreturn ret;}
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +15
-10-int amdgpu_vcn_suspend (struct amdgpu_device *adev) +int amdgpu_vcn_save_vcpu_bo (struct amdgpu_device *adev) {unsigned int size;void *ptr;int i, idx; -bool in_ras_intr =amdgpu_ras_intr_triggered (); - -cancel_delayed_work_sync (&adev->vcn.idle_work); - -/* err_event_athub will corrupt VCPU buffer, so we need to -* restore fw data and clear buffer in amdgpu_vcn_resume() */ -if (in_ras_intr) -return 0 ; -for (i =0 ; i < adev->vcn.num_vcn_inst; ++i) {if (adev->vcn.harvest_config & (1 << i))continue ;@@ -327,9 +318,24 @@ int amdgpu_vcn_suspend(struct amdgpu_device *adev)drm_dev_exit (idx); } } +return 0 ; } +int amdgpu_vcn_suspend (struct amdgpu_device *adev) { +bool in_ras_intr =amdgpu_ras_intr_triggered (); + +cancel_delayed_work_sync (&adev->vcn.idle_work); + +/* err_event_athub will corrupt VCPU buffer, so we need to +* restore fw data and clear buffer in amdgpu_vcn_resume() */ +if (in_ras_intr) +return 0 ; + +return amdgpu_vcn_save_vcpu_bo (adev); +} +int amdgpu_vcn_resume (struct amdgpu_device *adev) {unsigned int size;drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1
-0@@ -518,5 +518,6 @@ int amdgpu_vcn_ras_sw_init(struct amdgpu_device *adev);int amdgpu_vcn_psp_update_sram (struct amdgpu_device *adev,int inst_idx,enum AMDGPU_UCODE_ID ucode_id); +int amdgpu_vcn_save_vcpu_bo (struct amdgpu_device *adev);#endif
--
2.25.1