utmapp / UTM

Virtual machines for iOS and macOS
https://getutm.app
Apache License 2.0
25.47k stars 1.29k forks source link

Add Virtio sound as a guest sound device option (requires QEMU 8.2.0) #6404

Open volkert-fastned opened 1 month ago

volkert-fastned commented 1 month ago

QEMU 8.2.0 added support for Virtio sound (a.k.a. virtio-snd), a paravirtualized sound device.

With UTM already supporting Virtio for graphics, storage, networking, and memory ballooning, sound support is the only remaining missing thing from the "Virtio suite" that is preventing us from running Linux guests with completely paravirtualized I/O, without the need for hardware emulation (well, except for maybe keyboard and mouse support).

QEMU only recently added host support for the Virtio sound device, namely in version 8.2.0.

It would be nice if UTM could be upgraded to use (at least) this QEMU version and add Virtio sound as a guest sound option. This would potentialy eliminate emulation overhead and lead to smoother audio recording, playback, as well as future-proofing and increased compatibility with QEMU VM images imported from other host systems.

I already performed a search in existing GitHub issues for Virtio sound, and the only thing that came up was this discussion that mentioned the kernel config option CONFIG_SND_VIRTIO, and I believe that the participants of that discussion may not have been aware of the fact that QEMU and UTM did not yet support Virtio sound on the host-side. It did provide a link that implies that Apple's Hypervisor.framework apparently already does have host support for Virtio sound.

ideologysec commented 1 month ago

I believe that QEMU was held back from upgrading due to some issues with display in Windows guests in versions of QEMU >= v8. I am unclear if that was ever resolved, or if there is a plan to upgrade the internal version of QEMU at some point.

However, there is a slightly different issue here as well, which is that UTM uses two different backends, QEMU and Apple Virtualization. Which are you trying to use?

volkert-fastned commented 1 month ago

I'm using the QEMU backend, since the Apple Hypervisor.framework backend was mentioned as being experimental.

QEMU only gained support for Virtio sound in version 8.2.0, whereas Apple's hypervisor/virtualization framework apparently already supports it.

Thanks for mentioning the reason why UTM is still stuck at QEMU 7.2.0. I found the issue and I'm linking it here for reference: https://github.com/utmapp/UTM/issues/5516