From 78f27075d219f0ad683066393978b1bbeb8ad940 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 19 Sep 2024 21:25:21 -0300 Subject: Fix: increase the maximum number of shared folders --- kvmx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/kvmx b/kvmx index ab599f5..8b5f666 100755 --- a/kvmx +++ b/kvmx @@ -411,9 +411,18 @@ function kvmx_up { # See http://wiki.qemu-project.org/Documentation/9psetup local shared="-fsdev local,id=shared,path=$shared_folder,security_model=none -device virtio-9p-pci,fsdev=shared,mount_tag=shared" elif [ ! -z "$shared_folders" ]; then + # Add a PCI bus for shared filesystems + # See https://www.qemu.org/docs/master/system/device-emulation.html + # https://www.suse.com/support/kb/doc/?id=000019383 + # https://unix.stackexchange.com/questions/588912/add-more-pci-slots-to-virtual-machine + # + # Perhaps could also be implemented with the PXB (PCI Expander Bridge): + # https://github.com/qemu/qemu/blob/master/docs/pci_expander_bridge.txt + local shared_bus="-device pci-bridge,bus=pci.0,addr=5,chassis_nr=1,id=shared.0" + local old_ifs="$IFS" local shared_item - local shared + local shared="$shared_bus" IFS="," for shared_item in $shared_folders; do local id="`echo $shared_item | cut -d ':' -f 1`" @@ -431,7 +440,7 @@ function kvmx_up { mkdir -p $shared_folder shared_folder="`cd $KVMX_PROJECT_FOLDER && cd $shared_folder &> /dev/null && pwd`" - shared="$shared -fsdev local,id=$id,path=$shared_folder,security_model=none${shared_folder_mode} -device virtio-9p-pci,fsdev=$id,mount_tag=$id" + shared="$shared -fsdev local,id=$id,path=$shared_folder,security_model=none${shared_folder_mode} -device virtio-9p-pci,fsdev=$id,mount_tag=$id,bus=shared.0" unset shared_folder unset shared_folder_mountpoint -- cgit v1.2.3