UTM icon indicating copy to clipboard operation
UTM copied to clipboard

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

Open volkert-fastned opened this issue 1 year ago • 2 comments

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.

volkert-fastned avatar Jun 03 '24 18:06 volkert-fastned

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?

ideologysec avatar Jun 11 '24 19:06 ideologysec

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

volkert-fastned avatar Jun 12 '24 09:06 volkert-fastned

+1

QEMU is currently at version 9.1.0. It would be great to consider an upgrade.

keldonin avatar Sep 13 '24 12:09 keldonin

Completed in 241ab254e66d0378cd53c59ea3c07b42936528f3

osy avatar Oct 04 '24 16:10 osy

@osy With UTM 4.6.2, I can indeed select virtio-sound-device as the Emulated Sound Card.

However, when I select that for a VM running Alpine Linux 3.20 with Linux kernel 6.6.x, it doesn't work.

In dmesg, it complains about the virtio_snd device not being compliant with "spec version 1.0":

~ $ doas dmesg | grep -i virtio_snd
[    0.614678] virtio_snd virtio6: device does not comply with spec
version 1.x
[    0.614727] virtio_snd: probe of virtio6 failed with error -22

Shall I create a new GitHub issue for this?

volkert-fastned avatar Nov 28 '24 10:11 volkert-fastned