|
|
@ -0,0 +1,58 @@ |
|
|
|
--- |
|
|
|
title: "GPU Passthrough with libvirt, qemu, looking glass" |
|
|
|
date: 2021-01-12T22:58:31+02:00 |
|
|
|
draft: true |
|
|
|
--- |
|
|
|
|
|
|
|
## Kernel Configuration |
|
|
|
(from [gentoo wiki][]) |
|
|
|
|
|
|
|
IOMMU Kernel Configuration |
|
|
|
|
|
|
|
``` |
|
|
|
Device Drivers ---> |
|
|
|
[*] IOMMU Hardware Support ---> |
|
|
|
Generic IOMMU Pagetable Support ---- |
|
|
|
[*] AMD IOMMU support |
|
|
|
<*> AMD IOMMU Version 2 driver |
|
|
|
[*] Support for Intel IOMMU using DMA Remapping Devices |
|
|
|
[*] Support for Shared Virtual Memory with Intel IOMMU |
|
|
|
[*] Enable Intel DMA Remapping Devices by default |
|
|
|
[*] Support for Interrupt Remapping |
|
|
|
``` |
|
|
|
|
|
|
|
VFIO Kernel Configuration |
|
|
|
|
|
|
|
``` |
|
|
|
Device Drivers ---> |
|
|
|
<M> VFIO Non-Privileged userpsace driver framework ---> |
|
|
|
[*] VFIO No-IOMMU support ---- |
|
|
|
<M> VFIO support for PCI devices |
|
|
|
[*] VFIO PCI support for VGA devices |
|
|
|
< > Mediated device driver framework |
|
|
|
``` |
|
|
|
|
|
|
|
Rebuild kernel |
|
|
|
|
|
|
|
## GRUB |
|
|
|
Turn on IOMMU in GRUB by editing the file `/etc/default/grub` and add the following parameters. I also put my VFIO parameters here for easy editing: |
|
|
|
|
|
|
|
``` |
|
|
|
# on AMD, switch amd_iommu=pt to amd_iommu=on if pt (passthrough) is not working |
|
|
|
# Switch amd_iommu=pt to intel_iommu=on if you're on Intel chipset |
|
|
|
GRUB_CMD_LINE="... iommu=pt amd_iommu=pt vfio-pci.ids=1002:67df,1002:aaf0" |
|
|
|
``` |
|
|
|
|
|
|
|
## Programs |
|
|
|
|
|
|
|
Make sure qemu is built with SPICE, USB and USB redirection. In adition, make sure libvirt is built with networking capability. In Gentoo, this is accomplished by `USE` flags. In most binary distributions, I think that they are already built with these, but you should make sure. |
|
|
|
|
|
|
|
``` |
|
|
|
echo "app-emulation/qemu spice usb usbredir" >> /etc/portage/package.use/qemu |
|
|
|
echo "app-emulation/libvirt virt-network" >> /etc/portage/package.use/libvirt |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[gentoo wiki]:https://wiki.gentoo.org/wiki/GPU_passthrough_with_libvirt_qemu_kvm#IOMMU |
|
|
|
|