I have a PC with a powerful Nvidia GPU that is used for mining only through a simple Windows application. For my love in Hackintosh, I installed a new SATA drive and installed macOS Monterey 12.4 and it's now running smoothly through the integrated GPU (Intel UHD Graphics 630). Since Nvidia is not compatible with Monterey, and since I use Windows for running the mining app only, I thought to use QEMU to create a Windows VM with the original hard drive and passthrough Nvidia GPU. That however never worked, as there's no kexts/drivers loaded for Nvidia. I don't know the command for passthrough PCIe device.
Here's how the boot-windows.sh
file looks like:
DISK="/dev/disk1"
OVMFDIR="usr/share/edk2/ovmf" #for enabling secure EFI boot
diskutil umountDisk "$DISK" #to make sure it's forcibly unmounted
MY_OPTIONS=" ssse3, sse4.2, popcnt, avx, aes, xsave, xsaveopt,check"
ALLOCATED_RAM="8G" #GB
args=(
-m "$ALLOCATED_RAM"
-vga virtio
-display cocoa
-usb
-device usb-tablet
-smp 4,cores=4,sockets=2
-drive if=ide,index=2,file="$DISK",format=raw
-machine type=q35
-accel hvf
#-drive file=/Volumes/OSes/win/21H1.iso,media=cdrom,index=0
#-drive file=virtio-win-0.1.208.iso,media=cdrom
-nic user,model=virtio
-rtc base=localtime,clock=host
-cpu Nehalem,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time
-device intel-hda
-drive if=pflash,format=raw,readonly=on,file="$OVMFDIR"/OVMF_CODE.fd
-drive if=pflash,format=raw,readonly=on,file="$OVMFDIR"/OVMF_VARS.fd
-boot c
)
qemu-system-x86_64 "${args[@]}"
From the System Information I can use the VendorID
and ProductID
to passthrough any USB device, which I used with the WiFi adapter.
using the below command in the args
-device usb-host,vendorid=0x2357,productid=0x0109
Since the Nvidia GPU is a PCIe (not USB), and since it has no kexts loaded, so there's no ProductID
identified for it, I can't use the same usb-host
arg.
My question is how to passthrough the PCIe GPU to Windows guest?
This is how the final setup looks like with Windows 11 guest running on the virtio
standard vga.
CodePudding user response:
This is currently not possible, macOS does not have a direct equivalent to Linux's vfio
kernel driver and user space API, which Qemu consumes to make PCI(e) passthrough work on Linux.
It would be possible to implement this functionality as a kext, but Apple is gradually phasing out kexts in recent macOS versions.