mirror of https://gitlab.com/YuriAlek/vfio
Update
parent
d7c8cf7fa9
commit
d4a3f70cb3
@ -0,0 +1,108 @@
|
||||
# A recompilation of hardware and software combinations working for other people
|
||||
|
||||
**Before creating a merge pull, be sure to read this guide**
|
||||
|
||||
The files should be named like [{CPU} - {GPU} - {User}.md]; example
|
||||
```
|
||||
Ryzen 5 2600 - GTX 770 - @YuriAlek.md
|
||||
```
|
||||
|
||||
## Inside must be something like this:
|
||||
### System
|
||||
```
|
||||
[Author]
|
||||
@YuriAlek
|
||||
|
||||
[Hardware]
|
||||
CPU: AMD Ryzen 5 2600
|
||||
Motherboard: Gigabyte AB350M-Gaming 3 rev1.1
|
||||
Motherboard BIOS: F23d
|
||||
RAM: 16GB
|
||||
GPU: Gigabyte Nvidia GeForce GTX 770
|
||||
GPU model: GV-N770OC-2GD
|
||||
GPU BIOS: 80.04.C3.00.0F
|
||||
GPU codename: GK104
|
||||
|
||||
[Software]
|
||||
Linux Distro: ArchLinux
|
||||
Linux Kernel: 4.17.14 vanilla
|
||||
Nvidia divers: 396.51-1
|
||||
QEMU version: 2.12.1-1
|
||||
OVMF version: r24021
|
||||
|
||||
[Guests]
|
||||
Windows 10 Pro 1709 x64
|
||||
MacOS High Sierra 10.13.3
|
||||
```
|
||||
|
||||
### How I did it
|
||||
For extracting the `vBIOS` I used the 1st method in Linux and edited it.
|
||||
|
||||
You can add anything that you consider useful like the step needed in your distro for installing everything. The more information, and solutions, the better.
|
||||
|
||||
### Files to modify
|
||||
#### `scripts/windows.sh`
|
||||
My GPU uses one more Kernel Module so I have to add it as the first module to unload and the last to load:
|
||||
```
|
||||
# Unload the Kernel Modules that use the GPU
|
||||
modprobe -r nvidia_drm
|
||||
sleep 1
|
||||
...
|
||||
------------------------
|
||||
# Reload the kernel modules. This loads the drivers for the GPU
|
||||
...
|
||||
modprobe nvidia_drm
|
||||
sleep 1
|
||||
```
|
||||
|
||||
I use PulseAudio so I had to kill it for detaching the GPU.
|
||||
```
|
||||
## Kill X and related
|
||||
pulseaudio -k
|
||||
---------------------
|
||||
# Reload the Display Manager to access X
|
||||
...
|
||||
pulseaudio --start
|
||||
```
|
||||
|
||||
I don't pass a USB controller so I had to add manually USB devices.
|
||||
```
|
||||
# Remove
|
||||
...
|
||||
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
|
||||
...
|
||||
-device vfio-pci,host=$IOMMU_USB \
|
||||
...
|
||||
echo $usbbusid > /sys/bus/pci/devices/$usbbusid/driver/unbind
|
||||
echo $usbbusid > /sys/bus/pci/drivers/xhci_hcd/bind
|
||||
sleep 10
|
||||
...
|
||||
----------------------
|
||||
# Add to the QEMU script
|
||||
...
|
||||
-object input-linux,id=kbd,evdev=/dev/input/by-id/usb-HOLDCHIP_USB_Gaming_Keyboard-event-kbd,grab_all=on,repeat=on \
|
||||
-object input-linux,id=kbd2,evdev=/dev/input/by-id/usb-HOLDCHIP_USB_Gaming_Keyboard-if01-event-kbd,grab_all=on,repeat=on \
|
||||
-object input-linux,id=mouse-event,evdev=/dev/input/by-id/usb-Logitech_G700_Laser_Mouse_6B5EFC4B0035-event-mouse \
|
||||
-object input-linux,id=kbd3,evdev=/dev/input/by-id/usb-Logitech_G700_Laser_Mouse_6B5EFC4B0035-if01-event-kbd,grab_all=on,repeat=on \
|
||||
...
|
||||
```
|
||||
|
||||
I use an image instead of a hard drive.
|
||||
```
|
||||
# Remove
|
||||
-device virtio-scsi-pci,id=scsi0 \
|
||||
-device scsi-hd,bus=scsi0.0,drive=rootfs \
|
||||
-drive id=rootfs,file=$HDD,media=disk,format=raw,if=none
|
||||
-----------------
|
||||
# Add
|
||||
-device ide-drive,bus=ide.1,drive=rootfs \
|
||||
-drive id=rootfs,if=none,file=$IMG,format=raw
|
||||
```
|
@ -0,0 +1,29 @@
|
||||
# System
|
||||
```
|
||||
[Author]
|
||||
@YuriAlek
|
||||
|
||||
[Hardware]
|
||||
CPU: AMD Ryzen 5 2600
|
||||
Motherboard: Gigabyte AB350M-Gaming 3 rev1.1
|
||||
Motherboard BIOS: F23d
|
||||
RAM: 16GB
|
||||
GPU: Gigabyte Nvidia GeForce GTX 770
|
||||
GPU model: GV-N770OC-2GD
|
||||
GPU BIOS: 80.04.C3.00.0F
|
||||
GPU codename: GK104
|
||||
|
||||
[Software]
|
||||
Linux Distro: ArchLinux
|
||||
Linux Kernel: 4.17.14 vanilla
|
||||
Nvidia divers: 396.51-1
|
||||
QEMU version: 2.12.1-1
|
||||
OVMF version: r24021
|
||||
|
||||
[Guests]
|
||||
Windows 10 Pro 1709 x64
|
||||
MacOS High Sierra 10.13.3
|
||||
```
|
||||
|
||||
## How I did it
|
||||
For extracting the `vBIOS` I used the 2nd method in Linux with nvflash and edited it. The 3rd method also worked for me.
|
@ -0,0 +1,46 @@
|
||||
# Install guide for QEMU and VFIO
|
||||
## ArchLinux
|
||||
### Install the necessary packages
|
||||
```
|
||||
# pacman -S qemu ovmf
|
||||
```
|
||||
|
||||
### Enabling IOMMU support on boot
|
||||
For systemd-boot, edit `/boot/loader/entries/arch.conf` and add `intel_iommu=on` **OR** `amd_iommu=on` and `iommu=pt`.
|
||||
```
|
||||
# AMD
|
||||
options root=/dev/sda2 amd_iommu=on iommu=pt
|
||||
---------------------------------------------
|
||||
# Intel
|
||||
options root=/dev/sda2 intel_iommu=on iommu=pt
|
||||
```
|
||||
|
||||
For GRUB edit `/etc/default/grub` and append your kernel options to the `GRUB_CMDLINE_LINUX_DEFAULT`.
|
||||
```
|
||||
# AMD
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="amd_iommu=on iommu=pt"
|
||||
---------------------------------------------------
|
||||
# Intel
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on iommu=pt"
|
||||
```
|
||||
And then automatically re-generate the grub.cfg file with:
|
||||
```
|
||||
# grub-mkconfig -o /boot/grub/grub.cfg
|
||||
```
|
||||
Reboot.
|
||||
|
||||
After reboot IOMMU should be working
|
||||
```
|
||||
[yu@ryzen ~]$ dmesg | grep -e DMAR -e IOMMU
|
||||
--------------------------------------------
|
||||
[ 0.492684] AMD-Vi: IOMMU performance counters supported
|
||||
[ 0.494370] AMD-Vi: Found IOMMU at 0000:00:00.2 cap 0x40
|
||||
[ 0.494644] perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4 counters/bank).
|
||||
```
|
||||
|
||||
That's everything, unlike two GPU passthrough you don't need to load kernel modules on boot.
|
||||
|
||||
## For more information refer to this guides
|
||||
https://wiki.archlinux.org/index.php/QEMU
|
||||
https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF
|
||||
https://www.se7ensins.com/forums/threads/how-to-setup-a-gaming-virtual-machine-with-gpu-passthrough-qemu-kvm-libvirt-and-vfio.1371980/
|
Loading…
Reference in New Issue