1

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.

enter image description here

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.

enter image description here

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.

enter image description here

0

1 Answer 1

2

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.

4
  • Thanks for sharing the link to the quality detailed comments on GitHub, it seems impossible on macOS 12+, but I think it's doable on Big Sur, correct?
    – zinger
    Commented Jun 7, 2022 at 20:41
  • It’s technically possible in both but might require SIP to be turned off.
    – pmdj
    Commented Jun 7, 2022 at 21:00
  • I have SIP already turned off. Do you have a guide to follow on that?
    – zinger
    Commented Jun 7, 2022 at 21:12
  • The comments in that GitHub issue go into a lot of detail, and should be enough to set you on the right track if you’re proficient at systems/kernel programming. It’s probably aiming rather high if not.
    – pmdj
    Commented Jun 8, 2022 at 4:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .