From 348d40005c9df7d8a1b22397bb591567e0ed7d44 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Tue, 31 Aug 2021 09:32:15 +0200 Subject: [qemu] Fix issues in PCI passthrough setup scripts --- .../vmchooser/plugins/qemukvm/includes/passthrough-pci.inc | 6 +----- .../opt/openslx/vmchooser/plugins/qemukvm/run-virt.include | 11 ++++++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/passthrough-pci.inc b/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/passthrough-pci.inc index c0ab8cbb..86e9c37c 100644 --- a/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/passthrough-pci.inc +++ b/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/passthrough-pci.inc @@ -19,7 +19,7 @@ function passthrough_pci_enabled() { local passthrough_iommu="$(kernel_cmdln_parse_option "iommu")" local passthrough_pci_ids=($(kernel_cmdln_parse_pci_ids)) - if [ "${passthrough_iommu}" == "pt" ] && ["${#passthrough_pci_ids[@]}" -gt 0 ]; then + if [ "${passthrough_iommu}" == "pt" ] && [ "${#passthrough_pci_ids[@]}" -gt 0 ]; then return 0 else return 1 @@ -63,8 +63,6 @@ function passthrough_pci_setup() { return 1; fi - writelog "Passthrough of PCI devices is enabled successfully" - # parse PCI-IDs from the kernel command line local passthrough_pci_ids=($(kernel_cmdln_parse_pci_ids)) @@ -75,8 +73,6 @@ function passthrough_pci_setup() { device_pci_address="$(passthrough_pci_lookup_address "${device_vendor_id}")" if [ "${?}" -eq 0 ]; then pt_gpu_pci_ids+=("${device_vendor_id},${device_pci_address}") - else - writelog "Failed to lookup PCI address for '${device_vendor_id}'" fi done diff --git a/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/run-virt.include b/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/run-virt.include index d61ff97d..fd251f04 100644 --- a/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/run-virt.include +++ b/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/run-virt.include @@ -43,14 +43,15 @@ run_plugin() { fi # setup GPU passthrough and obtain PCI addresses and IDs if passthrough is enabled - local pt_gpu_pci_ids=($(passthrough_pci_setup)) + pt_gpu_pci_ids=($(passthrough_pci_setup)) + if [ "${?}" -ne 0 ]; then + writelog "Failed to set up PCI devices for GPU passthrough!" + fi # setup GPU mediated device passthrough and obtain mediated device address pt_gpu_mdev_id="$(passthrough_mdev_setup)" - if [ "${?}" -eq 0 ]; then - writelog "Mediated device (${pt_gpu_mdev_id}) is set up for passthrough successfully." - else - writelog "Failed to obtain created mediated device UUID!" + if [ "${?}" -ne 0 ]; then + writelog "Failed to set up mediated device (Intel GVT-g) for GPU passthrough!" fi # write finalized config in debug mode to temporary folder for debugging purposes -- cgit v1.2.3-55-g7522