Hi

Am 15.01.26 um 16:10 schrieb Ville Syrjälä:
On Thu, Jan 15, 2026 at 03:39:00PM +0100, Christian König wrote:
Sorry to being late, but I only now realized what you are doing here.

On 1/15/26 12:02, Thomas Zimmermann wrote:
Hi,

apologies for the delay. I wanted to reply and then forgot about it.

Am 10.01.26 um 05:52 schrieb Zack Rusin:
On Fri, Jan 9, 2026 at 5:34 AM Thomas Zimmermann <[email protected]> wrote:
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.
Well, some drivers (vbox, vmwgfx, bochs and currus-qemu) do it because
they request pci regions which is going to fail otherwise. Because
grabbining the pci resources is in general the very first thing that
those drivers need to do to setup anything, we
remove_conflicting_devices first or at least very early.
To my knowledge, requesting resources is more about correctness than a hard 
requirement to use an I/O or memory range. Has this changed?
Nope that is not correct.

At least for AMD GPUs remove_conflicting_devices() really early is necessary 
because otherwise some operations just result in a spontaneous system reboot.   
   

For example resizing the PCIe BAR giving access to VRAM or disabling VGA 
emulation (which AFAIK is used for EFI as well) is only possible when the VGA 
or EFI framebuffer driver is kicked out first.

And disabling VGA emulation is among the absolutely first steps you do to take 
over the scanout config.
It's similar for Intel. For us VGA emulation won't be used for
EFI boot, but we still can't have the previous driver poking
around in memory while the real driver is initializing. The
entire memory layout may get completely shuffled so there's
no telling where such memory accesses would land.

Isn't there code in display/intel_fbdev.c that reads back the old state from hardware before initializing fbdev? [1] How does that work then? Wouldn't the HW state be invalid already?

Best regards
Thomas

[1] https://elixir.bootlin.com/linux/v6.18.5/source/drivers/gpu/drm/i915/display/intel_fbdev.c#L356


And I suppose reBAR is a concern for us as well.


--
--
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)



Reply via email to