Quantcast
Channel: Ubuntu Forums - Virtualisation
Viewing all articles
Browse latest Browse all 4211

So close to GPU Passthrough!

$
0
0
Hey guys! I was hoping someone could help me through this last little bit of this project I was working on. I've been trying to dedicate a pair of GTX 960's to a Windows virtual machine for the occasional gaming. I've moved to Ubuntu full time, and I very much enjoy linux. I don't want to maintain an entire windows installation and dual boot just to play a particular game every once and awhile.

I've been going at it script-kiddie style and following the well-known puget guide. Here's the exact steps I took to set this up:

Quote:

-> /etc/modules
Code:

pci_stub
vfio
vfio_iommu_type1
vfio_pci
kvm
kvm_intel

-> /etc/default/grub
Code:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=on vfio_iommu_type1.allow_unsafe_interrupts=1"
->
Code:

sudo update-grub
->
Code:

lspci -nn | grep NVIDIA
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM206 [GeForce GTX 960] [10de:1401] (rev a1)
01:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:0fba] (rev a1)
02:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM206 [GeForce GTX 960] [10de:1401] (rev a1)
02:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:0fba] (rev a1)

-> /etc/initramfs-tools/modules
Code:

pci_stub ids=10de:1401,10de:0fba
->
Code:

sudo update-initramfs -u
-> reboot


-> dmesg | grep pci-stub
Code:

[    2.069389] pci-stub: add 10DE:1401 sub=FFFFFFFF:FFFFFFFF cls=00000000/00000000
[    2.069396] pci-stub 0000:01:00.0: claimed by stub
[    2.069400] pci-stub 0000:02:00.0: claimed by stub
[    2.069401] pci-stub: add 10DE:0FBA sub=FFFFFFFF:FFFFFFFF cls=00000000/00000000
[    2.069404] pci-stub 0000:01:00.1: claimed by stub
[    2.069406] pci-stub 0000:02:00.1: claimed by stub

-> /etc/vfio-pci1.cfg
Code:

0000:01:00.0
0000:01:00.1

-> /etc/vfio-pci2.cfg
Code:

0000:02:00.0
0000:02:00.1

- >
Code:

dd if=/dev/zero of=windows1.img bs=1M seek=160000 count=0
-> /usr/vm1


Code:

#!/bin/bash


configfile=/etc/vfio-pci1.cfg


vfiobind() {
    dev="$1"
        vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
        device=$(cat /sys/bus/pci/devices/$dev/device)
        if [ -e /sys/bus/pci/devices/$dev/driver ]; then
                echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
        fi
        echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
}


modprobe vfio-pci


cat $configfile | while read line;do
    echo $line | grep ^# >/dev/null 2>&1 && continue
        vfiobind $line
done


sudo qemu-system-x86_64 -enable-kvm -M q35 -m 8192 -cpu host \
-smp 2,sockets=1,cores=2,threads=1 \
-bios /usr/share/seabios/bios.bin -vga none \
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
-device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
-device vfio-pci,host=01:00.1,bus=root.1,addr=00.1 \
-drive file=/home/mechacow/windows1.img,id=disk,format=raw,if=none -device ide-hd,bus=ide.1,drive=disk \
-drive file=/home/mechacow/win10.iso,id=isocd,format=raw,if=none -device ide-cd,bus=ide.0,drive=isocd \
-boot menu=on


exit 0

->
Code:

sudo chmod 755 /usr/vm1

The status is that adding/removing "-vga none" from bios line either I can get the VM to run on my linux desktop enough to install Windows (but no GPUs are detected in Windows), or the qemu screen comes up as if it is working, but there is no output from my graphics cards at all. I can't find anything that can tell me if it's at least trying to work or not and just throwing and error.

This has to be the last step before gettting a working VM with GPU passthrough and it's been frustrating.

Does anybody have advice on how to finish this?

Viewing all articles
Browse latest Browse all 4211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>