All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: only save VKMS modeset state if VKMS is initialized
@ 2026-11-25  3:02 Prike Liang
  2026-11-25  3:09 ` sashiko-bot
  2026-11-25  3:36 ` Liang, Prike
  0 siblings, 2 replies; 3+ messages in thread
From: Prike Liang @ 2026-11-25  3:02 UTC (permalink / raw)
  To: amd-gfx
  Cc: Alexander.Deucher, Christian.Koenig, Sunpeng.Li,
	Mario.Limonciello, Lijo.Lazar, Prike Liang

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 <Prike.Liang@amd.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-25  3:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25  3:02 [PATCH] drm/amdgpu: only save VKMS modeset state if VKMS is initialized Prike Liang
2026-11-25  3:09 ` sashiko-bot
2026-11-25  3:36 ` Liang, Prike

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.