VirtIO, Qemu, Gpu Passthrough, Parsec
This article is the summary-ish of a lot of fun building a gaming/anything station wiht Parsec
I’ll try to be fluid and I’ll show all the commands I did to setup the whole thing.
Thanks to my friend for his help it was not easy to setup !
As of now (3 months later) I’ve use this setup for more than 100 hours gaming, and an incalculable number of hours coding, playing with Fusion 360 and developping random stuff with Unity in 3D and VR.
I recommend to read the article at least once before starting anything. The best way to achieve a proper result you will have to read and troubleshoot based on your physical setup.
Prerequisites
So my hardware allows me to do a ton of things.
The main idea is to install Linux (Rocky Linux 8
) on the baremetal.
You must have 2 GPUs:
- A performant one (GeForce GTX 1660 Ti)
- An Ok one (NVIDIA GT730)
Storage, RAM and CPU are to your discretion, but more you have more “fun” is possible…
- An HDMI loopback to use Parsec from the VM
Setup
I’ll skip the Linux installation because it is so simple to do. I always install Minimal Linux to avoid weird issues.
Also each step are optional, because you can setup your environment as you like and need.
Software Installations
These commands are executed on the baremetal directly, because I plan to use the system and some VM and containers.
sudo dnf update -y
Firefox
sudo dnf install firefox -y
VS Code
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
dnf check-update
sudo dnf install code -y
Source: https://code.visualstudio.com/docs/setup/linux
Install NodeJS using nvm
sudo dnf install tar -y
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm install 14
Source: https://github.com/nvm-sh/nvm
Git
sudo dnf install git -y
Install Obsidian
Download the AppImage From: https://obsidian.md
sudo mv Obsidian*.AppImage obsidian.AppImage
chmod a+x obsidian.AppImage
sudo mkdir /opt/obsidian/
sudo mv obsidian.AppImage /opt/obsidian/
sudo mv obsidian-icon.png /opt/obsidian/
cat >/usr/share/applications/Obsidian.desktop <<EOF
[Desktop Entry]
Name=Obsidian
Exec=/opt/obsidian/obsidian.AppImage
Icon=/opt/obsidian/obsidian-icon.png
comment=Second Brain
Type=Application
Terminal=false
Encoding=UTF-8
Categories=Utility;
EOF
Install Bitwarden
sudo mv Bitwarden*.AppImage bitwarden.AppImage
chmod a+x bitwarden.AppImage
sudo mkdir /opt/bitwarden/
sudo mv bitwarden.AppImage /opt/bitwarden/
sudo mv bitwarden-icon.png /opt/bitwarden/
cat >/usr/share/applications/Bitwarden.desktop <<EOF
[Desktop Entry]
Name=Bitwarden
Exec=/opt/bitwarden/bitwarden.AppImage
Icon=/opt/bitwarden/bitwarden-icon.png
comment=Password Manager
Type=Application
Terminal=false
Encoding=UTF-8
Categories=Utility;
EOF
Install Slack
sudo dnf install ./slack*.rpm -y
rm -rf ./slack*.rpm
Source: https://slack.com/intl/fr-ca/help/articles/212924728-Télécharger-Slack-pour-Linux--version-bêta-
Parsec
sudo dnf install alsa-plugins-pulseaudio
sudo dpkg -i parsec-linux.deb
remmina
sudo dnf install -y remmina
Discord
sudo flatpak remote-add --if-not-exists flathub ./flathub.flatpakrepo
flatpak install flathub com.discordapp.Discord
Spotify
flatpak install flathub com.spotify.Client
Docker
Simply follow the official documentation.
Misc.
Install and Configure NTFS
I still have Windows stuff to migrate :/ I might passthrough some SSD directly to the vm.
sudo dnf groupinstall "Development Tools"
sudo dnf install ntfs-3g -y
sudo mount /dev/sdb2 /mnt
Virtualization
Install Libvirt and Qemu
sudo dnf install qemu-kvm qemu-img libvirt virt-install libvirt-client -y
sudo systemctl start libvirtd
sudo systemctl enable libvirtd
sudo dnf install virt-manager -y
sudo dnf install -y edfk2-ovmf
Drivers
NVIDIA GT730
Enable SSH Before continuing
sudo service lightdm stop
cat >/etc/modprobe.d/nouveau.conf <<EOF
blacklist nouveau
options nouveau modeset=0
EOF
reboot
sudo chmod +x ./NVIDIA*.run
sudo ./NVIDIA*.run
cat >/etc/X11/xorg.conf.d/10-nvidia.conf <<EOF
Section "Device"
Identifier "GeForce GT 730"
Driver "nvidia"
BusID "PCI:4:0:0"
EndSection
EOF
Expected output
lspci -v -s 04:
04:00.0 VGA compatible controller: NVIDIA Corporation GK208B [GeForce GT 730] (rev a1) (prog-if 00 [VGA controller])
Subsystem: Micro-Star International Co., Ltd. [MSI] Device 8a9f
Flags: bus master, fast devsel, latency 0, IRQ 47, IOMMU group 15
Memory at f9000000 (32-bit, non-prefetchable) [size=16M]
Memory at d8000000 (64-bit, prefetchable) [size=128M]
Memory at e0000000 (64-bit, prefetchable) [size=32M]
I/O ports at e000 [size=128]
Expansion ROM at fa000000 [virtual] [disabled] [size=512K]
Capabilities: <access denied>
Kernel driver in use: nvidia
Kernel modules: nouveau, nvidia_drm, nvidia
04:00.1 Audio device: NVIDIA Corporation GK208 HDMI/DP Audio Controller (rev a1)
Subsystem: Micro-Star International Co., Ltd. [MSI] Device 8a9f
Flags: bus master, fast devsel, latency 0, IRQ 37, IOMMU group 15
Memory at fa080000 (32-bit, non-prefetchable) [size=16K]
Capabilities: <access denied>
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
How to install Gnome
I’ll put my commands here but I recommend you to read the official documentation.
Context: I had XFCE installed, but with good arguments I’ve switched to Gnome. But it has caused an issue with the package runc
and docker
.
sudo dnf groupremove "xfce"
sudo yum groupinstall "Server with GUI" --allowerasing
sudo yum remove runc -y
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl start docker
sudo systemctl enable docker
sudo systemctl enable containerd
Reference: https://access.redhat.com/discussions/5895421
VM and Passthrough with Windows 10
Sources:
- https://vfio.blogspot.com/2015/05/vfio-gpu-how-to-series-part-3-host.html
- https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF
- https://www.server-world.info/en/note?os=Rocky_Linux_8&p=kvm&f=12
- https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF#X_does_not_start_after_enabling_vfio_pci
Prerequisites
I’m lazy so sudo -s
Enable IOMMU
vi /etc/default/grub
...
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=vgNvme/root amd_iommu=on iommu=pt rd.driver.pre=vfio-pci video=efifb:off"
...
grub2-mkconfig –o /boot/grub2/grub.cfg
Configure dracut
cat >/etc/dracut.conf.d/vfio.conf <<EOF
add_drivers+=" vfio vfio_iommu_type1 vfio_pci vfio_virqfd "
install_items+=" /sbin/vfio-pci-override-gpu.sh "
EOF
dracut --regenerate-all -f -v
Get IOMMU Output
shopt -s nullglob
for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do
echo "IOMMU Group ${g##*/}:"
for d in $g/devices/*; do
echo -e "\t$(lspci -nns ${d##*/})"
done;
done;
IOMMU Group 16:
07:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU116 [GeForce GTX 1660 Ti] [10de:2182] (rev a1)
07:00.1 Audio device [0403]: NVIDIA Corporation TU116 High Definition Audio Controller [10de:1aeb] (rev a1)
07:00.2 USB controller [0c03]: NVIDIA Corporation TU116 USB 3.1 Host Controller [10de:1aec] (rev a1)
07:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU116 USB Type-C UCSI Controller [10de:1aed] (rev a1)
Create the workaround script
cat >/sbin/vfio-pci-override-gpu.sh <<EOF
#!/bin/sh
DEVS="0000:07:00.0 0000:07:00.1 0000:07:00.2 0000:07:00.3"
for DEV in \$DEVS; do
echo "vfio-pci" > /sys/bus/pci/devices/\$DEV/driver_override
done
modprobe -i vfio-pci
# This is the dirty fix that I have to do to remove the code 43 error in the windows VM
# This error in dmesg : vfio-pci 0000:07:00.0: BAR 3: can't reserve [mem 0xd0000000-0xd1ffffff 64bit pref]
echo 0 > /sys/class/vtconsole/vtcon1/bind
echo 0 > /sys/class/vtconsole/vtcon0/bind
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
EOF
chmod 755 /sbin/vfio-pci-override-gpu.sh
Force the USB Controller to use the vfio-pci driver
This configuration is permanent
driverctl -v set-override 0000:07:00.2 vfio-pci
Configure modprobe
cat >/etc/modprobe.d/vfio.conf <<EOF
options vfio-pci ids=10de:2182,10de:1aeb,10de:1aec,10de:1aed
install vfio-pci /sbin/vfio-pci-override-gpu.sh
EOF
cat >/etc/modules-load.d/vfio-pci.conf <<EOF
vfio_pci
EOF
Fix the second GPU Card (used for the local Linux)
lspci -v | grep NVIDIA
04:00.0 VGA compatible controller: NVIDIA Corporation GK208B [GeForce GT 730] (rev a1) (prog-if 00 [VGA controller])
04:00.1 Audio device: NVIDIA Corporation GK208 HDMI/DP Audio Controller (rev a1)
07:00.0 VGA compatible controller: NVIDIA Corporation TU116 [GeForce GTX 1660 Ti] (rev a1) (prog-if 00 [VGA controller])
07:00.1 Audio device: NVIDIA Corporation TU116 High Definition Audio Controller (rev a1)
07:00.2 USB controller: NVIDIA Corporation TU116 USB 3.1 Host Controller (rev a1) (prog-if 30 [XHCI])
07:00.3 Serial bus controller: NVIDIA Corporation TU116 USB Type-C UCSI Controller (rev a1)
cat >/etc/X11/xorg.conf.d/10-nvidia.conf <<EOF
Section "Device"
Identifier "GeForce GT 730"
Driver "modesetting"
BusID "PCI:4:0:0"
EndSection
EOF
Last step
reboot
Expected output
lspci -nk -s 07:
07:00.0 0300: 10de:2182 (rev a1)
Subsystem: 3842:1667
Kernel driver in use: vfio-pci
Kernel modules: nouveau
07:00.1 0403: 10de:1aeb (rev a1)
Subsystem: 3842:1667
Kernel driver in use: vfio-pci
Kernel modules: snd_hda_intel
07:00.2 0c03: 10de:1aec (rev a1)
Subsystem: 3842:1667
Kernel driver in use: vfio-pci
07:00.3 0c80: 10de:1aed (rev a1)
Subsystem: 3842:1667
Kernel driver in use: vfio-pci
dmesg | grep vfio
[ 0.000000] Command line: BOOT_IMAGE=(hd5,gpt2)/vmlinuz-4.18.0-372.9.1.el8.x86_64 root=/dev/mapper/vgNvme-root ro crashkernel=auto rd.lvm.lv=vgNvme/root amd_iommu=on iommu=pt rd.driver.pre=vfio-pci
[ 0.000000] Kernel command line: BOOT_IMAGE=(hd5,gpt2)/vmlinuz-4.18.0-372.9.1.el8.x86_64 root=/dev/mapper/vgNvme-root ro crashkernel=auto rd.lvm.lv=vgNvme/root amd_iommu=on iommu=pt rd.driver.pre=vfio-pci
[ 0.735983] vfio_pci: unknown parameter 'disable_vga' ignored
[ 0.736528] vfio-pci 0000:07:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=io+mem
[ 0.773092] vfio_pci: add [10de:2182[ffffffff:ffffffff]] class 0x000000/00000000
[ 0.775678] vfio_pci: add [10de:1aeb[ffffffff:ffffffff]] class 0x000000/00000000
[ 0.777400] vfio_pci: add [10de:1aec[ffffffff:ffffffff]] class 0x000000/00000000
[ 0.779116] vfio_pci: add [10de:1aed[ffffffff:ffffffff]] class 0x000000/00000000
[ 78.318882] vfio-pci 0000:07:00.0: vfio_ecap_init: hiding ecap 0x1e@0x258
[ 78.318913] vfio-pci 0000:07:00.0: vfio_ecap_init: hiding ecap 0x19@0x900
[ 78.320347] vfio-pci 0000:07:00.0: No more image in the PCI ROM
[ 78.783016] vfio-pci 0000:07:00.0: No more image in the PCI ROM
[ 78.783028] vfio-pci 0000:07:00.0: No more image in the PCI ROM
SSD Passthrough
- http://ronaldevers.nl/2012/10/14/adding-a-physical-disk-kvm-libvirt.html See the attached dumpxml for more details There is a bug in the UI that was blocking me to add the devices.
Cpu Pinning
sudo dnf install -y hwloc-gui
lscpu -e
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE MAXMHZ MINMHZ
0 0 0 0 0:0:0:0 yes 5758.5928 2200.0000
1 0 0 1 1:1:1:0 yes 5758.5928 2200.0000
2 0 0 2 2:2:2:0 yes 5758.5928 2200.0000
3 0 0 3 3:3:3:0 yes 5758.5928 2200.0000
4 0 0 4 4:4:4:0 yes 5758.5928 2200.0000
5 0 0 5 5:5:5:0 yes 5758.5928 2200.0000
6 0 0 6 6:6:6:1 yes 5758.5928 2200.0000
7 0 0 7 7:7:7:1 yes 5758.5928 2200.0000
8 0 0 8 8:8:8:1 yes 5758.5928 2200.0000
9 0 0 9 9:9:9:1 yes 5758.5928 2200.0000
10 0 0 10 10:10:10:1 yes 5758.5928 2200.0000
11 0 0 11 11:11:11:1 yes 5758.5928 2200.0000
12 0 0 0 0:0:0:0 yes 5758.5928 2200.0000
13 0 0 1 1:1:1:0 yes 5758.5928 2200.0000
14 0 0 2 2:2:2:0 yes 5758.5928 2200.0000
15 0 0 3 3:3:3:0 yes 5758.5928 2200.0000
16 0 0 4 4:4:4:0 yes 5758.5928 2200.0000
17 0 0 5 5:5:5:0 yes 5758.5928 2200.0000
18 0 0 6 6:6:6:1 yes 5758.5928 2200.0000
19 0 0 7 7:7:7:1 yes 5758.5928 2200.0000
20 0 0 8 8:8:8:1 yes 5758.5928 2200.0000
21 0 0 9 9:9:9:1 yes 5758.5928 2200.0000
22 0 0 10 10:10:10:1 yes 5758.5928 2200.0000
23 0 0 11 11:11:11:1 yes 5758.5928 2200.0000
Network
Libvirt + Bridge
sudo dnf install -y bridge-utils
sudo dnf install -y net-tools tcpdump
cat >>/etc/sysctl.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
net.bridge.bridge-nf-filter-vlan-tagged = 0
EOF
modprobe --first-time 8021q
modprobe br_netfilter
sysctl -p
bridge="br0"
nmcli connection add type bridge \
ifname $bridge \
con-name $bridge \
802-3-ethernet.mtu 1500 \
ipv4.method auto \
ipv4.never-default false \
ipv6.method ignore \
ipv6.never-default true
nmcli con up $bridge
bridge="br2"
nmcli connection add type bridge \
ifname $bridge \
con-name $bridge \
802-3-ethernet.mtu 1500 \
ipv4.method auto \
ipv4.never-default false \
ipv6.method ignore \
ipv6.never-default true
nmcli con up $bridge
bridge="br2"
interface="enp6s0"
nmcli connection add type bridge-slave \
ifname $interface \
con-name bridge-slave-$interface \
master $bridge
mv /etc/sysconfig/network-scripts/ifcfg-$interface /etc/sysconfig/network-scripts/bck-$interface
cat > /tmp/WAN.xml << EOF
<network>
<name>WAN</name>
<forward mode='bridge' />
<bridge name='br2' />
</network>
EOF
virsh net-define /tmp/WAN.xml && \
virsh net-autostart WAN && \
virsh net-start WAN
Windows 10 UEFI
The VM Configuration
Download and load the virtio drivers (https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers)
- Storage (viostor)
- Network (netkvm)
Install Windows 10 as usual and setup Parsec, Steam, Fusion 360, Unity and etc.
Then using the HDMI Loopback you will be able to stream the output with an awesome resolution from anywhere using the power of Parsec !
My final Qemu Configuration
<domain type="kvm">
<name>Windows_10</name>
<uuid>91746ce1-a3d9-41bb-b68a-8ba6d3b7f8b9</uuid>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://microsoft.com/win/10"/>
</libosinfo:libosinfo>
</metadata>
<memory unit="KiB">24576000</memory>
<currentMemory unit="KiB">24576000</currentMemory>
<vcpu placement="static">12</vcpu>
<iothreads>2</iothreads>
<cputune>
<vcpupin vcpu="0" cpuset="6"/>
<vcpupin vcpu="1" cpuset="7"/>
<vcpupin vcpu="2" cpuset="8"/>
<vcpupin vcpu="3" cpuset="9"/>
<vcpupin vcpu="4" cpuset="10"/>
<vcpupin vcpu="5" cpuset="11"/>
<vcpupin vcpu="6" cpuset="18"/>
<vcpupin vcpu="7" cpuset="19"/>
<vcpupin vcpu="8" cpuset="20"/>
<vcpupin vcpu="9" cpuset="21"/>
<vcpupin vcpu="10" cpuset="22"/>
<vcpupin vcpu="11" cpuset="23"/>
<emulatorpin cpuset="0-1"/>
<iothreadpin iothread="1" cpuset="0-1"/>
<iothreadpin iothread="2" cpuset="2-3"/>
</cputune>
<os>
<type arch="x86_64" machine="pc-q35-rhel8.6.0">hvm</type>
<loader readonly="yes" secure="yes" type="pflash">/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd</loader>
<nvram>/var/lib/libvirt/qemu/nvram/Windows_10_VARS.fd</nvram>
<bootmenu enable="yes"/>
</os>
<features>
<acpi/>
<apic/>
<hyperv mode="custom">
<relaxed state="on"/>
<vapic state="on"/>
<spinlocks state="on" retries="8191"/>
<vpindex state="on"/>
<synic state="on"/>
<stimer state="on"/>
<reset state="on"/>
<vendor_id state="on" value="123456789abc"/>
<frequencies state="on"/>
</hyperv>
<kvm>
<hidden state="on"/>
</kvm>
<vmport state="off"/>
<smm state="on"/>
</features>
<cpu mode="host-passthrough" check="none" migratable="on">
<topology sockets="1" dies="1" cores="6" threads="2"/>
<cache mode="passthrough"/>
<feature policy="require" name="topoext"/>
</cpu>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
<timer name="hypervclock" present="yes"/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/vm-storage/windows_10.qcow2"/>
<target dev="vda" bus="virtio"/>
<boot order="1"/>
<address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
</disk>
<disk type="block" device="disk">
<driver name="qemu" type="raw"/>
<source dev="/dev/sdb"/>
<target dev="vdb" bus="virtio"/>
<address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
</disk>
<disk type="block" device="disk">
<driver name="qemu" type="raw"/>
<source dev="/dev/sde"/>
<target dev="vdc" bus="virtio"/>
<address type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
</disk>
<disk type="block" device="disk">
<driver name="qemu" type="raw"/>
<source dev="/dev/sdc"/>
<target dev="vdd" bus="virtio"/>
<address type="pci" domain="0x0000" bus="0x09" slot="0x00" function="0x0"/>
</disk>
<disk type="block" device="disk">
<driver name="qemu" type="raw"/>
<source dev="/dev/sda"/>
<target dev="vde" bus="virtio"/>
<address type="pci" domain="0x0000" bus="0x0a" slot="0x00" function="0x0"/>
</disk>
<disk type="file" device="cdrom">
<driver name="qemu" type="raw"/>
<source file="/home/tgingras/Windows10.iso"/>
<target dev="sda" bus="sata"/>
<readonly/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>
<disk type="file" device="cdrom">
<driver name="qemu" type="raw"/>
<source file="/home/tgingras/Downloads/virtio-win-0.1.217.iso"/>
<target dev="sdb" bus="sata"/>
<readonly/>
<address type="drive" controller="0" bus="0" target="0" unit="1"/>
</disk>
<controller type="usb" index="0" model="qemu-xhci" ports="15">
<address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/>
</controller>
<controller type="sata" index="0">
<address type="pci" domain="0x0000" bus="0x00" slot="0x1f" function="0x2"/>
</controller>
<controller type="pci" index="0" model="pcie-root"/>
<controller type="pci" index="1" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="1" port="0x10"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
</controller>
<controller type="pci" index="2" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="2" port="0x11"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x1"/>
</controller>
<controller type="pci" index="3" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="3" port="0x12"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x2"/>
</controller>
<controller type="pci" index="4" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="4" port="0x13"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x3"/>
</controller>
<controller type="pci" index="5" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="5" port="0x14"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x4"/>
</controller>
<controller type="pci" index="6" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="6" port="0x15"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x5"/>
</controller>
<controller type="pci" index="7" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="7" port="0x16"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x6"/>
</controller>
<controller type="pci" index="8" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="8" port="0x17"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x7"/>
</controller>
<controller type="pci" index="9" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="9" port="0x18"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0" multifunction="on"/>
</controller>
<controller type="pci" index="10" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="10" port="0x19"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x1"/>
</controller>
<controller type="pci" index="11" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="11" port="0x1a"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x2"/>
</controller>
<controller type="pci" index="12" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="12" port="0x1b"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x3"/>
</controller>
<controller type="pci" index="13" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="13" port="0x1c"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x4"/>
</controller>
<controller type="virtio-serial" index="0">
<address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
</controller>
<interface type="network">
<mac address="52:54:00:b6:c5:b7"/>
<source network="WAN"/>
<model type="virtio"/>
<address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>
<serial type="pty">
<target type="isa-serial" port="0">
<model name="isa-serial"/>
</target>
</serial>
<console type="pty">
<target type="serial" port="0"/>
</console>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
<address type="virtio-serial" controller="0" bus="0" port="1"/>
</channel>
<input type="tablet" bus="usb">
<address type="usb" bus="0" port="1"/>
</input>
<input type="mouse" bus="ps2"/>
<input type="keyboard" bus="ps2"/>
<sound model="ich9">
<address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0"/>
</sound>
<audio id="1" type="none"/>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
</source>
<address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
</hostdev>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x07" slot="0x00" function="0x1"/>
</source>
<address type="pci" domain="0x0000" bus="0x0b" slot="0x00" function="0x0"/>
</hostdev>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x07" slot="0x00" function="0x2"/>
</source>
<address type="pci" domain="0x0000" bus="0x0c" slot="0x00" function="0x0"/>
</hostdev>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x07" slot="0x00" function="0x3"/>
</source>
<address type="pci" domain="0x0000" bus="0x0d" slot="0x00" function="0x0"/>
</hostdev>
<redirdev bus="usb" type="spicevmc">
<address type="usb" bus="0" port="2"/>
</redirdev>
<redirdev bus="usb" type="spicevmc">
<address type="usb" bus="0" port="3"/>
</redirdev>
<memballoon model="virtio">
<address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</memballoon>
</devices>
</domain>
References
- https://mathiashueber.com/performance-tweaks-gaming-on-virtual-machines/
- https://mathiashueber.com/configuring-hugepages-use-virtual-machine/
- https://looking-glass.io/docs/B5.0.1/install/
- https://www.gnome.org/
Conclusion
I might have forgotten things here, honestly it was really nice to do and i’m super happy with the final result !
Let me know if I forgot something or if you need more details about a step. I’ve tried to keep notes of all the steps that we did.
It requires a good knowledge of linux, virtualization and network to setup everything properly. You can send me an email, leave a comment and etc. to improve this article and share your experience !
Have fun !