Am 19.10.23 um 12:03 schrieb Emmanouil Pitsidianakis:
> This patch adds a PCI wrapper device for the virtio-sound device.
> It is necessary to instantiate a virtio-snd device in a guest.
> All sound logic will be added to the virtio-snd device in the following
> commits.
>
> To add this device with a guest, you'll need a >=5.13 kernel compiled
> with CONFIG_SND_VIRTIO=y, which at the time of writing most distros have
> off by default.
>
> Use with following flags in the invocation:
>
> Pulseaudio:
>   -audio driver=pa,model=virtio
>   or
>   -audio driver=pa,model=virtio,server=/run/user/1000/pulse/native
> sdl:
>   -audio driver=sdl,model=virtio
> coreaudio (macos/darwin):
>   -audio driver=coreaudio,model=virtio
> etc.
>
> Based-on: 
> https://github.com/OpenSynergy/qemu/commit/5a2f350eec5d157b90d9c7b40a8e603f4da92471
> Reviewed-by: Alex Bennée <alex.ben...@linaro.org>
> Signed-off-by: Igor Skalkin <igor.skal...@opensynergy.com>
> Signed-off-by: Anton Yakovlev <anton.yakov...@opensynergy.com>
> Signed-off-by: Emmanouil Pitsidianakis <manos.pitsidiana...@linaro.org>
> ---
>  MAINTAINERS               |  1 +
>  hw/audio/meson.build      |  1 +
>  hw/audio/virtio-snd-pci.c | 93 +++++++++++++++++++++++++++++++++++++++
>  system/qdev-monitor.c     |  1 +
>  4 files changed, 96 insertions(+)
>  create mode 100644 hw/audio/virtio-snd-pci.c


> diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
> index 1b8005ae55..f007ee6953 100644
> --- a/system/qdev-monitor.c
> +++ b/system/qdev-monitor.c
> @@ -111,6 +111,7 @@ static const QDevAlias qdev_alias_table[] = {
>      { "virtio-serial-device", "virtio-serial", QEMU_ARCH_VIRTIO_MMIO },
>      { "virtio-serial-ccw", "virtio-serial", QEMU_ARCH_VIRTIO_CCW },
>      { "virtio-serial-pci", "virtio-serial", QEMU_ARCH_VIRTIO_PCI},

Hi Manos,

the virtio-sound device alias doesn't work.

> ./qemu-system-x86_64 -machine q35 -device virtio-sound,audiodev=audio0
-audiodev pipewire,id=audio0
qemu-system-x86_64: -device virtio-sound,audiodev=audio0: No
'virtio-bus' bus found for device 'virtio-sound'

This can be fixed if you change

--- a/include/hw/audio/virtio-snd.h
+++ b/include/hw/audio/virtio-snd.h
@@ -21,7 +21,7 @@
 #include "standard-headers/linux/virtio_ids.h"
 #include "standard-headers/linux/virtio_snd.h"
 
-#define TYPE_VIRTIO_SND "virtio-sound"
+#define TYPE_VIRTIO_SND "virtio-sound-device"
 #define VIRTIO_SND(obj) \
         OBJECT_CHECK(VirtIOSound, (obj), TYPE_VIRTIO_SND)
 
in patch 01/11.  The other virtio devices also have a device suffix in
their type name. Additionally I would insert this line

+    { "virtio-sound-device", "virtio-sound", QEMU_ARCH_VIRTIO_MMIO},

here.

With best regards,
Volker

> +    { "virtio-sound-pci", "virtio-sound", QEMU_ARCH_VIRTIO_PCI},
>      { "virtio-tablet-device", "virtio-tablet", QEMU_ARCH_VIRTIO_MMIO },
>      { "virtio-tablet-ccw", "virtio-tablet", QEMU_ARCH_VIRTIO_CCW },
>      { "virtio-tablet-pci", "virtio-tablet", QEMU_ARCH_VIRTIO_PCI },


Reply via email to