Ubuntu Pastebin

Paste from tuxiano at Wed, 6 Jul 2016 17:18:40 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

# PCI address of the passtrough devices
DEVICE1="01:00.0"
DEVICE2="01:00.1"

# load vfio-pci module
modprobe vfio-pci

for dev in "0000:$DEVICE1" "0000:$DEVICE2"; do
        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
done

qemu-system-x86_64 \
-bios /usr/share/ovmf/OVMF.fd \
-enable-kvm \
-m 4096 \
-cpu host,kvm=off \
-smp 2,sockets=1,cores=2,threads=1 \
-machine pc-i440fx-2.1,accel=kvm \
-device qxl \
-vga none \
-device vfio-pci,host=$DEVICE1,addr=0x8.0x0,multifunction=on,x-vga=on \
-device vfio-pci,host=$DEVICE2,addr=0x8.0x1 \
-soundhw hda
Download as text