Skip to content

Commit c57040d

Browse files
committed
drm/amdgpu: disable gfxoff when using register read interface
When gfxoff is enabled, accessing gfx registers via MMIO can lead to a hang. Bug: https://bugzilla.kernel.org/show_bug.cgi?id=205497 Acked-by: Xiaojie Yuan <[email protected]> Reviewed-by: Evan Quan <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent d2a08e4 commit c57040d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,15 +649,19 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
649649
return -ENOMEM;
650650
alloc_size = info->read_mmr_reg.count * sizeof(*regs);
651651

652-
for (i = 0; i < info->read_mmr_reg.count; i++)
652+
amdgpu_gfx_off_ctrl(adev, false);
653+
for (i = 0; i < info->read_mmr_reg.count; i++) {
653654
if (amdgpu_asic_read_register(adev, se_num, sh_num,
654655
info->read_mmr_reg.dword_offset + i,
655656
&regs[i])) {
656657
DRM_DEBUG_KMS("unallowed offset %#x\n",
657658
info->read_mmr_reg.dword_offset + i);
658659
kfree(regs);
660+
amdgpu_gfx_off_ctrl(adev, true);
659661
return -EFAULT;
660662
}
663+
}
664+
amdgpu_gfx_off_ctrl(adev, true);
661665
n = copy_to_user(out, regs, min(size, alloc_size));
662666
kfree(regs);
663667
return n ? -EFAULT : 0;

0 commit comments

Comments
 (0)