Desktop setup
This commit is contained in:
commit
a7eaa7dbfb
14 changed files with 325 additions and 0 deletions
13
roles/vm/templates/bind_vfio.sh.j2
Normal file
13
roles/vm/templates/bind_vfio.sh.j2
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Load the config file
|
||||
source "/etc/libvirt/hooks/kvm.conf"
|
||||
|
||||
## Load vfio
|
||||
modprobe vfio
|
||||
modprobe vfio_iommu_type1
|
||||
modprobe vfio_pci
|
||||
|
||||
## Unbind gpu from nvidia and bind to vfio
|
||||
virsh nodedev-detach $VIRSH_GPU_VIDEO
|
||||
virsh nodedev-detach $VIRSH_GPU_AUDIO
|
3
roles/vm/templates/kvm.conf.j2
Normal file
3
roles/vm/templates/kvm.conf.j2
Normal file
|
@ -0,0 +1,3 @@
|
|||
## Virsh devices
|
||||
VIRSH_GPU_VIDEO=pci_0000_0c_00_0
|
||||
VIRSH_GPU_AUDIO=pci_0000_0c_00_1
|
13
roles/vm/templates/unbind_vfio.sh.j2
Normal file
13
roles/vm/templates/unbind_vfio.sh.j2
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Load the config file
|
||||
source "/etc/libvirt/hooks/kvm.conf"
|
||||
|
||||
## Unbind gpu from vfio and bind to nvidia
|
||||
virsh nodedev-reattach $VIRSH_GPU_VIDEO
|
||||
virsh nodedev-reattach $VIRSH_GPU_AUDIO
|
||||
|
||||
## Unload vfio
|
||||
modprobe -r vfio_pci
|
||||
modprobe -r vfio_iommu_type1
|
||||
modprobe -r vfio
|
Loading…
Add table
Add a link
Reference in a new issue