SerenityOS / serenity

The Serenity Operating System 🐞
https://serenityos.org
BSD 2-Clause "Simplified" License
30.38k stars 3.18k forks source link

Booting with QEMU 6.0 on Windows results in a black screen #7523

Open stelar7 opened 3 years ago

stelar7 commented 3 years ago

QEMU emulator version 6.0.0 (v6.0.0-11869-g800a25ea45-dirty)

Console output:

WHPX: setting APIC emulation mode in the hypervisor
Windows Hypervisor Platform accelerator is operational
qemu-system-i386.exe: warning: '-soundhw pcspk' is deprecated, please set a backend using '-machine pcspk-audiodev=<name>' instead
whpx: injection failed, MSI (0, 0) delivery: 0, dest_mode: 0, trigger mode: 0, vector: 0, lost (c0350005)
[Kernel]: CPU[0]: Supported features: nx pae pge rdrand rdseed smap smep sse tsc rdtscp constant_tsc sep syscall mmx sse2 sse3 ssse3 sse4.1 sse4.2 xsave avx
[Kernel]: CPU[0]: Physical address bit width: 39
[#0 Kernel]: Initializing unhandled interrupt handlers
[Kernel]: Kernel Commandline: Kernel/Kernel disable_virtio
[Kernel]: MM: boot_pdpt @ P0x0010a000
[Kernel]: MM: boot_pd0 @ P0x0010b000
[Kernel]: MM: boot_pd3 @ P0x0010c000
[Kernel]: MM: Low memory range @ P0x00000000 - P0x00100000
[Kernel]: MM: Kernel range @ P0x00100000 - P0x0103b000
[Kernel]: MM: Multiboot mmap: address=0x00000000, length=654336, type=1
[Kernel]: MM: Got an unaligned physical_region from the bootloader; correcting length 654336 by 3072 bytes
[Kernel]: MM: Multiboot mmap: address=0x0009fc00, length=1024, type=2
[Kernel]: MM: Multiboot mmap: address=0x000f0000, length=65536, type=2
[Kernel]: MM: Multiboot mmap: address=0x00100000, length=535691264, type=1
[Kernel]: MM: Multiboot mmap: address=0x1ffe0000, length=131072, type=2
[Kernel]: MM: Multiboot mmap: address=0xfffc0000, length=262144, type=2
[Kernel]: MM: Super physical region: P0x00f3b000 - P0x0103b000
[Kernel]: MM: User physical region: P0x0103c000 - P0x1ffe0000
[Kernel]: MM: Contiguous reserved range from P0x0009fc00, length is 394240
[Kernel]: MM: Contiguous reserved range from P0x1ffe0000, length is 3758227456
[#0 Kernel]: Early access to ACPI tables for interrupt setup
[Kernel]: Interrupts: Switch to Legacy PIC mode
[Kernel]: PIC: Cascading mode, vectors 0x50-0x5f
[#0 Kernel]: Trying to unregister unused handler (?)
[#0 Kernel]: Trying to unregister unused handler (?)
[#0 Kernel]: Interrupts: Detected Dual i8259
[Kernel]: ACPI: Using RSDP @ P0x000f5850
[Kernel]: ACPI: Main Description Table valid? true
[Kernel]: ACPI: Using RSDT, enumerating tables @ P0x1ffe3898
[Kernel]: ACPI: RSDT revision 1, total length: 52
[Kernel]: ACPI: Initializing Fixed ACPI data
[Kernel]: ACPI: Searching for the Fixed ACPI Data Table
[Kernel]: ACPI: Fixed ACPI data, Revision 1, length: 116 bytes
[Kernel]: ACPI: DSDT P0x1ffe0040
[Kernel]: ACPI: Dynamic Parsing Enabled, Can parse AML
[Kernel]: PCI: Using I/O instructions for PCI configuration space access
[Kernel]: PCI [0000:00:00:00] PCI::ID [8086:1237]
[Kernel]: PCI [0000:00:01:00] PCI::ID [8086:7000]
[Kernel]: PCI [0000:00:01:01] PCI::ID [8086:7010]
[Kernel]: PCI [0000:00:01:02] PCI::ID [8086:7020]
[Kernel]: PCI [0000:00:01:03] PCI::ID [8086:7113]
[Kernel]: PCI [0000:00:02:00] PCI::ID [1234:1111]
[Kernel]: PCI [0000:00:03:00] PCI::ID [1af4:1003]
[Kernel]: PCI [0000:00:04:00] PCI::ID [1af4:1005]
[Kernel]: PCI [0000:00:05:00] PCI::ID [1b36:0001]
[Kernel]: PCI [0000:01:00:00] PCI::ID [1000:0060]
[Kernel]: PCI [0000:01:01:00] PCI::ID [8086:244e]
[Kernel]: PCI [0000:02:00:00] PCI::ID [1b36:0007]
[Kernel]: PCI [0000:00:06:00] PCI::ID [8086:244e]
[Kernel]: PCI [0000:03:00:00] PCI::ID [1b36:0007]
[Kernel]: PCI [0000:03:01:00] PCI::ID [8086:2922]
[Kernel]: PCI [0000:00:07:00] PCI::ID [8086:100e]
[Kernel]: Starting SerenityOS...
[Kernel]: RTC: Year: 2021, month: 5, day: 28, hour: 14, minute: 35, second: 12
[Kernel]: HPET @ P0x1ffe3838
[Kernel]: HPET: Minimum clock tick - 0
[Kernel]: HPET: Timers count - 3
[Kernel]: HPET: Main counter size: 64-bit
[Kernel]: HPET: Timer[0] comparator size: 64-bit, mode: 64-bit
[Kernel]: HPET: Timer[1] comparator size: 64-bit, mode: 64-bit
[Kernel]: HPET: Timer[2] comparator size: 64-bit, mode: 64-bit
[Kernel]: HPET: frequency 100000000 Hz (100 MHz) resolution: 10 ns
[#0 Kernel]: Trying to unregister unused handler (?)
[#0 Kernel]: Trying to unregister unused handler (?)
[#0 Kernel]: HPET: Setting appropriate functions to timers.
[#0 Kernel]: Time: Scanning for periodic timers
[#0 Kernel]: Time: Scanning for non-periodic timers
[Kernel]: KernelRng: Using RDSEED or RDRAND as entropy source
[#0 Kernel]: I8042: Dual channel controller
[Kernel]: PS2MouseDevice: Mouse wheel enabled!
[Kernel]: PS2MouseDevice: 5 buttons enabled!
[#0 Kernel]: Trying to unregister unused handler (?)
[#0 Kernel]: Trying to unregister unused handler (?)
[#0 Kernel]: Framebuffer Console: taking 3145728 bytes
[#0 Kernel]: BochsGraphicsAdapter: resolution set to 1024x768
[#0 Kernel]: Framebuffer Console: taking 3145728 bytes
[#0 Kernel]: Graphics adapter @ PCI [0000:00:02:00] is operating in VGA mode
[#0 Kernel]: Framebuffer 0: address=P0xf8000000, pitch=4096, width=1024, height=768
[#0 Kernel]: VC 0: Resized to 128 x 96
[#0 Kernel]: VC 1: Resized to 128 x 96
[#0 Kernel]: VC 2: Resized to 128 x 96
[#0 Kernel]: VC 3: Resized to 128 x 96
[#0 colonel(0:0)]: Scheduler[0]: idle loop running
kleinesfilmroellchen commented 3 years ago

Seems to be a duplicate of #6422

stelar7 commented 3 years ago

Almost, according to the OP of that issue The QEMU window appears but is reported as not responding almost immediately by Windows and needs to be force closed. That is not the case here, QEMU works fine, but the screen is black and no more log output is printed

And the disable_virtio (that seemed to be the solution in that issue) is already set

stelar7 commented 3 years ago

A temporary (?) fix: Change export SERENITY_EXTRA_QEMU_ARGS="-accel whpx" to export SERENITY_EXTRA_QEMU_ARGS="-accel whpx,kernel-irqchip=off"

kleinesfilmroellchen commented 3 years ago

That workaround may be good to document in the WSL instructions, maybe make a small PR?

1player commented 3 years ago

Weird, FWIW I'm on qemu 6.0.0 (20210505) and the current WSL instructions are working correctly for me, I don't require kernel-irqchip=off.

In fact, my issue is that -accel whpx makes the whole process slow to a crawl immediately after the framebuffer initialisation, and no one else seems to have reported anything of the sort. I will open a separate bug report for that one.

AtkinsSJ commented 3 years ago

I had the same black-screen issue, and the "kernel-irqchip=off" change solved it for me. So thanks, @stelar7!

I think the key message in the log is whpx: injection failed, MSI (0, 0) delivery: 0, dest_mode: 0, trigger mode: 0, vector: 0, lost (c0350005) - so worth mentioning that if this does get added to the docs.

voltagex commented 3 years ago

Upstream qemu bug: https://gitlab.com/qemu-project/qemu/-/issues/346

Manfred73 commented 1 month ago

I'm also experiencing the same issues booting my image with -accel whpx (whpx: injection failed), so I changed it to -accel whpx,kernel-irqchip=off, which seems to work.

This is on Windows 11, with QEMU emulator version 9.0.50 (v9.0.0-14417-ga1d2d66911-dirty).

Hardware virtualization is enabled in the BIOS and Windows Hypervisor Platform is also enabled. I have tried with Hyper-V and Virtual Machine platform both on and off, but only using -accel whpx without the kernal-irqchip=off option, will fail.

This is the batch file I use on Windows, to start the image (Ubuntu already installed on it):

@echo off

start "" /B ^
  qemu ^
    -name "ubuntu_24_04_openshift" ^
    -m 12288 ^
    -smp 6 ^
    -hda %QEMU_VMS%\ubuntu_24_04_openshift.img ^
    -accel whpx,kernel-irqchip=off ^
    -net nic ^
    -net user ^
    -vga virtio ^
    -usb ^
    -device usb-tablet ^
    -display sdl ^
    -drive file=%QEMU_VMS%\ubuntu_24_04_openshift.img,format=qcow2,cache=writeback

However, when I try to creat the image the first time, I need to boot from cd-rom to start the installation process. In this case, - accel whpx,kernel-irqchip=off` doesn't work and I need to leave out the accelaration altogether:

This is the batch file I use on Windows, to boot the iso image to start the installation:

@echo off

start "" /B ^
  qemu ^
    -name "ubuntu_24_04_openshift" ^
    -m 12288 ^
    -smp 6 ^
    -cdrom %QEMU_VMS%\ubuntu-24.04-desktop-amd64.iso ^
    -boot d ^
    -hda %QEMU_VMS%\ubuntu_24_04_openshift.img ^
    -net nic ^
    -net user ^
    -vga virtio ^
    -usb ^
    -device usb-tablet ^
    -display sdl ^
    -drive file=%QEMU_VMS%\ubuntu_24_04_openshift.img,format=qcow2,cache=writeback

I'm not sure why I can't use -accel whpx,kernel-irqchip=off when booting from cd-rom to start the installation. On boot it shows errors it can't find any boot devices (cd-rom, hdd).

I have also played around with different -cpu setting, using -cpu max throws another error. Choosing other cpus doesn't really make a difference. My processor is an AMD Ryzen 9 3950X 16-Core Processor.