qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 07/27] virtio-snd: Add properties for class init


From: Laurent Vivier
Subject: Re: [RFC PATCH 07/27] virtio-snd: Add properties for class init
Date: Tue, 4 May 2021 22:30:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

Hi Shreyansh,

First of all, thank you for your work, I was expecting a virtio sound device 
for some time...

Le 04/05/2021 à 21:35, Shreyansh Chouhan a écrit :
> On Tue, 4 May 2021 at 19:02, Laurent Vivier <laurent@vivier.eu 
> <mailto:laurent@vivier.eu>> wrote:
> 
>     There is nothing specific to PCI in that code, why do you prevent the use 
> of virtio-snd as a MMIO
>     device?
> 
> I am sorry I do not understand your question completely. If by preventing the 
> use of virtio-snd, you
> mean
> why did I add the PCI dependencies to the Kconfig file, then I think I must 
> have been a bit confused
> while writing it. VIRTIO_PCI already includes those dependencies, I will 
> change the dependency to
> VIRTIO. (Which is what it is for other virtio devices too.)
> 
> However if you mean why did I not add an MMIO binding for this device, then 
> there is no
> specific reason. I simply followed what QEMU had been doing for the other 
> virtio devices.
> Will there be any advantages to implementing the device as a MMIO device? 

No, the question was only about the dependencies, generally a a virtio device 
is binded to a virtio
bus, and virtio PCI is a PCI card providing a virtio bus with the virtio device 
attached to it.

For instance, for virtio-net-pci:

HOST

  -> PCI Host controller

    -> PCI virtio net device (TYPE_VIRTIO_NET_PCI)

      -> virtio Bus (TYPE_VIRTIO_BUS)

        -> virtio net device (TYPE_VIRTIO_NET)

TYPE_VIRTIO_NET_PCI is created by hw/virtio/virtio-net-pci.c and 
TYPE_VIRTIO_NET by hw/net/vrtio-net.c:

hw/virtio/meson.build:

virtio_pci_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-net-pci.c'))
virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)

hw/net/meson.build
specific_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-net.c'))

hw/net/Kconfig:

config VIRTIO_NET
    bool
    default y
    depends on VIRTIO

So:

the virtio-net device is built when VIRTIO_NET is set,
the virtio-net-pci device is build when VIRTIO_NET and VIRTIO_PCI are set.

So what I expect for virtio-snd:

hw/virtio/meson.build:

virtio_pci_ss.add(when: 'CONFIG_VIRTIO_SND', if_true: files('virtio-snd-pci.c'))

hw/audio/meson.build:

softmmu_ss.add(when: 'CONFIG_VIRTIO_SND', if_true: files('virtio-snd.c'))

hw/audio/Kconfig

config VIRTIO_SND
    bool
    default y
    depends on VIRTIO

With that kind of config, a machine without PCI bus will be able to create a 
virtio bus to add your
virtio device (like s390x with virtio-ccw of any other MMIO machine like the 
virt machines).

In short: update your hw/audio/config, and all will be fine.

Thanks,
Laurent



reply via email to

[Prev in Thread] Current Thread [Next in Thread]