Full Ryzen GPU Passthrough Guide + Triple Boot macOS Linux Windows

Update System and Install Software

~$ sudo dnf update && sudo dnf install @Virtualization snapd && snap install spotify && reboot

Installing Spotify gives an easy way to “fix” audio later.


/etc/default/grub (If passing though primary GPU)

GRUB_CMDLINE_LINUX=“iommu=1 amd_iommu=on rd.driver.pre=vfio-pci video=efifb:off”

/etc/default/grub (If NOT passing though primary GPU)

GRUB_CMDLINE_LINUX=“iommu=1 amd_iommu=on rd.driver.pre=vfio-pci”


/etc/modprobe.d/kvm.conf (Require? for Windows 10 1803)

options kvm ignore_msrs=1


/etc/modprobe.d/vfio.conf

options vfio-pci ids=[manufactureID:gpuID],[manufactureID,audioID]

You can find these values with lspci -nn


/etc/dracut.conf.d/vfio.conf

add_drivers+=“vfio vfio_iommu_type1 vfio_pci vfio_virqfd”


If you’re passing though the primary GPU and you want to use a secondary GPU for Fedora Host
/etc/X11/xorg.conf.d/secondary-gpu-driver

Section “Device”
Identifier “[GPUname]”
Driver “[DriverName]”
EndSection

You can find these values with ~$ lspci -k


/etc/selinux/config (For convenience sake)

SELINUX=enforcing -> SELINUX=disabled


Applying all modifcation

~$ su -c “grub2-mkconfig > /etc/grub2-efi.cfg”
~$ sudo dracut -f --kver $(uname -r) && reboot


If there’s no output on the passed through GPU and Fedora on the other GPU, then this is all successful. Now for configuring the Virtual Machines.



For this, you’ll need You’ll need an ISO for Windows 10, macOS, and Linux. You can download the Windows Media Creation tool Here, and you can use This Post and loop devices to create a macOS iso from scratch if you don’t otherwise have access to macOS. You’ll also need a copy of OSX-KVM


Configuring VM
Run Virt-Manager and create a VM. You don’t want to install any OS right now and you’ll need UEFI. NIC must be set to ‘Specify Shared Device Name’, Bridge Name ‘virbr0’, Device Model ‘e1000-82545em’ Once the VM is created and configured, open terminal

~$ sudo virsh define /etc/libvirt/qemu/vm.xml
~$ sudo virsh edit vm

For extra configuration

<domain type=‘kvm’ xmlns:qemu=‘http://libvirt.org/schemas/domain/qemu/1.0’>

CPU configuration/pinning


</currentMemory>
<vcpu placement=‘static’>[TotalThreads]</vcpu>
<iothreads>[TotalCores]</iothreads>
<cputune>
<vcpupin vcpu=‘0’ cpuset=‘0’/>
<vcpupin vcpu=‘1’ cpuset=‘1’/>
<vcpupin vcpu=‘2’ cpuset=‘2’/>
<vcpupin vcpu=‘3’ cpuset=‘3’/>
<…/>
<iothreadpin iothread=‘1’ cpuset=‘0-1’/>
<iothreadpin iothread=‘2’ cpuset=‘2-3’/>
<…/>
</cputune>

Special files for macOS (From OSX-KVM)


<os>
<type arch=‘x86_64’ machine=‘pc-q35-2.11’>hvm</type>
<loader readonly=‘yes’ type=‘pflash’>/path/to/OVMF_CODE.fd</loader>
<nvram>/path/to/OVMF_VARS-1024x768.fd</nvram>
</os>

For nVidia Cards?


</hyperv>
<kvm>
<hidden state=‘on’/>
</kvm>

CPU configuration/topology


</features>
<cpu mode=‘host-passthrough’>
<topology sockets=‘1’ cores=’[Physcial Cores]’ threads=’[Threads]’/>
</cpu>


Audio Configuration


<qemu:commandline>
<qemu:env name=‘QEMU_AUDIO_DRV’ value=‘pa’/>
<qemu:env name=‘QEMU_PA_SAMPLES’ value=‘1024’/>
<qemu:env name=‘QEMU_AUDIO_TIMER_PERIOD’ value=‘200’/>
<qemu:env name=‘QEMU_PA_SERVER’ value=’/run/user/1000/pulse/native’/>
</qemu:commandline>
</domain>


Installing OSes (Mojave might work, idk, I haven’t tested)
Obtain a High Sierra img file (Which I did using This Guide and loop devices, and convert it to a qcow2

~$ qemu-img convert -f raw -O qcow2 HighSierra.img HighSierra.qcow2

Open the Virtual Machine and add your Linux iso of choice boot without installing. Open Gparted, make new GUID Partition Table, and create an EFI partition and a partition for each OS you wish to install. Apply changes and install linux on desire partition.

Once installation is finished and verified working, shutdown and repeat with Windows 10.

Again, once installation is finished and verified working, shutdown and open terminal.

~$ sudo virsh edit vm


<qemu:commandline>
<qemu:arg value=’-device’/>
<qemu:arg value=‘isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal©AppleComputerInc’/>
<qemu:arg value=’-smbios’/>
<qemu:arg value=‘type=2’/>
<qemu:arg value=’-cpu’/>
<qemu:arg value=‘Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check’/>
<…/>
</qemu:commandline>
</domain>

Remove all iso files from VM, add Clover.qcow2 from OSX-KVM, your HighSierra.qcow2 you created earlier, and adjust boot order to boot Clover.qcow2 first.

Very little Clover configuration is needed, if any, so go ahead and boot into the installer and install macOS. Once finished, reboot back into clover and boot into your macOS installation. Download Clover configurator and mount EFI partition. Copy EFI folder to your EFI partition, and Library and Usr folders to the root of macOS.

Shutdown, remove all extra drives and boot into every OS to verify everthing is still working. You may need to add a boot option in the UEFI to boot clover. After that, Enjoy!

REMEBER TO INDENT ALL XML TAGS ACCORDINGLY
Also, it is possible to passthrough multiple GPUs to a VM and enable Crossfire. I haven’t, nor able to test SLI.

1 Like

I’m planning on doing this once the new threadrippers drop the price of this current gens. I plan to follow your guide. Any issues two months later?

The only issues I’ve come across is with macOS Mojave (or macOS in general) not liking odd CPU Topologies (Like 5 core 10 thread) or Clover incompatibilities. Other than that, Windows & Linux work just fine 2 months later.

Wendell told me the Adobe Creative Suite should work just fine in a macOS VM. Maybe that could be worth testing?