[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251229215906.3688205-10-zack.rusin@broadcom.com>
Date: Mon, 29 Dec 2025 16:58:15 -0500
From: Zack Rusin <zack.rusin@...adcom.com>
To: dri-devel@...ts.freedesktop.org
Cc: Deepak Rawat <drawat.floss@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>,
linux-hyperv@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 09/12] drm/hyperv: Add sysfb restore on probe failure
Register a devm action on the vmbus device to restore the system
framebuffer (efifb/simpledrm) if the driver's probe fails after
removing the firmware framebuffer.
Unlike PCI drivers, hyperv cannot use the
devm_aperture_remove_conflicting_pci_devices() helper because this
is a vmbus device, not a PCI device. Instead, register the sysfb
restore action on the hv device (&hdev->device) which will be
released if probe fails. Cancel the action after successful probe
since the driver is now responsible for display output.
This ensures users don't lose display output if the hyperv driver
fails to probe after removing the firmware framebuffer.
Signed-off-by: Zack Rusin <zack.rusin@...adcom.com>
Cc: Deepak Rawat <drawat.floss@...il.com>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>
Cc: Maxime Ripard <mripard@...nel.org>
Cc: Thomas Zimmermann <tzimmermann@...e.de>
Cc: David Airlie <airlied@...il.com>
Cc: Simona Vetter <simona@...ll.ch>
Cc: linux-hyperv@...r.kernel.org
Cc: dri-devel@...ts.freedesktop.org
Cc: linux-kernel@...r.kernel.org
---
drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
index 06b5d96e6eaf..6d66cd243bab 100644
--- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
@@ -8,6 +8,7 @@
#include <linux/hyperv.h>
#include <linux/module.h>
#include <linux/pci.h>
+#include <linux/sysfb.h>
#include <drm/clients/drm_client_setup.h>
#include <drm/drm_atomic_helper.h>
@@ -102,6 +103,11 @@ static int hyperv_setup_vram(struct hyperv_drm_device *hv,
return ret;
}
+static void hyperv_restore_sysfb(void *unused)
+{
+ sysfb_restore();
+}
+
static int hyperv_vmbus_probe(struct hv_device *hdev,
const struct hv_vmbus_device_id *dev_id)
{
@@ -127,6 +133,17 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
aperture_remove_all_conflicting_devices(hyperv_driver.name);
+ /*
+ * Register sysfb restore on the hv device. We can't use
+ * devm_aperture_remove_conflicting_pci_devices() because this
+ * is a vmbus device, not a PCI device. Register on &hdev->device
+ * so it fires if our probe fails after removing firmware FB.
+ */
+ ret = devm_add_action_or_reset(&hdev->device, hyperv_restore_sysfb,
+ NULL);
+ if (ret)
+ goto err_vmbus_close;
+
ret = hyperv_setup_vram(hv, hdev);
if (ret)
goto err_vmbus_close;
@@ -152,6 +169,12 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
drm_client_setup(dev, NULL);
+ /*
+ * Probe succeeded - cancel sysfb restore. We're now responsible
+ * for display output.
+ */
+ devm_remove_action(&hdev->device, hyperv_restore_sysfb, NULL);
+
return 0;
err_free_mmio:
--
2.48.1
Powered by blists - more mailing lists