All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shreyansh Chouhan <chouhan.shreyansh2702@gmail.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Subject: Re: Fwd: VirtioSound device emulation implementation
Date: Thu, 28 Jan 2021 23:04:01 +0530	[thread overview]
Message-ID: <CAAQ-SiOU5vkcVODOvBEf=PXzRDQbhzJC6ZU3wLpnRzhD58cuGg@mail.gmail.com> (raw)
In-Reply-To: <20210128163001.jjptft2t5fbdlvyn@sirius.home.kraxel.org>

[-- Attachment #1: Type: text/plain, Size: 3758 bytes --]

On Thu, 28 Jan 2021 at 22:00, Gerd Hoffmann <kraxel@redhat.com> wrote:

> On Thu, Jan 28, 2021 at 09:20:31PM +0530, Shreyansh Chouhan wrote:
> > (Gerd, I wasn't able to get gmail to quote your email, so I have just
> copy
> > pasted the relavant parts.)
> >
> > > Yes.  net_conf is common config (backend, mac address, maybe more) for
> > > network devices.  For sound devices that would audiodev (link the
> device
> > > to a backend which then handles alsa/pulse/jack/oss/sdl/whatever).
> >
> > Ah I see, so the net_conf corresponds to audiodev?
>
> Oops.  Confused that.  nic_conf (struct NICConf) is the common config
> for all network devices, not net_conf.
>
> See DEFINE_NIC_PROPERTIES() in include/net/net.h
>
> NICConf.peers (exposed as "netdev" property) links the emulated device
> (frontend) to a netdev (backend) which actually processes the packets
> sent by the guest.
>
> In a simliar way the audiodev property links the emulated audio device
> to a backend which handles the host-side audio playback using alsa,
> pulseaudio or something else.
>
> > I thought it would correspond to `virtio_snd_conf`. So as alex said,
> > `virtio_snd_conf` is the front end configuration.
>
> Correct.
>
> The backend is configured separately, i.e.
>
>   -netdev user,id=net0,$moreargs
>
> or
>
>   -audiodev alsa,id=snd0,$moreargs
>
> Then the two are linked by id, i.e.
>
>   -device virtio-net-pci,netdev=net0
>
> or
>
>   -device virtio-sound-pci,audiodev=snd0
>

Ah ha! So `virtio-snd-conf` corresponds to the `-device` configuration
and `audiodev` to the backend configuration. I think the audio code
now makes more sense to me. I will give it another read.

> > The only thing really required is the audiodev property.  Everything
> > > else can be hard-coded initially, and once the basics are working
> > > refined (like adding properties for jack labels, ...).
> >
> > So in the realize function I set up the audiodev, right? Also in that
> case
> > why the difference between the net and sound devices? In the net
> > device we set up the common config in net_conf. Does the net_conf
> > somehow later sets up NetDev too?
> >
> > And what is a NetClientState? Is the NetClient the emulated guest? This
> > confuses me a lot. I can't understand what will be the parellel audio
> device
> > property.
>
> Not fully sure what NetClientState is, I guess it is shared struct for
> both frontend and backend to manage the connection state.
>
> The audio subsystem has simliar structs, SWVoiceIn and SWVoiceOut for
> example.  There also is QEMUSoundCard.  I'd suggest to check out the
> source code of other audio devices for code examples.
>
I will read it and revert back if I have any queries.

>
> > Also I can't seem to find where we parse the command line options
> > passed to qemu.  The code structure is a bit different from what I had
> > expected. In virtio_net_device_realize we set duplex to half or full
> > depending on the value of the net_conf.duplex_str. But I couldn't find
> > where we actually set it.
>
> See virtio_net_properties[].  There is a line in the array:
>
>     DEFINE_PROP_STRING("duplex", VirtIONet, net_conf.duplex_str),
>
I thought this just declared a property, and didn't set it. But now that in
retrospect
we already declared the variable when we defined the struct so that doesn't
make
sense.

>
> And the whole array is registered using:
>
>    device_class_set_props(dc, virtio_net_properties);
>
> That is enough to make those properties work, the qemu core handles
> everything for you.  See hw/core/qdev-properties.c if you are curious,
> but you can also just consider that a black box at service for you ;)
>
I think I will give it a quick look :P

>
> take care,
>   Gerd
>
> Thanks a lot!
--
Shreyansh

[-- Attachment #2: Type: text/html, Size: 5193 bytes --]

  reply	other threads:[~2021-01-28 17:37 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 10:00 VirtioSound device emulation implementation Shreyansh Chouhan
2021-01-06 11:40 ` Alex Bennée
2021-01-07 14:58   ` Shreyansh Chouhan
2021-01-07 15:58     ` Gerd Hoffmann
2021-01-07 17:17     ` Alex Bennée
2021-01-08  7:53       ` Shreyansh Chouhan
2021-01-08  8:34       ` Gerd Hoffmann
2021-01-10  8:25         ` Shreyansh Chouhan
     [not found]           ` <CAAQ-SiPiq5NQN=2mvP3isZ9PtYO2Bu64kVEvE6T+3OJd5B-U5A@mail.gmail.com>
2021-01-11  6:29             ` Fwd: " Shreyansh Chouhan
2021-01-11 11:59               ` Alex Bennée
2021-01-14 15:00                 ` Shreyansh Chouhan
2021-01-14 17:41                   ` Alex Bennée
2021-01-15  8:00                     ` Shreyansh Chouhan
2021-01-17 10:30                       ` Shreyansh Chouhan
2021-01-18 18:53                         ` Shreyansh Chouhan
2021-01-20 11:41                           ` Shreyansh Chouhan
2021-01-25  6:02                             ` Shreyansh Chouhan
2021-01-25 11:23                               ` Alex Bennée
2021-01-28  4:28                                 ` Shreyansh Chouhan
2021-01-28 10:42                                   ` Alex Bennée
2021-01-28 15:40                                     ` Shreyansh Chouhan
2021-01-28 11:25                                   ` Gerd Hoffmann
2021-01-28 15:50                                     ` Shreyansh Chouhan
2021-01-28 16:30                                       ` Gerd Hoffmann
2021-01-28 17:34                                         ` Shreyansh Chouhan [this message]
2021-02-11  4:59                                           ` Shreyansh Chouhan
2021-02-15 14:39                                             ` Gerd Hoffmann
2021-04-04 13:55                                               ` Shreyansh Chouhan
2021-04-16 11:32                                                 ` Gerd Hoffmann
2021-04-19 12:30                                                   ` Shreyansh Chouhan
2021-04-19 12:33                                                     ` Shreyansh Chouhan
2021-04-19 13:10                                                     ` Gerd Hoffmann
     [not found]                                                       ` <CAAQ-SiMf=BV-HUudRayZkRPJjmkYWuiBuKqYHHLzYjcFnPOgLQ@mail.gmail.com>
     [not found]                                                         ` <20210419135627.dlerwnswhfxt6ciz@sirius.home.kraxel.org>
     [not found]                                                           ` <CAAQ-SiM6uWUgHTS5PQ-hSkuXNOoKC7fw6Y1ZHhJ0MCUE3oaBqg@mail.gmail.com>
     [not found]                                                             ` <20210420071304.gmndase3r6mwp5yt@sirius.home.kraxel.org>
     [not found]                                                               ` <CAAQ-SiPPNK0xqnPPSjNZgwQCs+Vj0_A5koq5xK8HzhZKDgqVJw@mail.gmail.com>
2021-12-29  5:52                                                                 ` Shreyansh Chouhan
2022-01-20 10:39                                                                   ` Laurent Vivier
2022-02-07  4:06                                                                     ` Shreyansh Chouhan
2022-02-08 17:26                                                                       ` Shreyansh Chouhan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAQ-SiOU5vkcVODOvBEf=PXzRDQbhzJC6ZU3wLpnRzhD58cuGg@mail.gmail.com' \
    --to=chouhan.shreyansh2702@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.