From 01fca96f283c984d91fe8cabad891b6a40d205f3 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Wed, 29 Sep 2021 03:30:16 +0100 Subject: [PATCH] Add support for virtio-9p --- README.md | 4 ++-- quickemu | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0f6468d..364bd24 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,7 @@ There are some considerations when running macOS via Quickemu. * `vmxnet3` network device is used. * USB host pass-through is limited to UHCI (USB 2.0) * Display resolution can only be changed via macOS System Preferences. + * File sharing between guest and host is available via [virtio-9p](https://wiki.qemu.org/Documentation/9psetup). * **SPICE has limited supported on macOS**: * Copy/paste via SPICE agent is not available. * File sharing via SPICE webdavd is not available. @@ -417,7 +418,6 @@ used the 1920x1080 monitor which results in a window size of 1664x936. # TODO - - [ ] Add 9p support - [ ] Add `spice-app` support via `virt-viewer`; *requires `virt-viewer` 8.0 or newer* - [ ] Add support for `ignore_msrs` for macOS. `echo "options kvm ignore_msrs=Y" >> /etc/modprobe.d/kvm.conf && update-initramfs -k all -u` - [ ] Add discrete GPU pass-through @@ -447,8 +447,8 @@ Useful reference that assisted the development of Quickemu. * * * 9p & virtiofs + * * - * * * * diff --git a/quickemu b/quickemu index e2f56ff..d3d0eaa 100755 --- a/quickemu +++ b/quickemu @@ -467,6 +467,17 @@ function vm_boot() { if [ "${guest_os}" != "macos" ]; then echo " - WebDAV: ${PUBLIC} via: dav://localhost:9843/" fi + + if [ "${guest_os}" != "windows" ]; then + echo -n " - 9P: ${PUBLIC} via: " + if [ "${guest_os}" == "linux" ]; then + echo "sudo mount -t 9p -o trans=virtio,version=9p2000.L,msize=104857600 ${USER}-public ~/Public" + elif [ "${guest_os}" == "macos" ]; then + # PUBLICSHARE needs to be world writeable for seamless integration with + # macOS. Test if it is is world writeable, and prompt what to do if not. + echo "sudo mount_9p ${USER}-public" + fi + fi fi enable_usb_passthrough @@ -565,6 +576,14 @@ function vm_boot() { -object rng-random,id=rng0,filename=/dev/urandom) fi + # https://wiki.qemu.org/Documentation/9psetup + # https://askubuntu.com/questions/772784/9p-libvirt-qemu-share-modes + if [ "${guest_os}" != "windows" ]; then + # shellcheck disable=SC2054 + args+=(-fsdev local,id=fsdev0,path="${PUBLIC}",security_model=mapped-xattr + -device virtio-9p-pci,fsdev=fsdev0,mount_tag="${USER}-public") + fi + if [ -n "${USB_PASSTHROUGH}" ]; then # shellcheck disable=SC2054,SC2206 args+=(-device ${USB_HOST_PASSTHROUGH_CONTROLLER},id=hostpass