[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c816f7ed-66e0-4773-b3d1-4769234bd30b@suse.de>
Date: Fri, 9 Jan 2026 11:34:27 +0100
From: Thomas Zimmermann <tzimmermann@...e.de>
To: Zack Rusin <zack.rusin@...adcom.com>, dri-devel@...ts.freedesktop.org
Cc: Alex Deucher <alexander.deucher@....com>, amd-gfx@...ts.freedesktop.org,
Ard Biesheuvel <ardb@...nel.org>, Ce Sun <cesun102@....com>,
Chia-I Wu <olvaffe@...il.com>, Christian König
<christian.koenig@....com>, Danilo Krummrich <dakr@...nel.org>,
Dave Airlie <airlied@...hat.com>, Deepak Rawat <drawat.floss@...il.com>,
Dmitry Osipenko <dmitry.osipenko@...labora.com>,
Gerd Hoffmann <kraxel@...hat.com>,
Gurchetan Singh <gurchetansingh@...omium.org>,
Hans de Goede <hansg@...nel.org>, Hawking Zhang <Hawking.Zhang@....com>,
Helge Deller <deller@....de>, intel-gfx@...ts.freedesktop.org,
intel-xe@...ts.freedesktop.org, Jani Nikula <jani.nikula@...ux.intel.com>,
Javier Martinez Canillas <javierm@...hat.com>,
Jocelyn Falempe <jfalempe@...hat.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Lijo Lazar <lijo.lazar@....com>, linux-efi@...r.kernel.org,
linux-fbdev@...r.kernel.org, linux-hyperv@...r.kernel.org,
linux-kernel@...r.kernel.org, Lucas De Marchi <lucas.demarchi@...el.com>,
Lyude Paul <lyude@...hat.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
"Mario Limonciello (AMD)" <superm1@...nel.org>,
Mario Limonciello <mario.limonciello@....com>,
Maxime Ripard <mripard@...nel.org>, nouveau@...ts.freedesktop.org,
Rodrigo Vivi <rodrigo.vivi@...el.com>, Simona Vetter <simona@...ll.ch>,
spice-devel@...ts.freedesktop.org,
Thomas Hellström <thomas.hellstrom@...ux.intel.com>,
Timur Kristóf <timur.kristof@...il.com>,
Tvrtko Ursulin <tursulin@...ulin.net>, virtualization@...ts.linux.dev,
Vitaly Prosyak <vitaly.prosyak@....com>
Subject: Re: [PATCH 00/12] Recover sysfb after DRM probe failure
Hi
Am 29.12.25 um 22:58 schrieb Zack Rusin:
> Almost a rite of passage for every DRM developer and most Linux users
> is upgrading your DRM driver/updating boot flags/changing some config
> and having DRM driver fail at probe resulting in a blank screen.
>
> Currently there's no way to recover from DRM driver probe failure. PCI
> DRM driver explicitly throw out the existing sysfb to get exclusive
> access to PCI resources so if the probe fails the system is left without
> a functioning display driver.
>
> Add code to sysfb to recever system framebuffer when DRM driver's probe
> fails. This means that a DRM driver that fails to load reloads the system
> framebuffer driver.
>
> This works best with simpledrm. Without it Xorg won't recover because
> it still tries to load the vendor specific driver which ends up usually
> not working at all. With simpledrm the system recovers really nicely
> ending up with a working console and not a blank screen.
>
> There's a caveat in that some hardware might require some special magic
> register write to recover EFI display. I'd appreciate it a lot if
> maintainers could introduce a temporary failure in their drivers
> probe to validate that the sysfb recovers and they get a working console.
> The easiest way to double check it is by adding:
> /* XXX: Temporary failure to test sysfb restore - REMOVE BEFORE COMMIT */
> dev_info(&pdev->dev, "Testing sysfb restore: forcing probe failure\n");
> ret = -EINVAL;
> goto out_error;
> or such right after the devm_aperture_remove_conflicting_pci_devices .
Recovering the display like that is guess work and will at best work
with simple discrete devices where the framebuffer is always located in
a confined graphics aperture.
But the problem you're trying to solve is a real one.
What we'd want to do instead is to take the initial hardware state into
account when we do the initial mode-setting operation.
The first step is to move each driver's remove_conflicting_devices call
to the latest possible location in the probe function. We usually do it
first, because that's easy. But on most hardware, it could happen much
later. The native driver is free to examine hardware state while probing
the device as long as it does not interfere with the pre-configured
framebuffer mode/format/address. Hence it can set up it's internal
structures while the sysfb device is still active.
The next step for the native driver is to load the pre-configured
hardware state into its initial internal atomic state. Maxime has worked
on that on and off. The last iteration I'm aware of is at [1].
After the state-readout, the sysfb device has to be unplugged. But as
the underlying hardware config remains active, the native driver can now
use and modify it. We currently do a drm_mode_config_reset(), which
clears the state and then let the first client set a new display state.
But with state-readout, we could either pick up the existing framebuffer
directly or do a proper modeset from existing state.
As DRM clients control the mode setting, they'd likely need some changes
to handle state-readout. There's such code in i915's fbdev support AFAIK.
Best regards
Thomas
[1]
https://lore.kernel.org/dri-devel/20250902-drm-state-readout-v1-0-14ad5315da3f@kernel.org/
>
> Cc: Alex Deucher <alexander.deucher@....com>
> Cc: amd-gfx@...ts.freedesktop.org
> Cc: Ard Biesheuvel <ardb@...nel.org>
> Cc: Ce Sun <cesun102@....com>
> Cc: Chia-I Wu <olvaffe@...il.com>
> Cc: "Christian König" <christian.koenig@....com>
> Cc: Danilo Krummrich <dakr@...nel.org>
> Cc: Dave Airlie <airlied@...hat.com>
> Cc: Deepak Rawat <drawat.floss@...il.com>
> Cc: Dmitry Osipenko <dmitry.osipenko@...labora.com>
> Cc: dri-devel@...ts.freedesktop.org
> Cc: Gerd Hoffmann <kraxel@...hat.com>
> Cc: Gurchetan Singh <gurchetansingh@...omium.org>
> Cc: Hans de Goede <hansg@...nel.org>
> Cc: Hawking Zhang <Hawking.Zhang@....com>
> Cc: Helge Deller <deller@....de>
> Cc: intel-gfx@...ts.freedesktop.org
> Cc: intel-xe@...ts.freedesktop.org
> Cc: Jani Nikula <jani.nikula@...ux.intel.com>
> Cc: Javier Martinez Canillas <javierm@...hat.com>
> Cc: Jocelyn Falempe <jfalempe@...hat.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>
> Cc: Lijo Lazar <lijo.lazar@....com>
> Cc: linux-efi@...r.kernel.org
> Cc: linux-fbdev@...r.kernel.org
> Cc: linux-hyperv@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Cc: Lucas De Marchi <lucas.demarchi@...el.com>
> Cc: Lyude Paul <lyude@...hat.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>
> Cc: "Mario Limonciello (AMD)" <superm1@...nel.org>
> Cc: Mario Limonciello <mario.limonciello@....com>
> Cc: Maxime Ripard <mripard@...nel.org>
> Cc: nouveau@...ts.freedesktop.org
> Cc: Rodrigo Vivi <rodrigo.vivi@...el.com>
> Cc: Simona Vetter <simona@...ll.ch>
> Cc: spice-devel@...ts.freedesktop.org
> Cc: "Thomas Hellström" <thomas.hellstrom@...ux.intel.com>
> Cc: Thomas Zimmermann <tzimmermann@...e.de>
> Cc: "Timur Kristóf" <timur.kristof@...il.com>
> Cc: Tvrtko Ursulin <tursulin@...ulin.net>
> Cc: virtualization@...ts.linux.dev
> Cc: Vitaly Prosyak <vitaly.prosyak@....com>
>
> Zack Rusin (12):
> video/aperture: Add sysfb restore on DRM probe failure
> drm/vmwgfx: Use devm aperture helpers for sysfb restore on probe
> failure
> drm/xe: Use devm aperture helpers for sysfb restore on probe failure
> drm/amdgpu: Use devm aperture helpers for sysfb restore on probe
> failure
> drm/virtio: Add sysfb restore on probe failure
> drm/nouveau: Use devm aperture helpers for sysfb restore on probe
> failure
> drm/qxl: Use devm aperture helpers for sysfb restore on probe failure
> drm/vboxvideo: Use devm aperture helpers for sysfb restore on probe
> failure
> drm/hyperv: Add sysfb restore on probe failure
> drm/ast: Use devm aperture helpers for sysfb restore on probe failure
> drm/radeon: Use devm aperture helpers for sysfb restore on probe
> failure
> drm/i915: Use devm aperture helpers for sysfb restore on probe failure
>
> drivers/firmware/efi/sysfb_efi.c | 2 +-
> drivers/firmware/sysfb.c | 191 +++++++++++++--------
> drivers/firmware/sysfb_simplefb.c | 10 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 +
> drivers/gpu/drm/ast/ast_drv.c | 13 +-
> drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 23 +++
> drivers/gpu/drm/i915/i915_driver.c | 13 +-
> drivers/gpu/drm/nouveau/nouveau_drm.c | 16 +-
> drivers/gpu/drm/qxl/qxl_drv.c | 14 +-
> drivers/gpu/drm/radeon/radeon_drv.c | 15 +-
> drivers/gpu/drm/vboxvideo/vbox_drv.c | 13 +-
> drivers/gpu/drm/virtio/virtgpu_drv.c | 29 ++++
> drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 13 +-
> drivers/gpu/drm/xe/xe_device.c | 7 +-
> drivers/gpu/drm/xe/xe_pci.c | 7 +
> drivers/video/aperture.c | 54 ++++++
> include/linux/aperture.h | 14 ++
> include/linux/sysfb.h | 6 +
> 19 files changed, 368 insertions(+), 88 deletions(-)
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
Powered by blists - more mailing lists