merge-requests/1/head
Yuri Alek 6 years ago
parent 6c2cfd4dae
commit bfce00a63d

@ -3,14 +3,13 @@
![Windows 10 1709](/Screenshots/Windows 10 QEMU single GPU info.png)*Windows 10 1709*
## ToC
## Table of Contents
1. [What this does](#what-this-does)
2. [What you need](#what-you-need)
3. [My system](#my-system)
4. [Configure](#configure)
5. [About peripherals](#about-peripherals)
6. [Known problems](#known-problems)
7. [TODO](#todo)
5. [Known problems](#known-problems)
6. [TODO](#todo)
## What this does
In one command it kills X, frees the GPU from drivers and console, detaches the GPU from the host, starts the VM with the GPU, waits until the VM is off, reattaches the GPU to the host and starts lightdm.
@ -18,7 +17,7 @@ In one command it kills X, frees the GPU from drivers and console, detaches the
## What you need
* An IOMMU enabled motherboard. Check your motherboard manual.
* CPU support for AMD-v/VT-x and AMD-Vi/VT-d (AMD/Intel). And virtualization support enabled on BIOS.
* One GPU that supports UEFI and its BIOS. All GPUs from 2012 and later should support this.
* One GPU that supports UEFI and its BIOS. All GPUs from 2012 and later should support this. If the GPU does not support UEFI you may be able to make it work, but you wont see anything in the screen until the drivers inside Windows kick in.
* QEMU, OVMF UEFI and VIRTIO drivers for Windows.
* [Optional] HDD only for Windows
@ -36,9 +35,9 @@ In one command it kills X, frees the GPU from drivers and console, detaches the
[Software]
Linux Distro: ArchLinux
Linux Kernel: 4.17.11 vanilla
Nvidia divers: 396.45-2
QEMU version: 2.12.0-2
Linux Kernel: 4.17.14 vanilla
Nvidia divers: 396.51-1
QEMU version: 2.12.1-1
OVMF version: r24021
[Guests]
@ -50,39 +49,26 @@ In one command it kills X, frees the GPU from drivers and console, detaches the
## Configure
1. Clone this repository
```bash
git clone https://gitlab.com/YuriAlek/vfio.git
$ git clone https://gitlab.com/YuriAlek/vfio.git
```
2. Enable vfio at boot. Edit `/etc/mkinitcpio.conf`.
2. [Optional] [Download virtio drivers](https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers). If you do not, modify the `windows.sh` script.
```
MODULES=(... vfio_pci vfio vfio_iommu_type1 vfio_virqfd ...)
HOOKS=(... modconf ...)
$ wget -o virtio-win.iso "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso"
```
3. [Regenerate the initramfs](https://wiki.archlinux.org/index.php/Mkinitcpio#Image_creation_and_activation)
```bash
sudo mkinitcpio -p linux
```
4. Reboot the system to load the vfio drivers
5. [Optional] [Download virtio drivers](https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers)
```
wget -o virtio-win.iso "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso"
```
6. Get the GPU BIOS [Source](https://www.youtube.com/watch?v=1IP-h9IKof0). [You can download the bios](https://www.techpowerup.com/vgabios/). If you do so, download a HEX editor and skip to step 4.
3. Get the GPU BIOS [Source](https://www.youtube.com/watch?v=1IP-h9IKof0). [You can download the bios from techpowerup.com](https://www.techpowerup.com/vgabios/); if you do so, download a HEX editor and skip to step 5.
1. Boot the host into Windows.
2. [Download and install GPU-Z](https://www.techpowerup.com/gpuz/).
3. [Download and install a HEX editor](https://github.com/bwrsandman/Bless).
3. [Open GPU-Z and backup the GPU BIOS](/Screenshots/vBIOS.png). Right next to the `Bios Version`; in my case `80.04.C3.00.0F`, there is an icon for backup. A file named `GK104.rom` will be created [Your file name may vary].
4. Open the ROM (`GK104.rom`) in the HEX editor.
5. [After a bunch of `00` there is a `55` or `U` in HEX, delete everything before the `55`](/Screenshots/Hex vBIOS.png), and save. I strongly recommend not to overwrite the original ROM.
4. [Open GPU-Z and backup the GPU BIOS](/Screenshots/vBIOS.png). Right next to the `Bios Version`; in my case `80.04.C3.00.0F`, there is an icon for backup. A file named `GK104.rom` will be created [Your file name may vary].
5. Open the vBIOS ROM (`GK104.rom`) in the HEX editor.
6. [After a bunch of `00` there is a `55` or `U` in HEX, delete everything before the `55`](/Screenshots/Hex vBIOS.png), and save. I strongly recommend not to overwrite the original ROM.
7. Get the iommu groups needed for the VM (GPU, GPU audio and USB controller)
```bash
chmod +x scripts/iommu.sh
bash scripts/iommu.sh
4. Get the iommu groups needed for the VM (GPU, GPU audio and USB controller)
```
$ chmod +x scripts/iommu.sh
$ scripts/iommu.sh
-------------------------
# GPU
IOMMU group 13
@ -96,27 +82,25 @@ IOMMU group 18
08:00.2 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] [1022:7901] (rev 51)
```
8. [Optional] Create the image for the VM. Only if not using a physical hard drive.
```
qemu-img create -f raw windows.raw 60G
5. [Optional] Create the image for the VM. Only if not using a physical hard drive.
```bash
$ qemu-img create -f raw windows.raw 60G
```
9. Edit the script `windows-install.sh` and `windows.sh` to convenience. Things you may have to edit:
6. Edit the script `windows-install.sh` **and** `windows.sh` to convenience. Things you may have to edit:
1. PCI devices
2. User
3. Location of HDD, ISO, vBIOS and OVMF image
4. The Desktop Environment, Display Manager, Window Manager, etc.
5. QEMU options like RAM and CPU
6. Kernel modules
<!--
Check the guides [IOMMU][], [other guide, may be important][]
-->
10. Start the VM
7. Start the VM
```
sudo scripts/windows-install.sh
# scripts/windows-install.sh
```
11. When installing Windows, in the section `Where do you want to install Windows?` there will be no hard drives to install to; to fix it:
8. When installing Windows, in the section `Where do you want to install Windows?` there will be no hard drives to install to; to fix it:
1. Load driver
2. Browse
3. CD Drive (E:) virtio-win-0.1.1
@ -130,58 +114,59 @@ sudo scripts/windows-install.sh
11. Proceed as normal.
12. Let Windows find the drivers for the GPU (if Windows has network) or [download the updated ones from NVIDIA](https://www.nvidia.com/Download/index.aspx?lang=en-us).
12. Once installed Windows, run the VM with
9. Once installed Windows, run the VM with:
```
sudo scripts/windows.sh
# scripts/windows.sh
```
### For the sake of convenience
```bash
sudo ln -s scripts/qemu@.service /usr/lib/systemd/system/
```
# ln -s scripts/qemu@.service /usr/lib/systemd/system/
```
```bash
alias windows="sudo systemctl start qemu@windows.service"
alias macos="sudo systemctl start qemu@macos-hs.service"
$ alias windows="sudo systemctl start qemu@windows.service"
$ alias macos="sudo systemctl start qemu@macos-hs.service"
```
To start the Windows VM
```
windows
$ windows
```
To start the MacOS VM
```
macos
$ macos
```
## About peripherals
For audio I use an USB sound card.
For internet I use network.sh
For USB I simply passthrough an USB 3.0 controller.
## Known problems
### Race condition
There is something somewhere that makes it crash. That's why there is so many `sleep`
### Root
QEMU should never be run as root. If you must launch it in a script as root, you should use the `-runas` option to make QEMU drop root privileges.
### MacOS does not like USB hubs, therefore anything connected to a hub will be ignored by MacOS
### Sometimes works, sometimes does not
Sometimes the GPU will not have correct drivers, Windows may install them... or not.
Sometimes the QEMU command will just fail and the command continues and start X again.
Sometimes the QEMU command does not exit after shutting down the VM.
### Windows version
Windows 10 Pro 1709 works for me, but 1803 does not (may be the UEFI). I have heard that the 1803 version comes with a Spectre patch and the performance is pathetic.
## TODO
- [x] Unbind GPU without `virsh`
- [x] Update macos script
- [x] Try to run the VM as user.
- [x] Try if is necessary to edit `/etc/mkinitcpio.conf`
- [ ] Network
- [ ] Audio
- [ ] IOMMU
- [ ] Troubleshooting
- [ ] Extract the vBIOS in Linux
- [ ] Try if is necessary to edit `/etc/mkinitcpio.conf`
- [ ] IOMMU guide
- [ ] Troubleshooting guide
- [ ] Extract the vBIOS in Linux guide
- [ ] How to edit the `windows.sh` script
- [ ] Fix the race condition
- [ ] Create scripts for install and use (Without DVD images)
- [ ] Try to run the VM as user
- [ ] ACS Patch (Does not work for me)
- [ ] ???
<!--

@ -98,7 +98,8 @@ qemu-system-x86_64 -enable-kvm \
-device vfio-pci,host=$IOMMU_USB \
-usb -device usb-kbd -device usb-tablet \
-device nec-usb-xhci,id=xhci \
-netdev user,id=net0 -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \
-netdev user,id=net0 \
-device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \
-device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" \
-drive if=pflash,format=raw,readonly,file=/home/yu/vm/OSX-KVM/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=/home/yu/vm/OSX-KVM/OVMF_VARS.fd \

@ -0,0 +1,66 @@
#!/bin/bash
# Requires iproute2, dnsmasq, and firewall [iptables, shorewall, ...]
# Check if the script is executed as root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit 1
fi
# END Check if you are sudo
# Variables
NIC=qemubr0
IP=10.10.10.1/24
start_network()
{
ip link add name $NIC type bridge
ip link set $NIC up
ip address add $IP dev $NIC
}
stop_network()
{
ip link set $NIC down
ip link delete $NIC type bridge
}
start_dnsmasq()
{
systemctl start dnsmasq
}
stop_dnsmasq()
{
systemctl stop dnsmasq
}
_help()
{
echo "Usage: network.sh [OPTIONS]"
echo " start - start the network"
echo " stop - stop the network"
}
_start()
{
if [ "$1" = "start" ]; then
start_network
start_dnsmasq
exit
elif [ "$1" = "stop" ]; then
stop_dnsmasq
stop_network
exit
else
_help
exit 1
fi
}
if [[ $1 ]]; then
_start $1
else
_help
exit 1
fi

@ -0,0 +1,184 @@
#!/bin/bash
# Check if the script is executed as root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit 1
fi
# END Check if you are sudo
# Variables
USER=yu
IOMMU_GPU=06:00.0
IOMMU_GPU_AUDIO=06:00.1
IOMMU_USB=07:00.3
VIRSH_GPU=pci_0000_06_00_0
VIRSH_GPU_AUDIO=pci_0000_06_00_1
VIRSH_USB=pci_0000_07_00_3
VBIOS=/home/$USER/vm/GK104_80.04.C3.00.0F-MODED.rom
IMG=file=/home/$USER/vm/windows.raw,id=disk,format=raw,if=none
ISO=/home/yu/vm/win10.iso
HDD=file=/dev/sdc,media=disk,format=raw,if=none
# HDD=file=/home/$USER/vm/windows.raw
OVMF_CODE=/usr/share/ovmf/x64/OVMF_CODE.fd
RAM=12G
CORES=12
RES="1920 1080"
videoid="10de 1184"
audioid="10de 0e0a"
usbid="1022 145f"
videobusid="0000:06:00.0"
audiobusid="0000:06:00.1"
usbbusid="0000:07:00.3"
ULIMIT=$(ulimit -a | grep "max locked memory" | awk '{print $6}')
# END Variables
_start()
{
# Memory lock limit
if [ $(ulimit -a | grep "max locked memory" | awk '{print $6}') != 12884900 ]; then
ulimit -l 12884900
fi
## Kill X and related
systemctl stop lightdm > /dev/null 2>&1
killall i3 > /dev/null 2>&1
sleep 2
# Kill the console to free the GPU
echo 0 > /sys/class/vtconsole/vtcon0/bind
sleep 1
echo 0 > /sys/class/vtconsole/vtcon1/bind
sleep 1
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
sleep 1
# Unload the Kernel Modules that use the GPU
modprobe -r nvidia_drm
sleep 1
modprobe -r nvidia_modeset
sleep 1
modprobe -r nvidia
sleep 1
modprobe -r snd_hda_intel
sleep 2
# Load the kernel module
modprobe vfio
sleep 1
modprobe vfio_iommu_type1
sleep 1
modprobe vfio-pci
sleep 1
# Detach the GPU from drivers and attach to vfio. Also the usb.
echo $videoid > /sys/bus/pci/drivers/vfio-pci/new_id
sleep 1
echo $videobusid > /sys/bus/pci/devices/$videobusid/driver/unbind
sleep 1
echo $videobusid > /sys/bus/pci/drivers/vfio-pci/bind
sleep 1
echo $videoid > /sys/bus/pci/drivers/vfio-pci/remove_id
sleep 1
echo $audioid > /sys/bus/pci/drivers/vfio-pci/new_id
sleep 1
echo $audiobusid > /sys/bus/pci/devices/$audiobusid/driver/unbind
sleep 1
echo $audiobusid > /sys/bus/pci/drivers/vfio-pci/bind
sleep 1
echo $audioid > /sys/bus/pci/drivers/vfio-pci/remove_id
sleep 1
echo $usbid > /sys/bus/pci/drivers/vfio-pci/new_id
sleep 1
echo $usbbusid > /sys/bus/pci/devices/$usbbusid/driver/unbind
sleep 1
echo $usbbusid > /sys/bus/pci/drivers/vfio-pci/bind
sleep 1
echo $usbid > /sys/bus/pci/drivers/vfio-pci/remove_id
#ls -la /sys/bus/pci/devices/$usbbusid/
sleep 1
}
_stop()
{
# Wait for QEMU to finish before continue
wait
sleep 5
# Unload the vfio module. I am lazy, this leaves the GPU without drivers
modprobe -r vfio-pci
sleep 2
modprobe -r vfio_iommu_type1
sleep 2
modprobe -r vfio
sleep 2
# Reload the kernel modules. This loads the drivers for the GPU
modprobe snd_hda_intel
sleep 5
modprobe nvidia_drm
sleep 2
modprobe nvidia_modeset
sleep 2
modprobe nvidia
sleep 5
# Bind the usb
#echo $usbid > /sys/bus/pci/drivers/xhci_hcd/new_id
echo $usbbusid > /sys/bus/pci/devices/$usbbusid/driver/unbind
echo $usbbusid > /sys/bus/pci/drivers/xhci_hcd/bind
sleep 10
#echo $usbid > /sys/bus/pci/drivers/xhci_hcd/remove_id
#ls -la /sys/bus/pci/devices/$usbbusid/
# Re-Bind EFI-Framebuffer and Re-bind to virtual consoles
# [Source] [https://github.com/joeknock90/Single-GPU-Passthrough/blob/master/README.md#vm-stop-script]
echo 1 > /sys/class/vtconsole/vtcon0/bind
sleep 1
echo 1 > tee /sys/class/vtconsole/vtcon1/bind
sleep 5
#echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/bind
#sleep 1
# Reload the Display Manager to access X
systemctl start lightdm
sleep 5
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/bind
sleep 1
# Restore ulimit
ulimit -l $ULIMIT
}
_help()
{
echo "Usage: test-qemu.sh [OPTIONS]"
echo " start"
echo " stop"
}
_do()
{
if [ "$1" = "start" ]; then
_start
exit
elif [ "$1" = "stop" ]; then
_stop
exit
else
_help
exit 1
fi
}
if [[ $1 ]]; then
_do $1
else
_help
exit 1
fi

@ -0,0 +1,173 @@
#!/bin/bash
# Check if the script is executed as root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit 1
fi
# END Check if you are sudo
# Variables
USER=yu
IOMMU_GPU=06:00.0
IOMMU_GPU_AUDIO=06:00.1
IOMMU_USB=07:00.3
VIRSH_GPU=pci_0000_06_00_0
VIRSH_GPU_AUDIO=pci_0000_06_00_1
VIRSH_USB=pci_0000_07_00_3
VBIOS=/home/$USER/vm/GK104_80.04.C3.00.0F-MODED.rom
IMG=file=/home/$USER/vm/windows.raw,id=disk,format=raw,if=none
WIN10=/home/$USER/vm/win10.iso
VIRTIO=/home/$USER/vm/virtio-Windows-Drivers.iso
HDD=file=/dev/sdc,media=disk,format=raw,if=none
# HDD=file=/home/$USER/vm/windows.raw
OVMF_CODE=/usr/share/ovmf/x64/OVMF_CODE.fd
RAM=12G
CORES=12
RES="1920 1080"
videoid="10de 1184"
audioid="10de 0e0a"
usbid="1022 145f"
videobusid="0000:06:00.0"
audiobusid="0000:06:00.1"
usbbusid="0000:07:00.3"
ULIMIT=$(ulimit -a | grep "max locked memory" | awk '{print $6}')
# END Variables
# Memory lock limit
if [ $(ulimit -a | grep "max locked memory" | awk '{print $6}') != 12884900 ]; then
ulimit -l 12884900
fi
## Kill X and related
systemctl stop lightdm > /dev/null 2>&1
killall i3 > /dev/null 2>&1
sleep 2
# Kill the console to free the GPU
echo 0 > /sys/class/vtconsole/vtcon0/bind
sleep 1
echo 0 > /sys/class/vtconsole/vtcon1/bind
sleep 1
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
sleep 1
# Unload the Kernel Modules that use the GPU
modprobe -r nvidia_drm
sleep 1
modprobe -r nvidia_modeset
sleep 1
modprobe -r nvidia
sleep 1
modprobe -r snd_hda_intel
sleep 2
# Load the kernel module
modprobe vfio
sleep 1
modprobe vfio_iommu_type1
sleep 1
modprobe vfio-pci
sleep 1
# Detach the GPU from drivers and attach to vfio. Also the usb.
echo $videoid > /sys/bus/pci/drivers/vfio-pci/new_id
sleep 1
echo $videobusid > /sys/bus/pci/devices/$videobusid/driver/unbind
sleep 1
echo $videobusid > /sys/bus/pci/drivers/vfio-pci/bind
sleep 1
echo $videoid > /sys/bus/pci/drivers/vfio-pci/remove_id
sleep 1
echo $audioid > /sys/bus/pci/drivers/vfio-pci/new_id
sleep 1
echo $audiobusid > /sys/bus/pci/devices/$audiobusid/driver/unbind
sleep 1
echo $audiobusid > /sys/bus/pci/drivers/vfio-pci/bind
sleep 1
echo $audioid > /sys/bus/pci/drivers/vfio-pci/remove_id
sleep 1
echo $usbid > /sys/bus/pci/drivers/vfio-pci/new_id
sleep 1
echo $usbbusid > /sys/bus/pci/devices/$usbbusid/driver/unbind
sleep 1
echo $usbbusid > /sys/bus/pci/drivers/vfio-pci/bind
sleep 1
echo $usbid > /sys/bus/pci/drivers/vfio-pci/remove_id
#ls -la /sys/bus/pci/devices/$usbbusid/
sleep 1
# QEMU (VM) command
qemu-system-x86_64 -runas yu -enable-kvm \
-nographic -vga none -parallel none -serial none \
-enable-kvm \
-m $RAM \
-cpu host,kvm=off,hv_relaxed,hv_spinlocks=0x1fff,hv_time,hv_vapic,hv_vendor_id=0xDEADBEEFFF \
-rtc clock=host,base=localtime \
-smp $CORES,sockets=1,cores=$CORES,threads=0 \
-device vfio-pci,host=$IOMMU_GPU,multifunction=on,x-vga=on,romfile=$VBIOS \
-device vfio-pci,host=$IOMMU_GPU_AUDIO \
-device vfio-pci,host=$IOMMU_USB \
-device virtio-net-pci,netdev=n1 \
-netdev user,id=n1 \
-drive if=pflash,format=raw,readonly,file=$OVMF_CODE \
-drive media=cdrom,file=$WIN10,id=virtiocd1,if=none \
-device ide-cd,bus=ide.1,drive=virtiocd1 \
-drive media=cdrom,file=$VIRTIO,id=virtiocd2,if=none \
-device ide-cd,bus=ide.1,drive=virtiocd2 \
-device virtio-scsi-pci,id=scsi0 \
-device scsi-hd,bus=scsi0.0,drive=rootfs \
-drive id=rootfs,$HDD > /dev/null 2>&1 &
# END QEMU (VM) command
# Wait for QEMU to finish before continue
wait
sleep 5
# Unload the vfio module. I am lazy, this leaves the GPU without drivers
modprobe -r vfio-pci
sleep 2
modprobe -r vfio_iommu_type1
sleep 2
modprobe -r vfio
sleep 2
# Reload the kernel modules. This loads the drivers for the GPU
modprobe snd_hda_intel
sleep 5
modprobe nvidia_drm
sleep 2
modprobe nvidia_modeset
sleep 2
modprobe nvidia
sleep 5
# Bind the usb
#echo $usbid > /sys/bus/pci/drivers/xhci_hcd/new_id
echo $usbbusid > /sys/bus/pci/devices/$usbbusid/driver/unbind
echo $usbbusid > /sys/bus/pci/drivers/xhci_hcd/bind
sleep 10
#echo $usbid > /sys/bus/pci/drivers/xhci_hcd/remove_id
#ls -la /sys/bus/pci/devices/$usbbusid/
# Re-Bind EFI-Framebuffer and Re-bind to virtual consoles
# [Source] [https://github.com/joeknock90/Single-GPU-Passthrough/blob/master/README.md#vm-stop-script]
echo 1 > /sys/class/vtconsole/vtcon0/bind
sleep 1
echo 1 > tee /sys/class/vtconsole/vtcon1/bind
sleep 5
#echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/bind
#sleep 1
# Reload the Display Manager to access X
systemctl start lightdm
sleep 5
# Restore the Frame Buffer
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/bind
sleep 1
# Restore ulimit
ulimit -l $ULIMIT

@ -30,9 +30,15 @@ usbid="1022 145f"
videobusid="0000:06:00.0"
audiobusid="0000:06:00.1"
usbbusid="0000:07:00.3"
ULIMIT=$(ulimit -a | grep "max locked memory" | awk '{print $6}')
# END Variables
# Memory lock limit
if [ $(ulimit -a | grep "max locked memory" | awk '{print $6}') != 12884900 ]; then
ulimit -l 12884900
fi
## Kill X and related
systemctl stop lightdm > /dev/null 2>&1
killall i3 > /dev/null 2>&1
@ -57,6 +63,10 @@ modprobe -r snd_hda_intel
sleep 2
# Load the kernel module
modprobe vfio
sleep 1
modprobe vfio_iommu_type1
sleep 1
modprobe vfio-pci
sleep 1
@ -90,7 +100,7 @@ echo $usbid > /sys/bus/pci/drivers/vfio-pci/remove_id
sleep 1
# QEMU (VM) command
qemu-system-x86_64 -enable-kvm \
qemu-system-x86_64 -runas yu -enable-kvm \
-nographic -vga none -parallel none -serial none \
-enable-kvm \
-m $RAM \
@ -100,6 +110,8 @@ qemu-system-x86_64 -enable-kvm \
-device vfio-pci,host=$IOMMU_GPU,multifunction=on,x-vga=on,romfile=$VBIOS \
-device vfio-pci,host=$IOMMU_GPU_AUDIO \
-device vfio-pci,host=$IOMMU_USB \
-device virtio-net-pci,netdev=n1 \
-netdev user,id=n1 \
-drive if=pflash,format=raw,readonly,file=$OVMF_CODE \
-device virtio-scsi-pci,id=scsi0 \
-device scsi-hd,bus=scsi0.0,drive=rootfs \
@ -113,6 +125,10 @@ sleep 5
# Unload the vfio module. I am lazy, this leaves the GPU without drivers
modprobe -r vfio-pci
sleep 2
modprobe -r vfio_iommu_type1
sleep 2
modprobe -r vfio
sleep 2
# Reload the kernel modules. This loads the drivers for the GPU
modprobe snd_hda_intel
@ -145,5 +161,9 @@ sleep 5
systemctl start lightdm
sleep 5
# Restore the Frame Buffer
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/bind
sleep 1
# Restore ulimit
ulimit -l $ULIMIT

Loading…
Cancel
Save