summaryrefslogtreecommitdiff
path: root/hosts/iroha/libvirt/hooks/qemu.d/corpa
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/iroha/libvirt/hooks/qemu.d/corpa')
-rwxr-xr-xhosts/iroha/libvirt/hooks/qemu.d/corpa/prepare/begin/bind_vfio.sh16
-rwxr-xr-xhosts/iroha/libvirt/hooks/qemu.d/corpa/release/end/unbind_vfio.sh16
2 files changed, 32 insertions, 0 deletions
diff --git a/hosts/iroha/libvirt/hooks/qemu.d/corpa/prepare/begin/bind_vfio.sh b/hosts/iroha/libvirt/hooks/qemu.d/corpa/prepare/begin/bind_vfio.sh
new file mode 100755
index 0000000..3c602c5
--- /dev/null
+++ b/hosts/iroha/libvirt/hooks/qemu.d/corpa/prepare/begin/bind_vfio.sh
@@ -0,0 +1,16 @@
+#! /usr/bin/env bash
+
+source "/etc/libvirt/hooks/arcade.conf"
+
+modprobe -r nvidia-drm
+modprobe -r nvidia-modeset
+modprobe -r nvidia-uvm
+modprobe -r nvidia
+
+modprobe vfio
+modprobe vfio_iommu_type1
+modprobe vfio_pci
+
+virsh nodedev-detach $VIRSH_GPU_VIDEO
+virsh nodedev-detach $VIRSH_GPU_AUDIO
+virsh nodedev-detach $VIRSH_USB
diff --git a/hosts/iroha/libvirt/hooks/qemu.d/corpa/release/end/unbind_vfio.sh b/hosts/iroha/libvirt/hooks/qemu.d/corpa/release/end/unbind_vfio.sh
new file mode 100755
index 0000000..e3b1234
--- /dev/null
+++ b/hosts/iroha/libvirt/hooks/qemu.d/corpa/release/end/unbind_vfio.sh
@@ -0,0 +1,16 @@
+#! /usr/bin/env bash
+
+source "/etc/libvirt/hooks/arcade.conf"
+
+virsh nodedev-reattach $VIRSH_GPU_VIDEO
+virsh nodedev-reattach $VIRSH_GPU_AUDIO
+virsh nodedev-reattach $VIRSH_USB
+
+modprobe -r vfio_pci
+modprobe -r vfio_iommu_type1
+modprobe -r vfio
+
+modprobe nvidia-drm
+modprobe nvidia-modeset
+modprobe nvidia-uvm
+modprobe nvidia