From 8f59167bdcf53156511041b844ff79a69476f328 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Tue, 31 Aug 2021 09:37:23 +0200 Subject: [qemu] Change permissions of PCI passthrough devices for QEMU user session --- core/modules/qemu/data/opt/openslx/scripts/systemd-qemu_env | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 -- cgit v1.2.3-55-g7522