summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Bentele2021-08-31 09:37:23 +0200
committerManuel Bentele2021-08-31 09:37:23 +0200
commit8f59167bdcf53156511041b844ff79a69476f328 (patch)
tree9eebe8607bbab00acd11bf6a68dcbb09674c52c5
parent[qemu] Fix issues in PCI passthrough setup scripts (diff)
downloadmltk-8f59167bdcf53156511041b844ff79a69476f328.tar.gz
mltk-8f59167bdcf53156511041b844ff79a69476f328.tar.xz
mltk-8f59167bdcf53156511041b844ff79a69476f328.zip
[qemu] Change permissions of PCI passthrough devices for QEMU user session
-rwxr-xr-xcore/modules/qemu/data/opt/openslx/scripts/systemd-qemu_env13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/modules/qemu/data/opt/openslx/scripts/systemd-qemu_env b/core/modules/qemu/data/opt/openslx/scripts/systemd-qemu_env
index e835a849..144a0faf 100755
--- a/core/modules/qemu/data/opt/openslx/scripts/systemd-qemu_env
+++ b/core/modules/qemu/data/opt/openslx/scripts/systemd-qemu_env
@@ -21,8 +21,21 @@
#
source /opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc
source /opt/openslx/vmchooser/plugins/qemukvm/includes/kernel-cmdln.inc
+source /opt/openslx/vmchooser/plugins/qemukvm/includes/passthrough-pci.inc
source /opt/openslx/vmchooser/plugins/qemukvm/includes/passthrough-mdev.inc
+if passthrough_pci_enabled; then
+ # check if passthrough is configured properly
+ if ! passthrough_pci_check; then
+ slxlog --echo "qemu" "PCI device passthrough is enabled but not setup properly!"
+ exit 1;
+ fi
+
+ # allow access to passthrough IOMMU devices from libvirt-passthrough group
+ chown -R root:libvirt-passthrough /dev/vfio/* || slxlog --echo "qemu" "Could not set owner and group for 'vfio' IOMMU devices!"
+ chmod -R 660 /dev/vfio/* || slxlog --echo "qemu" "Could not change access mode for 'vfio' IOMMU devices!"
+fi
+
if passthrough_mdev_enabled; then
# check if passthrough is configured properly
if ! passthrough_mdev_check; then