Skip to content

Commit eb6e7f5

Browse files
guoqzhanalexdeucher
authored andcommitted
drm/amdgpu: fix gpu page fault after hibernation on PF passthrough
On PF passthrough environment, after hibernate and then resume, coralgemm will cause gpu page fault. Mode1 reset happens during hibernate, but partition mode is not restored on resume, register mmCP_HYP_XCP_CTL and mmCP_PSP_XCP_CTL is not right after resume. When CP access the MQD BO, wrong stride size is used, this will cause out of bound access on the MQD BO, resulting page fault. The fix is to ensure gfx_v9_4_3_switch_compute_partition() is called when resume from a hibernation. KFD resume is called separately during a reset recovery or resume from suspend sequence. Hence it's not required to be called as part of partition switch. Signed-off-by: Samuel Zhang <guoqing.zhang@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 5d1b32c)
1 parent 6dd97ce commit eb6e7f5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ static int aqua_vanjaram_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr,
407407
return -EINVAL;
408408
}
409409

410-
if (adev->kfd.init_complete && !amdgpu_in_reset(adev))
410+
if (adev->kfd.init_complete && !amdgpu_in_reset(adev) &&
411+
!adev->in_suspend)
411412
flags |= AMDGPU_XCP_OPS_KFD;
412413

413414
if (flags & AMDGPU_XCP_OPS_KFD) {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2292,7 +2292,9 @@ static int gfx_v9_4_3_cp_resume(struct amdgpu_device *adev)
22922292
r = amdgpu_xcp_init(adev->xcp_mgr, num_xcp, mode);
22932293

22942294
} else {
2295-
if (amdgpu_xcp_query_partition_mode(adev->xcp_mgr,
2295+
if (adev->in_suspend)
2296+
amdgpu_xcp_restore_partition_mode(adev->xcp_mgr);
2297+
else if (amdgpu_xcp_query_partition_mode(adev->xcp_mgr,
22962298
AMDGPU_XCP_FL_NONE) ==
22972299
AMDGPU_UNKNOWN_COMPUTE_PARTITION_MODE)
22982300
r = amdgpu_xcp_switch_partition_mode(

0 commit comments

Comments
 (0)