mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Mario Limonciello <mario.limonciello@amd.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>
Cc: "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>,
	"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<linux-kernel@vger.kernel.org>,
	"open list:PCI SUBSYSTEM" <linux-pci@vger.kernel.org>,
	Aaron Ma <aaron.ma@canonical.com>
Subject: Re: [PATCH v2] x86/video: Only fall back to vga_default_device() without screen info
Date: Wed, 24 Jun 2026 08:08:51 +0200	[thread overview]
Message-ID: <fe290312-90a9-4c5b-bbd9-5d385de0818a@suse.de> (raw)
In-Reply-To: <20260623141505.1816786-1-mario.limonciello@amd.com>

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)



  reply	other threads:[~2026-06-24  6:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23 14:15 Mario Limonciello
2026-06-24  6:08 ` Thomas Zimmermann [this message]
2026-06-24  6:09 ` Thomas Zimmermann
2026-06-24  8:45 ` Aaron Ma
2026-06-25 22:58   ` Mario Limonciello
2026-07-06 17:47     ` Mario Limonciello
2026-07-07  3:56       ` Borislav Petkov
2026-07-07  4:02         ` Mario Limonciello
2026-07-07  4:18           ` Borislav Petkov
2026-07-07  4:47             ` Mario Limonciello
2026-07-07  5:01               ` Borislav Petkov
2026-07-07 12:52                 ` Mario Limonciello
2026-07-07 15:23 ` [tip: x86/urgent] " tip-bot2 for Mario Limonciello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe290312-90a9-4c5b-bbd9-5d385de0818a@suse.de \
    --to=tzimmermann@suse.de \
    --cc=aaron.ma@canonical.com \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=mingo@redhat.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®