Skip to content

Commit 591aec1

Browse files
Lijo Lazaralexdeucher
authored andcommitted
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. Fixes: 1e4acf4 ("drm/amdgpu: Add reset on init handler for XGMI") Signed-off-by: Lijo Lazar <[email protected]> Reported-by: Hao Zhou <[email protected]> Reviewed-by: Leo Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 971d8e1 commit 591aec1

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ static int amdgpu_reset_xgmi_reset_on_init_suspend(struct amdgpu_device *adev)
4444
adev->ip_blocks[i].status.hw = false;
4545
}
4646

47+
/* VCN FW shared region is in frambuffer, there are some flags
48+
* initialized in that region during sw_init. Make sure the region is
49+
* backed up.
50+
*/
51+
amdgpu_vcn_save_vcpu_bo(adev);
52+
4753
return 0;
4854
}
4955

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

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,21 +294,12 @@ bool amdgpu_vcn_is_disabled_vcn(struct amdgpu_device *adev, enum vcn_ring_type t
294294
return ret;
295295
}
296296

297-
int amdgpu_vcn_suspend(struct amdgpu_device *adev)
297+
int amdgpu_vcn_save_vcpu_bo(struct amdgpu_device *adev)
298298
{
299299
unsigned int size;
300300
void *ptr;
301301
int i, idx;
302302

303-
bool in_ras_intr = amdgpu_ras_intr_triggered();
304-
305-
cancel_delayed_work_sync(&adev->vcn.idle_work);
306-
307-
/* err_event_athub will corrupt VCPU buffer, so we need to
308-
* restore fw data and clear buffer in amdgpu_vcn_resume() */
309-
if (in_ras_intr)
310-
return 0;
311-
312303
for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
313304
if (adev->vcn.harvest_config & (1 << i))
314305
continue;
@@ -327,9 +318,24 @@ int amdgpu_vcn_suspend(struct amdgpu_device *adev)
327318
drm_dev_exit(idx);
328319
}
329320
}
321+
330322
return 0;
331323
}
332324

325+
int amdgpu_vcn_suspend(struct amdgpu_device *adev)
326+
{
327+
bool in_ras_intr = amdgpu_ras_intr_triggered();
328+
329+
cancel_delayed_work_sync(&adev->vcn.idle_work);
330+
331+
/* err_event_athub will corrupt VCPU buffer, so we need to
332+
* restore fw data and clear buffer in amdgpu_vcn_resume() */
333+
if (in_ras_intr)
334+
return 0;
335+
336+
return amdgpu_vcn_save_vcpu_bo(adev);
337+
}
338+
333339
int amdgpu_vcn_resume(struct amdgpu_device *adev)
334340
{
335341
unsigned int size;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,5 +518,6 @@ int amdgpu_vcn_ras_sw_init(struct amdgpu_device *adev);
518518

519519
int amdgpu_vcn_psp_update_sram(struct amdgpu_device *adev, int inst_idx,
520520
enum AMDGPU_UCODE_ID ucode_id);
521+
int amdgpu_vcn_save_vcpu_bo(struct amdgpu_device *adev);
521522

522523
#endif

0 commit comments

Comments
 (0)