Download raw body.
sys/amd64: fallback to VGA text mode on headless systems
On Sun, 08 Feb 2026 18:34:50 +0100,
Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>
> > Date: Fri, 06 Feb 2026 18:39:03 +0100
> > From: Kirill A. Korinsky <kirill@korins.ky>
> >
> > On Fri, 30 Jan 2026 23:20:55 +0100,
> > Kirill A. Korinsky <kirill@korins.ky> wrote:
> > >
> > > On Fri, 30 Jan 2026 23:05:37 +0100,
> > > Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> > > >
> > > > > Date: Fri, 30 Jan 2026 20:39:34 +0100
> > > > > From: Kirill A. Korinsky <kirill@korins.ky>
> > > > >
> > > > > On Tue, 27 Jan 2026 15:23:55 +0100,
> > > > > Kirill A. Korinsky <kirill@korins.ky> wrote:
> > > > > >
> > > > > > On Tue, 27 Jan 2026 13:18:50 +0100,
> > > > > > Crystal Kolipe <kolipe.c@exoticsilicon.com> wrote:
> > > > > > >
> > > > > > > On Tue, Jan 27, 2026 at 11:31:50AM +0000, Stuart Henderson wrote:
> > > > > > > > On 2026/01/27 12:05, Kirill A. Korinsky wrote:
> > > > > > > > > On Tue, 27 Jan 2026 10:21:02 +0100,
> > > > > > > > > Crystal Kolipe <kolipe.c@exoticsilicon.com> wrote:
> > > > > > > > > > Whilst it fixes your machine, how confident can we be that this is harmless on
> > > > > > > > > > others?
> > > > > > > > > >
> > > > > > > > > > It's perfectly valid to have no graphics hardware at all and run entirely from
> > > > > > > > > > a serial console, so this could plausibly break machines that are currently
> > > > > > > > > > working just fine.
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Well, here my assumption that on amd64, both the VGA legacy memory region
> > > > > > > > > and I/O ports is still reserved and not used.
> > > > > > > >
> > > > > > > > if my reading is correct then I think that is ok in this case (but I'm
> > > > > > > > not 100%) ..
> > > > > > > >
> > > > > > > > boot> machine mem
> > > > > > > > Region 0: type 1 at 0x0 for 639KB
> > > > > > > > Region 1: type 2 at 0x9fc00 for 1KB
> > > > > > > > Region 2: type 2 at 0xf0000 for 64KB
> > > > > > > > Region 3: type 1 at 0x100000 for 2078296KB
> > > > > > > > Region 4: type 2 at 0x7ee96000 for 17832KB
> > > > > > > > Region 5: type 2 at 0xf8000000 for 65536KB
> > > > > > > > Region 6: type 2 at 0xfec10000 for 4KB
> > > > > > > > Region 7: type 2 at 0xfed40000 for 20KB
> > > > > > > > Low ram: 639KB High ram: 2078296KB
> > > > > > > > Total free memory: 2078935KB
> > > > > > >
> > > > > > > The VGA memory space is certainly marked as reserved.
> > > > > > >
> > > > > > > But 'reserved' doesn't mean that writing arbitrary values to those addresses
> > > > > > > is harmless.
> > > > > > >
> > > > > >
> > > > > > But for compatiblity it should stay reserved for VGA, and to reuse it for
> > > > > > something else BIOS should have two code paths: when VGA is avaialbel and
> > > > > > when it isn't.
> > > > > >
> > > > > > This is quite small region and introduce two code path seems strange.
> > > > > >
> > > > > > But, again, here many assumptions.
> > > > > >
> > > > >
> > > > > Here the second attempt. This time it is looks safer.
> > > > >
> > > > > Idea to scan PCI bus to find some VGA adapter and use it as primamary.
> > > > >
> > > > > More or less similar with Loongson's approach.
> > > > >
> > > > > It allows to boot this machine without serial and amdgpu and dmesg has:
> > > > >
> > > > > ~ $ grep vga /var/run/dmesg.boot
> > > > > vga1 at pci13 dev 0 function 0 "ATI Raphael" rev 0xc9
> > > > > wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
> > > > > ~ $
> > > > >
> > > > > which is expected.
> > > > >
> > > > > Thoughts? Tests? OKs?
> > > >
> > > > What about my suggestion to have a dummy framebuffer?
> > > >
> > >
> > > I had tried, but I wasn't able make something that works.
> > >
> > > Or better to say all my attemt leads to that machine still hungs.
> > >
> > > Here hard part: this is remote machine, I haven't got access to serial
> > > console on it, I can only boot it, or boot in "rescue mode" (Linux) or as
> > > to attach KVM.
> > >
> > > ... and without the way to debug I can't figure out why and where it hangs.
> > >
> >
> > Shall I drop this diff ?
>
> Does the diff below work for you?
>
Nope, machine never boots.
>
>
> Index: arch/amd64/amd64/efifb.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/efifb.c,v
> diff -u -p -r1.34 efifb.c
> --- arch/amd64/amd64/efifb.c 15 Jul 2022 17:57:25 -0000 1.34
> +++ arch/amd64/amd64/efifb.c 8 Feb 2026 17:33:13 -0000
> @@ -578,6 +578,33 @@ cb_find_fb(paddr_t addr)
> return NULL;
> }
>
> +int
> +efifb_dummy_cnattach(void)
> +{
> + const int width = 1024;
> + const int height = 768;
> + struct pglist mlist;
> + int error;
> +
> + memset(&efifb_console, 0, sizeof(efifb_console));
> + efifb_console.cb_table_fb.x_resolution = width;
> + efifb_console.cb_table_fb.y_resolution = height;
> +
> + TAILQ_INIT(&mlist);
> + error = uvm_pglistalloc(width * height, 0, -1, PAGE_SIZE, 0,
> + &mlist, 1, UVM_PLA_WAITOK);
> + if (error)
> + return (-1);
> +
> + efifb_console.paddr = VM_PAGE_TO_PHYS(TAILQ_FIRST(&mlist));
> + efifb_console.depth = 8;
> + efifb_console.psize = width * height;
> +
> + efifb_cnattach_common();
> +
> + return (0);
> +}
> +
> psize_t
> efifb_stolen(void)
> {
> Index: arch/amd64/amd64/wscons_machdep.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/wscons_machdep.c,v
> diff -u -p -r1.14 wscons_machdep.c
> --- arch/amd64/amd64/wscons_machdep.c 14 Oct 2017 04:44:43 -0000 1.14
> +++ arch/amd64/amd64/wscons_machdep.c 8 Feb 2026 17:33:13 -0000
> @@ -152,6 +152,10 @@ wscn_video_init(void)
> if (pcdisplay_cnattach(X86_BUS_SPACE_IO, X86_BUS_SPACE_MEM) == 0)
> return (0);
> #endif
> +#if (NEFIFB > 0)
> + if (efifb_dummy_cnattach() == 0)
> + return (0);
> +#endif
> return (-1);
> }
>
> Index: arch/amd64/include/efifbvar.h
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/include/efifbvar.h,v
> diff -u -p -r1.10 efifbvar.h
> --- arch/amd64/include/efifbvar.h 4 May 2019 11:34:47 -0000 1.10
> +++ arch/amd64/include/efifbvar.h 8 Feb 2026 17:33:13 -0000
> @@ -34,6 +34,7 @@ void efifb_reattach(void);
>
> int efifb_cb_found(void);
> int efifb_cb_cnattach(void);
> +int efifb_dummy_cnattach(void);
>
> psize_t efifb_stolen(void);
>
--
wbr, Kirill
sys/amd64: fallback to VGA text mode on headless systems