Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lilu] [QEMU] Lilu not patching when there's no display attached #2435

Closed
Myp3a opened this issue Oct 20, 2024 · 1 comment
Closed

[Lilu] [QEMU] Lilu not patching when there's no display attached #2435

Myp3a opened this issue Oct 20, 2024 · 1 comment

Comments

@Myp3a
Copy link

Myp3a commented Oct 20, 2024

Problem

Lilu doesn't work when there's no display attached to the VM. No patching appears in logs, GPU isn't initialized, system is stuck on 100% CPU after initial boot. Attaching a virtual display to the VM helps, patches start working, but system breaks because NootedRed requires no other displays.

iGPU passthrough is definitely possible, it booted a few times with old motherboard which died a couple of days later, so I was forced to change it. Now it reboots my whole system with additional display.

System boots fine without iGPU, installation is correct.

Expected result

Lilu patches the kexts, system boots, GPU is recognized and drives a display.

Current result

No patching is done.

Configuration

Hypervisor: QEMU 9.0.2 + KVM
CPU: Ryzen 5700G (emulated as Haswell-noTSX, 4 cores)
RAM: 8G (passed to VM)
GPU: Vega 8, 5700G's iGPU (vfio-pci driver, passthrough)
Host OS: Arch Linux (6.10.6-zen, ACS override patch)
Guest OS: Sonoma 14.6.1
OC: 1.0.1-DEBUG
Lilu: 1.6.9-DEBUG
OC directory: OC.zip

QEMU start command
#!/bin/bash

args=(
    # General options
    -nodefaults 
    -cpu Haswell-noTSX,vendor=GenuineIntel,+hypervisor,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check 
    # -smp 4,sockets=1,dies=1,cores=4,threads=1  # requires tsc=reliable kernel parameter
    -m 8G 
    -machine type=q35,smm=off,graphics=off,vmport=off,dump-guest-core=off,hpet=off,accel=kvm 
    -enable-kvm 
    -global kvm-pit.lost_tick_policy=discard 
    -name macos,process=macos,debug-threads=on 
    # PCI static mappings
    -device pcie-root-port,port=0,chassis=0,id=pci.0,bus=pcie.0,multifunction=on,addr=0x1
    -device pcie-root-port,port=4,chassis=5,id=pci.4,bus=pcie.0,addr=0x1.0x3
    -device pcie-pci-bridge,id=pci.9,bus=pci.4,addr=0x0
    # Bridged networking
    -netdev tap,fd=666,id=hostnet0
    -device vmxnet3,netdev=hostnet0,id=net0,mac=36:34:b3:9b:b0:d4,bus=pci.9,addr=0x1
    # Drives
    -device virtio-blk-pci,drive=InstallMedia,scsi=off,bus=pcie.0,addr=0x6 
    -drive file=/home/ivga/macos/system/base.dmg,id=InstallMedia,format=dmg,cache=unsafe,readonly=on,if=none 
    -drive file=/home/ivga/macos/system/data.img,id=data3,format=raw,cache=none,aio=native,discard=on,detect-zeroes=on,if=none 
    -device virtio-blk-pci,drive=data3,scsi=off,bus=pcie.0,addr=0xa,iothread=io2,bootindex=3 
    -object iothread,id=io2 
    -device virtio-blk-pci,drive=OpenCore,scsi=off,bus=pcie.0,addr=0x5,bootindex=9 
    -drive file=/home/ivga/macos/system/boot.img,id=OpenCore,format=raw,cache=unsafe,readonly=on,if=none 
    # MacOS specifics
    -smbios type=2 
    -rtc base=utc,base=localtime 
    -global ICH9-LPC.disable_s3=1 
    -global ICH9-LPC.disable_s4=1 
    -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off 
    -device isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal\(c\)AppleComputerInc 
    -drive if=pflash,format=raw,readonly=on,file=/home/ivga/macos/system/macos.rom 
    -drive if=pflash,format=raw,file=/home/ivga/macos/system/macos.vars 
    # Misc
    -object rng-random,id=objrng0,filename=/dev/urandom 
    -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c 
    -device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4
    # VFIO passthrough
    -device vfio-pci,host=30:00.0,bus=pci.0,multifunction=on,addr=0x0,romfile=/home/ivga/macos/system/igpu_vbios_msi.rom,x-vga=on  # iGPU
    -device vfio-pci,host=30:00.1,bus=pci.0,addr=0x0.0x1  # iGPU audio
    # Virtual display for boot log
    # -device pcie-root-port,port=11,chassis=4,id=pci.3,bus=pcie.0,addr=0x1.0x2
    # -device virtio-vga,id=video0,max_outputs=1,bus=pci.3,addr=0x0
    # -vnc 0.0.0.0:1,password=on
    # Remote control interface (for reset)
    -monitor telnet:127.0.0.1:4444,server,nowait
    # -serial telnet:127.0.0.1:4321,server,nowait
    -serial stdio
)

qemu-system-x86_64 "${args[@]}" 666<>/dev/tap"$(cat /sys/class/net/macvtap0/ifindex)"

Logs

Log with QEMU display attached: macos_boot_w_display.log
Log with no display attached: macos_boot_no_display.log

Related

ChefKissInc/NootedRed#291

@khronokernel
Copy link
Member

Duplicate of #1623.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants