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: Shreyansh Chouhan
Subject: Re: [RFC PATCH 07/27] virtio-snd: Add properties for class init
Date: Wed, 5 May 2021 02:54:06 +0530

On Wed, 5 May 2021 at 02:00, Laurent Vivier <laurent@vivier.eu> wrote:
Hi Shreyansh,

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

You're welcome :) 
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).

Thanks a lot for the detailed explanation. It clarifies everything regarding the separate
pci and device source files and how they are built, which was confusing me a little bit. 
I will fix the meson.build and Kconfig files in the upcoming versions of these patches.

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

reply via email to

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