Jump to content

PCI passthrough to QEMU/KVM


5 posts in this topic

Recommended Posts

 

I'm trying to pass my RX 560 video card, my ethernet port, and one of the usb busses to a virtual machine, but so far I'm getting nothing on the monitor.  Everything worked fine before I tried to passthrough.

My computer is running ubuntu 18.04 as the host OS
The motherbord is a Gigabyte ga-x79-ud5, the CPU is an i7 3930k, there's 32GB of RAM, and I have 2 videocards, RX 560 and GT8600), which are each connected to an HDMI port on my 4K monitor (actually it's a Sony 4K TV)


My QEMU script is based on https://github.com/kholia/OSX-KVM/, but I also used a few other sources.

 

#!/bin/bash
qemu-system-x86_64 -enable-kvm -m 24576 -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check \
    -machine q35 \
    -smp 8,cores=4 \
     -vga none \
    -device vfio-pci,host=02:00.0,bus=pcie.0,multifunction=on \
    -device vfio-pci,host=02:00.1,bus=pcie.0 \
    -device e1000e,host=00:19.0,bus=pcie.0 \
    -device usb2,host=00:1d.0,bus=pcie.0 \
    -usb -device usb-kbd -device usb-tablet \
    -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" \
    -drive if=pflash,format=raw,readonly,file=OVMF_CODE.fd \
    -drive if=pflash,format=raw,file=OVMF_VARS.fd \
    -smbios type=2 \
    -device ich9-intel-hda -device hda-duplex \
    -device ich9-ahci,id=sata \
    -drive id=Clover,if=none,snapshot=on,format=qcow2,file=./'Mojave/CloverNG.qcow2' \
    -device ide-hd,bus=sata.2,drive=Clover \
    -drive id=Virtue,if=none,file=Virtue.img,format=raw \
    -device ide-hd,bus=sata.3,drive=Virtue \
    -netdev tap,id=net0,ifname=tap0,script=no,downscript=no  \
    -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \


I used the following commands to identify my devices
 


	 


~$ lspci -nn|grep -i vga
02:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Baffin [Radeon RX 460/560D / Pro 450/455/460/555/560] [1002:67ef] (rev e5)
03:00.0 VGA compatible controller [0300]: NVIDIA Corporation G84 [GeForce 8600 GT] [10de:0402] (rev a1)

$ lspci -nn|grep -i audio
00:1b.0 Audio device [0403]: Intel Corporation C600/X79 series chipset High Definition Audio Controller [8086:1d20] (rev 06)
02:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Device [1002:aae0]

$ lspci -nn|grep -i net
00:19.0 Ethernet controller [0200]: Intel Corporation 82579V Gigabit Network Connection [8086:1503] (rev 06)
08:00.0 Network controller [0280]: Qualcomm Atheros AR9485 Wireless Network Adapter [168c:0037] (rev 01)

$ lspci -nn|grep -i usb
00:1a.0 USB controller [0c03]: Intel Corporation C600/X79 series chipset USB2 Enhanced Host Controller #2 [8086:1d2d] (rev 06)
00:1d.0 USB controller [0c03]: Intel Corporation C600/X79 series chipset USB2 Enhanced Host Controller #1 [8086:1d26] (rev 06)
09:00.0 USB controller [0c03]: Fresco Logic FL1009 USB 3.0 Host Controller [1b73:1009] (rev 02)
0a:00.0 USB controller [0c03]: Fresco Logic FL1009 USB 3.0 Host Controller [1b73:1009] (rev 02)

And here are the files that I modified:

/etc/default/grub
 

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="iommu=pt intel_iommu=on video=efifb:off"
GRUB_CMDLINE_LINUX=""


/etc/initramfs-tools/modules

vfio_pci
vfio
vfio_iommu_type1
vfio_virqfd
vfio_pci ids=8086:1d26,002:67ff,1002:aae0 disable_vga=1

 

/etc/modprobe.d/blacklist-amd-amdgpu.conf

blacklist amdgpu modeset=0
options amdgpu modeset=0

I don't really know much about this stuff, so please give replies that a newbie like me can follow.
Any help would be appreciated.

Edited by Cwtf
fix typo in title
Link to comment
Share on other sites

  • 3 weeks later...

Unfortunately I don't think there are a lot of people using KVM on this forum, but I will be monitoring this thread in case you find a solution as I wish to use KVM on a laptop I'll purchase in the future (this is a method of getting around the lack of Optimus drivers).

 

Are you sure the card isn't exposed to the host OS? You have to reverse the IOKit tree to determine this for certain. You can use the ioreg command for this.

 

If it's not there, I suggest you try another forum like https://www.reddit.com/r/VFIO/ (you shouldn't have to mention it's or a hackintosh) to get help setting up pci passthrough.

Link to comment
Share on other sites

  • 1 month later...

Thanks,  

 

I've already seen that link though and it didn't really help me.  I think that my video card is too {censored}ed up to do passthrough.  From what I've read no one seems to have gotten pci passthrough working with an xfx rx 560 card.

 

Right now I'm working on getting a stable bare metal installation.   

Link to comment
Share on other sites

 Share

×
×
  • Create New...