Commit 11a08cd5ab25 ("drm/amdgpu: save VKMS modeset state from the system
PM path only") moved drm_mode_config_helper_suspend()/resume() from the
VKMS IP block callbacks into amdgpu_device_suspend()/resume(), keyed on
adev->enable_virtual_display.
That flag does not mean a VKMS IP block exists. amdgpu_virt_init_setting()
sets it on SR-IOV VFs from the common block's early init, after the IP
blocks were added. A VF without a usable display IP gets no VKMS block,
so its mode config has no funcs, but enable_virtual_display is still true.
The old .suspend callback was never reached on such a device. Now
drm_atomic_helper_suspend() runs and drm_atomic_state_alloc() dereferences
the NULL dev->mode_config.funcs.
amdgpu_pci_shutdown() calls amdgpu_device_suspend(), so the guest oopses
on every shutdown and reboot, after it requested full access for FINI and
before it releases it. On a Navi32 (Radeon PRO V710) VF the host times the
full access out and resets the VF:
Received Event: VF1, event = 0x3(REQ_GPU_FINI)
VF1 entered full access mode.
VF1 full access timed out!
Issuing FLR on vf: 1.
After repeated timeouts the host ignores the VF's REQ_GPU_INIT_DATA and
REQ_GPU_INIT, and the next boot fails to probe:
amdgpu 0000:06:00.0: Doesn't get msg:1 from pf, error=-62
amdgpu 0000:06:00.0: probe with driver amdgpu failed with error -62
Check mode_info.mode_config_initialized too, as amdgpu_device_fini_hw()
does before it shuts the mode config down.
Fixes: 11a08cd5ab25 ("drm/amdgpu: save VKMS modeset state from the system PM
path only")
Signed-off-by: Prike Liang <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 0254b5531238..700d7517f22e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -4603,6 +4603,16 @@ void amdgpu_device_complete(struct drm_device *dev)
}
}
+/*
+ * enable_virtual_display is also set on SR-IOV VFs that have no display IP,
+ * where no VKMS IP block was added and the mode config was never set up.
+ */
+static bool amdgpu_device_has_vkms(struct amdgpu_device *adev)
+{
+ return adev->enable_virtual_display &&
+ adev->mode_info.mode_config_initialized;
+}
+
/**
* amdgpu_device_suspend - initiate device suspend
*
@@ -4644,7 +4654,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool
notify_clients)
amdgpu_ras_suspend(adev);
/* VKMS modeset state is saved here, never from the reset path */
- if (adev->enable_virtual_display) {
+ if (amdgpu_device_has_vkms(adev)) {
r = drm_mode_config_helper_suspend(dev);
if (r)
goto unwind_smartshift;
@@ -4701,7 +4711,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool
notify_clients)
}
unwind_vkms:
- if (adev->enable_virtual_display)
+ if (amdgpu_device_has_vkms(adev))
drm_mode_config_helper_resume(dev);
unwind_smartshift:
@@ -4803,7 +4813,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool
notify_clients)
goto exit;
}
- if (adev->enable_virtual_display) {
+ if (amdgpu_device_has_vkms(adev)) {
r = drm_mode_config_helper_resume(dev);
if (r)
goto exit;
--
2.34.1