Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Mario Limonciello <superm1@kernel.org>
To: Hengyu Liang <hengyul@cs.unc.edu>, x86@kernel.org
Cc: tzimmermann@suse.de, aaron.ma@canonical.com,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] x86/video: Preserve the default VGA fallback for legacy modes
Date: Thu, 29 Oct 2026 14:52:12 -0500	[thread overview]
Message-ID: <2c8b54e9-e4a9-4394-bec5-308adad5daff@kernel.org> (raw)
In-Reply-To: <20261029162311.3389523-1-hengyul@cs.unc.edu>



On 10/29/26 11:23, Hengyu Liang wrote:
> Commit 596b3678326d ("x86/video: Only fall back to vga_default_device()
> without screen info") made video_is_primary_device() rely exclusively
> on screen_info resources whenever any are available.
> 
> However, screen_info_resources() also returns legacy I/O and memory
> ranges for VGA text modes. These ranges are not PCI BARs, so the resource
> lookup fails and the default VGA fallback is skipped.
> 
> On a SeaBIOS QEMU guest with bochs and VKMS, the boot VGA loses its DRM
> boot_display attribute and fbcon leaves the console on VKMS. This can
> be checked with:
> 
>      cat /sys/class/drm/card1/boot_display
>      stty -F /dev/tty1 size
> 
> Without the fix, boot_display is missing and tty1 is 48 rows by 128
> columns. With it, boot_display contains 1 and tty1 is 50 rows by 160
> columns.
> 
> Use resource-based selection only for linear framebuffers. Fall back to
> vga_default_device() for legacy display modes, while keeping EFI and
> VESA framebuffer ownership authoritative.
> 
> Fixes: 596b3678326d ("x86/video: Only fall back to vga_default_device() without screen info")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hengyu Liang <hengyul@cs.unc.edu>
> ---
> Tested in QEMU/KVM with identical KASAN configs: SeaBIOS VGA text mode
> (with and without VKMS), VESA, and OVMF with one and two virtual GPUs.
> All 26 guest-only helper checks pass, including EFI/VESA framebuffer
> ownership, missing framebuffer resources, and addresses above 4 GiB.
> Also build-tested x86-32 with/without CONFIG_SCREEN_INFO, and x86-64
> without CONFIG_SCREEN_INFO.
> 
>   arch/x86/video/video-common.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/video/video-common.c b/arch/x86/video/video-common.c
> index 8ed82fff7638..b8f83346dfe8 100644
> --- a/arch/x86/video/video-common.c
> +++ b/arch/x86/video/video-common.c
> @@ -45,7 +45,7 @@ bool video_is_primary_device(struct device *dev)
>   
>   #ifdef CONFIG_SCREEN_INFO
>   	numres = screen_info_resources(si, res, ARRAY_SIZE(res));
> -	if (numres > 0) {
> +	if (numres > 0 && __screen_info_has_lfb(screen_info_video_type(si))) {
>   		for (i = 0; i < numres; ++i) {
>   			if (!(res[i].flags & IORESOURCE_MEM))
>   				continue;
> 
> base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>


  parent reply	other threads:[~2026-10-29 19:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 16:23 [PATCH] x86/video: Preserve the default VGA fallback for legacy modes Hengyu Liang
2026-10-29 16:29 ` sashiko-bot
2026-10-29 19:52 ` Mario Limonciello [this message]
2026-10-30  5:33 ` Borislav Petkov
2026-10-30  8:48 ` Thomas Zimmermann
2026-10-30  9:24   ` Hengyu Liang
2026-10-30 10:15     ` Thomas Zimmermann

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=2c8b54e9-e4a9-4394-bec5-308adad5daff@kernel.org \
    --to=superm1@kernel.org \
    --cc=aaron.ma@canonical.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hengyul@cs.unc.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    --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