Passing a Physical GPU to a MacOS Proxmox VM with PCI Passthrough
#Proxmox #GPU #MacOS
Full steps can be found at https://i12bretro.github.io/tutorials/0865.html
--------------------------------------------------------------------
Things You Will Need
--------------------------------------------------------------------
- A MacOS Proxmox VM https://www.youtube.com/@i12bretro/search?query=macos%20proxmox
- A supported GPU for the target version of Mac OS
Use the charts at https://dortania.github.io/OpenCore-Install-Guide/macos-limits.html#gpu-support to determine GPU support
--------------------------------------------------------------------
Enabling PCI Passthrough
--------------------------------------------------------------------
01. Log into Proxmox VE either via SSH or the web based shell
02. Run the following commands
# edit grub configuration to enable IOMMU
nano /etc/default/grub
03. Press CTRL+W and search for GRUB_CMDLINE_LINUX_DEFAULT=
04. Add the following value to GRUB_CMDLINE_LINUX_DEFAULT
a. If running an Intel CPU, intel_iommu=on
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
b. If running an AMD CPU, amd_iommu=on
GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on"
07. Press CTRL+O, Enter, CTRL+X to write the changes
08. Continue with the following commands
# update grub with config change
update-grub
# add vfio modules
nano /etc/modules
09. Add the following to the bottom of the file
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
10. Press CTRL+O, Enter, CTRL+X to write the changes
11. Continue with the following commands
# IOMMU interrupt mapping
echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" ≫ /etc/modprobe.d/iommu_unsafe_interrupts.conf
echo "options kvm ignore_msrs=1" ≫ /etc/modprobe.d/kvm.conf
# blacklist drivers
echo "blacklist radeon" ≫≫ /etc/modprobe.d/blacklist.conf
echo "blacklist nouveau" ≫≫ /etc/modprobe.d/blacklist.conf
echo "blacklist nvidia" ≫≫ /etc/modprobe.d/blacklist.conf
# list pci devices
lspci -v
12. Scroll through the output and find the GPU (usually a video and audio device associated with it) and make note of the device identifier (ex 01:00.0, 01:00.1)
13. Continue with the following commands
# output the vendor ID(s) of the devices
# replace the device identifier (01:00) as needed
lspci -n -s 01:00
14. Make note of the vendor ID(s) output in the format abcd:1234
15. Continue with the following commands
# replace the vendor ids from the output of the previous step as needed
echo "options vfio-pci ids=1002:679a,1002:aaa0 disable_vga=1" ≫ /etc/modprobe.d/vfio.conf
# update initramfs
update-initramfs -u
# reboot proxmox host
reboot now
16. After the system reboot, log back in and run the following command to verify the GPU is now using the vfio-pci driver
# replace the device identifier (01:00) as needed
lspci -knn -s 01:00
--------------------------------------------------------------------
Passing GPU to a MacOS VM
--------------------------------------------------------------------
01. Log into the Proxmox web UI
02. Expand the target node and select the target MacOS VM from the left navigation menu
03. Select Hardware from the left sub-navigation menu
04. Click Add ≫ PCI Device
05. Select the GPU from the listing
NOTE: I have found that there is some trial and error required to get the GPU to work properly depending on the guest operating system. If you find that the GPU isn't working with all options checked, stop the VM, and edit the PCI hardware, unchecking one option at a time to see if you can find a working combination
06. Select Display ≫ Set the dropdown to none (none) ≫ Click OK
07. If you intend to use the VM at the console (not via RDP or VNC), you will need to passthrough a USB keyboard and mouse by clicking Add ≫ USB Device ≫ Select the USB device(s) or port(s) to pass to the VM
08. Click Start at the top right of the page
09. Watch the output of the GPU on an external display
If there is no output from the GPU, stop the VM and adjust the PCI hardware options as noted above
Documentation: https://pve.proxmox.com/wiki/Pci_passthrough
### Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro