Add support for virtio-9p

This commit is contained in:
Martin Wimpress 2021-09-29 03:30:16 +01:00
parent d63a57a26f
commit 01fca96f28
No known key found for this signature in database
GPG Key ID: 61DF940515E06DA3
2 changed files with 21 additions and 2 deletions

View File

@ -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.
* <https://turlucode.com/qemu-command-line-args/>
* <https://github.com/pbatard/Fido>
* 9p & virtiofs
* <https://wiki.qemu.org/Documentation/9p>
* <https://wiki.qemu.org/Documentation/9psetup>
* <https://www.linux-kvm.org/page/9p_virtio>
* <https://www.kraxel.org/blog/2019/06/macos-qemu-guest/>
* <https://superuser.com/questions/628169/how-to-share-a-directory-with-the-host-without-networking-in-qemu>
* <https://virtio-fs.gitlab.io/>

View File

@ -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