mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hengyu Liang <hengyul@cs.unc.edu>
To: tzimmermann@suse.de
Cc: x86@kernel.org, bp@alien8.de, mario.limonciello@amd.com,
	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: Fri, 30 Oct 2026 05:24:21 -0400	[thread overview]
Message-ID: <20261030092422.300856-1-hengyul@cs.unc.edu> (raw)
In-Reply-To: <4379fd92-ac4f-45c2-9f4a-eaabe4b7f981@suse.de>

Hi Thomas,

On Fri, Oct 30, 2026 at 09:48:19AM +0100, Thomas Zimmermann wrote:
> Am 29.10.26 um 17:23 schrieb Hengyu Liang:
>> 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.
>
> If the BIOS booted in text mode or VGA graphics mode, the rsp device is
> still the primary display device. So the current matching code is not
> necessarily incorrect. (But also not necessarily correct either. :)

I agree that the device is still the primary display in text mode. The
patch gets that from the vga_default_device() fallback, since the legacy
ranges can't be matched against BARs.

>> 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;
>
> Further below in that code is a call to pci_find_resource(). [1]  Why
> does it match with vkms?  Vkms is not even on a PCI device.

It doesn't match vkms. As you say, vkms isn't a PCI device, so
video_is_primary_device() returns false for it at the dev_is_pci() check.

The problem is on the bochs side. In text mode, screen_info_resources()
returns the legacy VGA ranges, pci_find_resource() doesn't find them in
the BARs, and the function returns false there as well. So no device is
primary, and fbcon stays on the first registered framebuffer. In this
setup that is vkms (fb0), so the console is never remapped to bochs (fb1).

vkms only makes the console part visible. Without vkms, tty1 has the same
size with and without the patch, but boot_display is still missing without
it.

Thanks,
Hengyu

  reply	other threads:[~2026-10-30  9:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 16:23 Hengyu Liang
2026-10-29 19:52 ` Mario Limonciello
2026-10-30  5:33 ` Borislav Petkov
2026-10-30  8:48 ` Thomas Zimmermann
2026-10-30  9:24   ` Hengyu Liang [this message]
2026-10-30 10:15     ` Thomas Zimmermann
2026-10-30 18:31     ` Borislav Petkov

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=20261030092422.300856-1-hengyul@cs.unc.edu \
    --to=hengyul@cs.unc.edu \
    --cc=aaron.ma@canonical.com \
    --cc=bp@alien8.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --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

all inboxes | Powered by JetHome®