Skip to content

Commit eef72d8

Browse files
guoqzhangregkh
authored andcommitted
drm/amdgpu: fix gpu page fault after hibernation on PF passthrough
[ Upstream commit eb6e7f520d6efa4d4ebf1671455abe4a681f7a05 ] 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 <[email protected]> Reviewed-by: Lijo Lazar <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 5d1b32cfe4a676fe552416cb5ae847b215463a1a) Signed-off-by: Sasha Levin <[email protected]>
1 parent 7c2a888 commit eef72d8

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

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)