Leoyzen / KVM-Opencore

Opencore Configuration of KVM Hackintosh with tweaks
GNU General Public License v3.0
450 stars 160 forks source link

X64 exception before boot menu with CPU host on Ryzen/QEMU/WSL2 #13

Closed steeve closed 4 years ago

steeve commented 4 years ago

First opened as https://github.com/acidanthera/bugtracker/issues/1105, but was told here might be better.

When using host CPU passthrough with QEMU, I get a X64 exception before the boot menu. When using Penryn, I can get to the boot menu.

Please find the EFI rootfs attached: rootfs.zip

Configuration:

QEMU command line:

qemu-system-x86_64 \
        -cpu host,kvm=on,vmware-cpuid-freq=on,rdtscp,check,+invtsc,+hypervisor \
        -serial stdio \
        "-accel" "kvm" \
        "-machine" "pc-q35-2.11" \
        "-m" 4096 \
        "-smp" "cpus=4" \
        "-usb" \
        "-device" "usb-kbd" \
        "-device" "usb-tablet" \
        -smbios type=2 \
        -drive if=pflash,format=raw,readonly,file=./OVMF/OVMF_CODE.fd \
        -drive if=pflash,format=raw,file=./OVMF/OVMF_VARS.fd \
        "-device" "ide-hd,bus=ide.1,drive=bootloader" \
        "-drive" "id=bootloader,if=none,format=raw,file=./opencore.img"

Note that QEMU complains that Ryzen doesn't support invtsc but adding/removing it doesn't change anything.

BS: Starting OpenCore...
BS: Booter path - \EFI\BOOT\BOOTX64.EFI
OCFS: Trying to locate filesystem on 7ED04898 7ECE5E98
OCFS: Filesystem DP is \EFI\BOOT\BOOTX64.EFI
BS: Trying to start loaded OpenCore image...
BS: Failed to locate bootstrap protocol - Not Found
BS: Trying to load OpenCore image...
BS: Read OpenCore image of 626432 bytes
BS: Loaded OpenCore image at 7ECE4C18 handle
OC: Starting OpenCore...
OC: Booter path - <nil>
OC: Booted from bootstrap
OC: ReRun executed!
OCST: Missing vault data, ignoring...
OC: OcMiscEarlyInit...
OC: Loaded configuration of 39375 bytes
OC: Watchdog status is 0
!!!! X64 Exception Type - 0D(#GP - General Protection)  CPU Apic ID - 00000000 !!!!
ExceptionData - 0000000000000000
RIP  - 000000007DE52D75, CS  - 0000000000000038, RFLAGS - 0000000000010246
RAX  - 0000000000000008, RCX - 00000000C0010064, RDX - 000000007DEDE9D8
RBX  - 0000000000000000, RSP - 000000007FEE3910, RBP - 000000007FEE3910
RSI  - 000000007FEE39D8, RDI - 0000000000000000
R8   - 0000000000000007, R9  - 000000007FEE39D8, R10 - 00000000000005F2
R11  - 0000000000000001, R12 - 000000007DEDEAA0, R13 - 000000007DEDE9D8
R14  - 0000000000000000, R15 - 000000007DEDEA2C
DS   - 0000000000000030, ES  - 0000000000000030, FS  - 0000000000000030
GS   - 0000000000000030, SS  - 0000000000000030
CR0  - 0000000080010033, CR2 - 0000000000000000, CR3 - 000000007FC01000
CR4  - 0000000000000668, CR8 - 0000000000000000
DR0  - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000
DR3  - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400
GDTR - 000000007FBEE698 0000000000000047, LDTR - 0000000000000000
IDTR - 000000007F2A2018 0000000000000FFF,   TR - 0000000000000000
FXSAVE_STATE - 000000007FEE3570
!!!! Find image based on IP(0x7DE52D75) /Users/travis/build/acidanthera/OpenCorePkg/UDK/Build/OpenCorePkg/DEBUG_XCODE5/X64/OpenCorePkg/Platform/OpenCore/OpenCore/DEBUG/OpenCore.dll (ImageBase=000000007DE48000, EntryPoint=000000007DEA44C9) !!!!

Thank you

steeve commented 4 years ago

Fixed, the reason was because of a missing TSC clock source in WSL2's kernel. See https://twitter.com/steeve/status/1297307707779801089?s=20