summaryrefslogtreecommitdiff
path: root/hosts/iroha/libvirt/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/iroha/libvirt/hooks')
-rw-r--r--hosts/iroha/libvirt/hooks/arcade.conf7
-rw-r--r--hosts/iroha/libvirt/hooks/cpuset.conf4
-rwxr-xr-xhosts/iroha/libvirt/hooks/cpuset_release_common.sh1
l---------hosts/iroha/libvirt/hooks/qemu.d/arcade/prepare/begin/cpuset_prepare_common.sh1
-rwxr-xr-xhosts/iroha/libvirt/hooks/qemu.d/arcade/prepare/begin/port_forward.sh14
l---------hosts/iroha/libvirt/hooks/qemu.d/arcade/release/end/cpuset_release_common.sh1
-rwxr-xr-xhosts/iroha/libvirt/hooks/qemu.d/arcade/release/end/port_close.sh14
-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
9 files changed, 38 insertions, 36 deletions
diff --git a/hosts/iroha/libvirt/hooks/arcade.conf b/hosts/iroha/libvirt/hooks/arcade.conf
index 4282629..acbc430 100644
--- a/hosts/iroha/libvirt/hooks/arcade.conf
+++ b/hosts/iroha/libvirt/hooks/arcade.conf
@@ -1,4 +1,3 @@
-VIRSH_GPU_VIDEO=pci_0000_0f_00_0
-VIRSH_GPU_AUDIO=pci_0000_0f_00_1
-VIRSH_USB=pci_0000_03_00_0
-VIRSH_NVME=pci_0000_0e_00_0
+VIRSH_GPU_VIDEO=pci_0000_10_00_0
+VIRSH_GPU_AUDIO=pci_0000_10_00_1
+VIRSH_USB=pci_0000_12_00_3
diff --git a/hosts/iroha/libvirt/hooks/cpuset.conf b/hosts/iroha/libvirt/hooks/cpuset.conf
index d208294..74cb68b 100644
--- a/hosts/iroha/libvirt/hooks/cpuset.conf
+++ b/hosts/iroha/libvirt/hooks/cpuset.conf
@@ -1,6 +1,6 @@
TOTAL_CORES='0-23' # 3900X: 12-core, 24-thread cpu
-HOST_CORES='0-4,12-16'
-VIRT_CORES0='5-11,17-23'
+HOST_CORES='6-11,18-23'
+VIRT_CORES0='0-5,12-17'
MEMNODES='0'
CPUSET_REFCOUNT=/tmp/cpuset-ref
diff --git a/hosts/iroha/libvirt/hooks/cpuset_release_common.sh b/hosts/iroha/libvirt/hooks/cpuset_release_common.sh
index 624fa5b..d30a3d6 100755
--- a/hosts/iroha/libvirt/hooks/cpuset_release_common.sh
+++ b/hosts/iroha/libvirt/hooks/cpuset_release_common.sh
@@ -25,6 +25,7 @@ fi
for i in blkio cpu cpuacct cpuset devices freezer memory net_cls perf_event;
do
rmdir ${CGROUP}/$i/machine/${PARTNAME0}.partition
+ rmdir ${CGROUP}/$i/machine/${PARTNAME1}.partition
done
/bin/echo ${TOTAL_CORES} > ${CPUSET}/machine/cpuset.cpus
diff --git a/hosts/iroha/libvirt/hooks/qemu.d/arcade/prepare/begin/cpuset_prepare_common.sh b/hosts/iroha/libvirt/hooks/qemu.d/arcade/prepare/begin/cpuset_prepare_common.sh
deleted file mode 120000
index fb5a2ab..0000000
--- a/hosts/iroha/libvirt/hooks/qemu.d/arcade/prepare/begin/cpuset_prepare_common.sh
+++ /dev/null
@@ -1 +0,0 @@
-../../../../cpuset_prepare_common.sh \ No newline at end of file
diff --git a/hosts/iroha/libvirt/hooks/qemu.d/arcade/prepare/begin/port_forward.sh b/hosts/iroha/libvirt/hooks/qemu.d/arcade/prepare/begin/port_forward.sh
deleted file mode 100755
index 7d5d484..0000000
--- a/hosts/iroha/libvirt/hooks/qemu.d/arcade/prepare/begin/port_forward.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#! /usr/bin/env bash
-
-# kdeconnect
-iptables -t nat -C PREROUTING -p tcp -s 192.168.1.0/24 --dport 1714:1764 \
- -j DNAT --to-destination 192.168.122.40:1714-1764 || \
-iptables -t nat -A PREROUTING -p tcp -s 192.168.1.0/24 --dport 1714:1764 \
- -j DNAT --to-destination 192.168.122.40:1714-1764
-iptables -t nat -C PREROUTING -p udp -s 192.168.1.0/24 --dport 1714:1764 \
- -j DNAT --to-destination 192.168.122.40:1714-1764 || \
-iptables -t nat -A PREROUTING -p udp -s 192.168.1.0/24 --dport 1714:1764 \
- -j DNAT --to-destination 192.168.122.40:1714-1764
-
-iptables -C FORWARD -m state -d 192.168.122.0/24 --state NEW,RELATED,ESTABLISHED -j ACCEPT || \
-iptables -I FORWARD -m state -d 192.168.122.0/24 --state NEW,RELATED,ESTABLISHED -j ACCEPT
diff --git a/hosts/iroha/libvirt/hooks/qemu.d/arcade/release/end/cpuset_release_common.sh b/hosts/iroha/libvirt/hooks/qemu.d/arcade/release/end/cpuset_release_common.sh
deleted file mode 120000
index d823a60..0000000
--- a/hosts/iroha/libvirt/hooks/qemu.d/arcade/release/end/cpuset_release_common.sh
+++ /dev/null
@@ -1 +0,0 @@
-../../../../cpuset_release_common.sh \ No newline at end of file
diff --git a/hosts/iroha/libvirt/hooks/qemu.d/arcade/release/end/port_close.sh b/hosts/iroha/libvirt/hooks/qemu.d/arcade/release/end/port_close.sh
deleted file mode 100755
index 0d58fa7..0000000
--- a/hosts/iroha/libvirt/hooks/qemu.d/arcade/release/end/port_close.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#! /usr/bin/env bash
-
-# kdeconnect (remove)
-iptables -t nat -C PREROUTING -p tcp -s 192.168.1.0/24 --dport 1714:1764 \
- -j DNAT --to-destination 192.168.122.40:1714-1764 || \
-iptables -t nat -D PREROUTING -p tcp -s 192.168.1.0/24 --dport 1714:1764 \
- -j DNAT --to-destination 192.168.122.40:1714-1764
-iptables -t nat -C PREROUTING -p udp -s 192.168.1.0/24 --dport 1714:1764 \
- -j DNAT --to-destination 192.168.122.40:1714-1764 || \
-iptables -t nat -D PREROUTING -p udp -s 192.168.1.0/24 --dport 1714:1764 \
- -j DNAT --to-destination 192.168.122.40:1714-1764
-
-iptables -C FORWARD -m state -d 192.168.122.0/24 --state NEW,RELATED,ESTABLISHED -j ACCEPT || \
-iptables -D FORWARD -m state -d 192.168.122.0/24 --state NEW,RELATED,ESTABLISHED -j ACCEPT
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