* Re: [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info
2026-06-23 14:15 [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info Mario Limonciello
@ 2026-06-24 6:08 ` Thomas Zimmermann
2026-06-24 6:09 ` Thomas Zimmermann
` (2 subsequent siblings)
3 siblings, 0 replies; 13+ messages in thread
From: Thomas Zimmermann @ 2026-06-24 6:08 UTC (permalink / raw)
To: Mario Limonciello, Bjorn Helgaas, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen
Cc: maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:PCI SUBSYSTEM, Aaron Ma
Hi
Am 23.06.26 um 16:15 schrieb Mario Limonciello:
> Some multi GPU systems may have a VGA compatible device, but that might
> not be used for display. If due to enumeration order this device is
> found before the one actually used for display then multiple devices
> may show the boot_display attribute, confusing userspace.
>
> When screen info is valid, use it exclusively to find the primary
> device so that only the device backing the framebuffer is reported.
> Only when no framebuffer has been set up does it make sense to fall
> back to the default VGA device. This ensures at most one primary
> graphics device, preferably the one with the framebuffer.
>
> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: ad90860bd10ee ("fbcon: Use screen info to find primary device")
> Reported-by: Aaron Ma <aaron.ma@canonical.com>
> Closes: https://lore.kernel.org/linux-pci/20260618081803.2790848-1-aaron.ma@canonical.com/#t
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
This looks good. Thanks for fixing this issue.
Best regards
Thomas
> ---
> v1->v2:
> * Fix subject
> * Keep vga_default_device() as fallback instead of remove all
> together
> arch/x86/video/video-common.c | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/video/video-common.c b/arch/x86/video/video-common.c
> index 152789f00fcda..8ed82fff7638e 100644
> --- a/arch/x86/video/video-common.c
> +++ b/arch/x86/video/video-common.c
> @@ -43,21 +43,26 @@ bool video_is_primary_device(struct device *dev)
> if (!pci_is_display(pdev))
> return false;
>
> - if (pdev == vga_default_device())
> - return true;
> -
> #ifdef CONFIG_SCREEN_INFO
> numres = screen_info_resources(si, res, ARRAY_SIZE(res));
> - for (i = 0; i < numres; ++i) {
> - if (!(res[i].flags & IORESOURCE_MEM))
> - continue;
> + if (numres > 0) {
> + for (i = 0; i < numres; ++i) {
> + if (!(res[i].flags & IORESOURCE_MEM))
> + continue;
> +
> + if (pci_find_resource(pdev, &res[i]))
> + return true;
> + }
>
> - if (pci_find_resource(pdev, &res[i]))
> - return true;
> + return false;
> }
> #endif
>
> - return false;
> + /*
> + * No framebuffer was set up by the firmware/bootloader, so fall back
> + * to the default VGA device.
> + */
> + return pdev == vga_default_device();
> }
> EXPORT_SYMBOL(video_is_primary_device);
>
--
--
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)
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info
2026-06-23 14:15 [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info Mario Limonciello
2026-06-24 6:08 ` Thomas Zimmermann
@ 2026-06-24 6:09 ` Thomas Zimmermann
2026-06-24 8:45 ` Aaron Ma
2026-07-07 15:23 ` [tip: x86/urgent] " tip-bot2 for Mario Limonciello
3 siblings, 0 replies; 13+ messages in thread
From: Thomas Zimmermann @ 2026-06-24 6:09 UTC (permalink / raw)
To: Mario Limonciello, Bjorn Helgaas, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen
Cc: maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:PCI SUBSYSTEM, Aaron Ma
FYI a related change to Xorg is at
https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2242
Am 23.06.26 um 16:15 schrieb Mario Limonciello:
> Some multi GPU systems may have a VGA compatible device, but that might
> not be used for display. If due to enumeration order this device is
> found before the one actually used for display then multiple devices
> may show the boot_display attribute, confusing userspace.
>
> When screen info is valid, use it exclusively to find the primary
> device so that only the device backing the framebuffer is reported.
> Only when no framebuffer has been set up does it make sense to fall
> back to the default VGA device. This ensures at most one primary
> graphics device, preferably the one with the framebuffer.
>
> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: ad90860bd10ee ("fbcon: Use screen info to find primary device")
> Reported-by: Aaron Ma <aaron.ma@canonical.com>
> Closes: https://lore.kernel.org/linux-pci/20260618081803.2790848-1-aaron.ma@canonical.com/#t
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> v1->v2:
> * Fix subject
> * Keep vga_default_device() as fallback instead of remove all
> together
> arch/x86/video/video-common.c | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/video/video-common.c b/arch/x86/video/video-common.c
> index 152789f00fcda..8ed82fff7638e 100644
> --- a/arch/x86/video/video-common.c
> +++ b/arch/x86/video/video-common.c
> @@ -43,21 +43,26 @@ bool video_is_primary_device(struct device *dev)
> if (!pci_is_display(pdev))
> return false;
>
> - if (pdev == vga_default_device())
> - return true;
> -
> #ifdef CONFIG_SCREEN_INFO
> numres = screen_info_resources(si, res, ARRAY_SIZE(res));
> - for (i = 0; i < numres; ++i) {
> - if (!(res[i].flags & IORESOURCE_MEM))
> - continue;
> + if (numres > 0) {
> + for (i = 0; i < numres; ++i) {
> + if (!(res[i].flags & IORESOURCE_MEM))
> + continue;
> +
> + if (pci_find_resource(pdev, &res[i]))
> + return true;
> + }
>
> - if (pci_find_resource(pdev, &res[i]))
> - return true;
> + return false;
> }
> #endif
>
> - return false;
> + /*
> + * No framebuffer was set up by the firmware/bootloader, so fall back
> + * to the default VGA device.
> + */
> + return pdev == vga_default_device();
> }
> EXPORT_SYMBOL(video_is_primary_device);
>
--
--
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)
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info
2026-06-23 14:15 [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info Mario Limonciello
2026-06-24 6:08 ` Thomas Zimmermann
2026-06-24 6:09 ` Thomas Zimmermann
@ 2026-06-24 8:45 ` Aaron Ma
2026-06-25 22:58 ` Mario Limonciello
2026-07-07 15:23 ` [tip: x86/urgent] " tip-bot2 for Mario Limonciello
3 siblings, 1 reply; 13+ messages in thread
From: Aaron Ma @ 2026-06-24 8:45 UTC (permalink / raw)
To: Mario Limonciello
Cc: Bjorn Helgaas, Thomas Zimmermann, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:PCI SUBSYSTEM
Hi Mario,
Tested your v2 patch + Xorg MR !2242 on the hybrid system
(AMD 0x0380 + NVIDIA 0x030000, EFI framebuffer on AMD).
Result:
AMD: boot_display=1, boot_vga absent
NVIDIA: boot_display absent, boot_vga=1
Xorg now picks AMD correctly. boot_display is fixed.
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Aaron
On Tue, Jun 23, 2026 at 10:15 PM Mario Limonciello
<mario.limonciello@amd.com> wrote:
>
> Some multi GPU systems may have a VGA compatible device, but that might
> not be used for display. If due to enumeration order this device is
> found before the one actually used for display then multiple devices
> may show the boot_display attribute, confusing userspace.
>
> When screen info is valid, use it exclusively to find the primary
> device so that only the device backing the framebuffer is reported.
> Only when no framebuffer has been set up does it make sense to fall
> back to the default VGA device. This ensures at most one primary
> graphics device, preferably the one with the framebuffer.
>
> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: ad90860bd10ee ("fbcon: Use screen info to find primary device")
> Reported-by: Aaron Ma <aaron.ma@canonical.com>
> Closes: https://lore.kernel.org/linux-pci/20260618081803.2790848-1-aaron.ma@canonical.com/#t
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> v1->v2:
> * Fix subject
> * Keep vga_default_device() as fallback instead of remove all
> together
> arch/x86/video/video-common.c | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/video/video-common.c b/arch/x86/video/video-common.c
> index 152789f00fcda..8ed82fff7638e 100644
> --- a/arch/x86/video/video-common.c
> +++ b/arch/x86/video/video-common.c
> @@ -43,21 +43,26 @@ bool video_is_primary_device(struct device *dev)
> if (!pci_is_display(pdev))
> return false;
>
> - if (pdev == vga_default_device())
> - return true;
> -
> #ifdef CONFIG_SCREEN_INFO
> numres = screen_info_resources(si, res, ARRAY_SIZE(res));
> - for (i = 0; i < numres; ++i) {
> - if (!(res[i].flags & IORESOURCE_MEM))
> - continue;
> + if (numres > 0) {
> + for (i = 0; i < numres; ++i) {
> + if (!(res[i].flags & IORESOURCE_MEM))
> + continue;
> +
> + if (pci_find_resource(pdev, &res[i]))
> + return true;
> + }
>
> - if (pci_find_resource(pdev, &res[i]))
> - return true;
> + return false;
> }
> #endif
>
> - return false;
> + /*
> + * No framebuffer was set up by the firmware/bootloader, so fall back
> + * to the default VGA device.
> + */
> + return pdev == vga_default_device();
> }
> EXPORT_SYMBOL(video_is_primary_device);
>
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info
2026-06-24 8:45 ` Aaron Ma
@ 2026-06-25 22:58 ` Mario Limonciello
2026-07-06 17:47 ` Mario Limonciello
0 siblings, 1 reply; 13+ messages in thread
From: Mario Limonciello @ 2026-06-25 22:58 UTC (permalink / raw)
To: Bjorn Helgaas, Borislav Petkov
Cc: Thomas Zimmermann, Thomas Gleixner, Ingo Molnar, Dave Hansen,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:PCI SUBSYSTEM, Aaron Ma
On 6/24/26 01:45, Aaron Ma wrote:
> Hi Mario,
>
> Tested your v2 patch + Xorg MR !2242 on the hybrid system
> (AMD 0x0380 + NVIDIA 0x030000, EFI framebuffer on AMD).
>
> Result:
>
> AMD: boot_display=1, boot_vga absent
> NVIDIA: boot_display absent, boot_vga=1
>
> Xorg now picks AMD correctly. boot_display is fixed.
>
> Tested-by: Aaron Ma <aaron.ma@canonical.com>
>
Great news, thanks for checking it.
Bjorn, can you pick this up? Or do you want this to go through tip? I
can see arguments for both ways.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info
2026-06-25 22:58 ` Mario Limonciello
@ 2026-07-06 17:47 ` Mario Limonciello
2026-07-07 3:56 ` Borislav Petkov
0 siblings, 1 reply; 13+ messages in thread
From: Mario Limonciello @ 2026-07-06 17:47 UTC (permalink / raw)
To: Bjorn Helgaas, Borislav Petkov
Cc: Thomas Zimmermann, Thomas Gleixner, Ingo Molnar, Dave Hansen,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:PCI SUBSYSTEM, Aaron Ma
On 6/25/26 17:58, Mario Limonciello wrote:
> On 6/24/26 01:45, Aaron Ma wrote:
>> Hi Mario,
>>
>> Tested your v2 patch + Xorg MR !2242 on the hybrid system
>> (AMD 0x0380 + NVIDIA 0x030000, EFI framebuffer on AMD).
>>
>> Result:
>>
>> AMD: boot_display=1, boot_vga absent
>> NVIDIA: boot_display absent, boot_vga=1
>>
>> Xorg now picks AMD correctly. boot_display is fixed.
>>
>> Tested-by: Aaron Ma <aaron.ma@canonical.com>
>>
>
> Great news, thanks for checking it.
>
> Bjorn, can you pick this up? Or do you want this to go through tip? I
> can see arguments for both ways.
>
Boris or Bjron,
Can you pick this up for fixes? Here is the lore link.
https://lore.kernel.org/linux-pci/20260623141505.1816786-1-mario.limonciello@amd.com/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info
2026-07-06 17:47 ` Mario Limonciello
@ 2026-07-07 3:56 ` Borislav Petkov
2026-07-07 4:02 ` Mario Limonciello
0 siblings, 1 reply; 13+ messages in thread
From: Borislav Petkov @ 2026-07-07 3:56 UTC (permalink / raw)
To: Mario Limonciello
Cc: Bjorn Helgaas, Thomas Zimmermann, Thomas Gleixner, Ingo Molnar,
Dave Hansen, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:PCI SUBSYSTEM, Aaron Ma
On Mon, Jul 06, 2026 at 12:47:39PM -0500, Mario Limonciello wrote:
> Boris or Bjron,
>
> Can you pick this up for fixes? Here is the lore link.
>
> https://lore.kernel.org/linux-pci/20260623141505.1816786-1-mario.limonciello@amd.com/
Sashiko has a question and now that I read it, I wanna know too:
https://sashiko.dev/#/patchset/20260623141505.1816786-1-mario.limonciello%40amd.com
:-)
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info
2026-07-07 3:56 ` Borislav Petkov
@ 2026-07-07 4:02 ` Mario Limonciello
2026-07-07 4:18 ` Borislav Petkov
0 siblings, 1 reply; 13+ messages in thread
From: Mario Limonciello @ 2026-07-07 4:02 UTC (permalink / raw)
To: Borislav Petkov, Mario Limonciello
Cc: Bjorn Helgaas, Thomas Zimmermann, Thomas Gleixner, Ingo Molnar,
Dave Hansen, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:PCI SUBSYSTEM, Aaron Ma
On 7/6/26 10:56 PM, Borislav Petkov wrote:
> On Mon, Jul 06, 2026 at 12:47:39PM -0500, Mario Limonciello wrote:
>> Boris or Bjron,
>>
>> Can you pick this up for fixes? Here is the lore link.
>>
>> https://lore.kernel.org/linux-pci/20260623141505.1816786-1-mario.limonciello@amd.com/
>
> Sashiko has a question and now that I read it, I wanna know too:
>
> https://sashiko.dev/#/patchset/20260623141505.1816786-1-mario.limonciello%40amd.com
>
> :-)
Those systems use the existing boot_vga sysfs file (which is unchanged).
Userspace recognizes both boot_vga for those systems and boot_display
for modern systems depending upon the use.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info
2026-07-07 4:02 ` Mario Limonciello
@ 2026-07-07 4:18 ` Borislav Petkov
2026-07-07 4:47 ` Mario Limonciello
0 siblings, 1 reply; 13+ messages in thread
From: Borislav Petkov @ 2026-07-07 4:18 UTC (permalink / raw)
To: Mario Limonciello
Cc: Mario Limonciello, Bjorn Helgaas, Thomas Zimmermann,
Thomas Gleixner, Ingo Molnar, Dave Hansen,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:PCI SUBSYSTEM, Aaron Ma
On Mon, Jul 06, 2026 at 11:02:04PM -0500, Mario Limonciello wrote:
> Those systems use the existing boot_vga sysfs file (which is unchanged).
>
> Userspace recognizes both boot_vga for those systems and boot_display for
> modern systems depending upon the use.
You're "explaining" as if I were someone who actually knows anything about
display gunk. But you need to dumb it down for me so that I can actually
understand why we're fine here and we don't need to fallback to
vga_default_device() here, as the LLM has "inferred".
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info
2026-07-07 4:18 ` Borislav Petkov
@ 2026-07-07 4:47 ` Mario Limonciello
2026-07-07 5:01 ` Borislav Petkov
0 siblings, 1 reply; 13+ messages in thread
From: Mario Limonciello @ 2026-07-07 4:47 UTC (permalink / raw)
To: Borislav Petkov
Cc: Mario Limonciello, Bjorn Helgaas, Thomas Zimmermann,
Thomas Gleixner, Ingo Molnar, Dave Hansen,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:PCI SUBSYSTEM, Aaron Ma
On 7/6/26 23:18, Borislav Petkov wrote:
> On Mon, Jul 06, 2026 at 11:02:04PM -0500, Mario Limonciello wrote:
>> Those systems use the existing boot_vga sysfs file (which is unchanged).
>>
>> Userspace recognizes both boot_vga for those systems and boot_display for
>> modern systems depending upon the use.
>
> You're "explaining" as if I were someone who actually knows anything about
> display gunk. But you need to dumb it down for me so that I can actually
> understand why we're fine here and we don't need to fallback to
> vga_default_device() here, as the LLM has "inferred".
>
> Thx.
>
OK, let me try.
So a long time ago there was this sysfs attribute introduced for telling
which device in the system was used for displaying pre-OS. It mattered
when you had multi GPU systems.
It wasn't perfect, but there were enough heuristics put in place that it
was good enough.
Userspace would take this as a hint and try to set what it thought was
the primary GPU. This has implications for power consumption, what is
used for rendering, all sorts of stuff.
Well the heuristics started to break when we started having display
adapters that were no longer VGA and those were in multi GPU systems.
Rather than change the heuristics for boot_vga we introduced a new
attribute boot_display that indicated which device was used for
displaying. This is semantically very similar to boot_vga; but it can
apply to any display adapter.
Because userspace has used boot_vga forever and boot_display was new
userspace effectively has to support both for two reasons:
1) so that users can mix and match kernels and userspace
2) For the ancient hardware the LLM is complaining about.
So my point here is that even if boot_display fails to be populated on
anything in your system (such as reasons the LLM called out) you will
still have boot_vga, and userspace still uses boot_vga.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info
2026-07-07 4:47 ` Mario Limonciello
@ 2026-07-07 5:01 ` Borislav Petkov
2026-07-07 12:52 ` Mario Limonciello
0 siblings, 1 reply; 13+ messages in thread
From: Borislav Petkov @ 2026-07-07 5:01 UTC (permalink / raw)
To: Mario Limonciello
Cc: Mario Limonciello, Bjorn Helgaas, Thomas Zimmermann,
Thomas Gleixner, Ingo Molnar, Dave Hansen,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:PCI SUBSYSTEM, Aaron Ma
On Mon, Jul 06, 2026 at 11:47:48PM -0500, Mario Limonciello wrote:
> So my point here is that even if boot_display fails to be populated on
> anything in your system (such as reasons the LLM called out) you will still
> have boot_vga, and userspace still uses boot_vga.
Aha, ok. Thanks for taking the time - that does make more sense.
So looking at Fixes: I presume you want me to send this to Linus now so that
it goes to stable too?
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info
2026-07-07 5:01 ` Borislav Petkov
@ 2026-07-07 12:52 ` Mario Limonciello
0 siblings, 0 replies; 13+ messages in thread
From: Mario Limonciello @ 2026-07-07 12:52 UTC (permalink / raw)
To: Borislav Petkov
Cc: Mario Limonciello, Bjorn Helgaas, Thomas Zimmermann,
Thomas Gleixner, Ingo Molnar, Dave Hansen,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT),
open list:PCI SUBSYSTEM, Aaron Ma
On 7/7/26 12:01 AM, Borislav Petkov wrote:
> On Mon, Jul 06, 2026 at 11:47:48PM -0500, Mario Limonciello wrote:
>> So my point here is that even if boot_display fails to be populated on
>> anything in your system (such as reasons the LLM called out) you will still
>> have boot_vga, and userspace still uses boot_vga.
>
> Aha, ok. Thanks for taking the time - that does make more sense.
>
> So looking at Fixes: I presume you want me to send this to Linus now so that
> it goes to stable too?
>
Yes, please.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [tip: x86/urgent] x86/video: Only fall back to vga_default_device() without screen info
2026-06-23 14:15 [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info Mario Limonciello
` (2 preceding siblings ...)
2026-06-24 8:45 ` Aaron Ma
@ 2026-07-07 15:23 ` tip-bot2 for Mario Limonciello
3 siblings, 0 replies; 13+ messages in thread
From: tip-bot2 for Mario Limonciello @ 2026-07-07 15:23 UTC (permalink / raw)
To: linux-tip-commits
Cc: Aaron Ma, Thomas Zimmermann, Mario Limonciello,
Borislav Petkov (AMD), stable, x86, linux-kernel
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 596b3678326d3d1aed7c19423b6746f1ce09688a
Gitweb: https://git.kernel.org/tip/596b3678326d3d1aed7c19423b6746f1ce09688a
Author: Mario Limonciello <mario.limonciello@amd.com>
AuthorDate: Tue, 23 Jun 2026 07:15:05 -07:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Tue, 07 Jul 2026 08:14:55 -07:00
x86/video: Only fall back to vga_default_device() without screen info
Some multi GPU systems may have a VGA compatible device, but that might not be
used for display. If due to enumeration order this device is found before the
one actually used for display then multiple devices may show the boot_display
attribute, confusing userspace.
When screen info is valid, use it exclusively to find the primary device so
that only the device backing the framebuffer is reported. Only when no
framebuffer has been set up does it make sense to fall back to the default VGA
device. This ensures at most one primary graphics device, preferably the one
with the framebuffer.
Fixes: ad90860bd10ee ("fbcon: Use screen info to find primary device")
Closes: https://lore.kernel.org/linux-pci/20260618081803.2790848-1-aaron.ma@canonical.com/#t
Reported-by: Aaron Ma <aaron.ma@canonical.com>
Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Cc: <stable@kernel.org>
Link: https://patch.msgid.link/20260623141505.1816786-1-mario.limonciello@amd.com
---
arch/x86/video/video-common.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/arch/x86/video/video-common.c b/arch/x86/video/video-common.c
index 152789f..8ed82ff 100644
--- a/arch/x86/video/video-common.c
+++ b/arch/x86/video/video-common.c
@@ -43,21 +43,26 @@ bool video_is_primary_device(struct device *dev)
if (!pci_is_display(pdev))
return false;
- if (pdev == vga_default_device())
- return true;
-
#ifdef CONFIG_SCREEN_INFO
numres = screen_info_resources(si, res, ARRAY_SIZE(res));
- for (i = 0; i < numres; ++i) {
- if (!(res[i].flags & IORESOURCE_MEM))
- continue;
+ if (numres > 0) {
+ for (i = 0; i < numres; ++i) {
+ if (!(res[i].flags & IORESOURCE_MEM))
+ continue;
+
+ if (pci_find_resource(pdev, &res[i]))
+ return true;
+ }
- if (pci_find_resource(pdev, &res[i]))
- return true;
+ return false;
}
#endif
- return false;
+ /*
+ * No framebuffer was set up by the firmware/bootloader, so fall back
+ * to the default VGA device.
+ */
+ return pdev == vga_default_device();
}
EXPORT_SYMBOL(video_is_primary_device);
^ permalink raw reply related [flat|nested] 13+ messages in thread