public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: Ethin Probst <harlydavidsen@gmail.com>, Andrew Fish <afish@apple.com>
Cc: Mike Kinney <michael.d.kinney@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	Leif Lindholm <leif@nuviainc.com>,
	"Desimone, Nathaniel L" <nathaniel.l.desimone@intel.com>,
	Rafael Rodrigues Machado <rafaelrodrigues.machado@gmail.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [edk2-devel] VirtIO Sound Driver (GSoC 2021)
Date: Thu, 15 Apr 2021 11:51:32 +0200	[thread overview]
Message-ID: <6b973fc0-e6ee-bca0-ab65-94a0a57633d3@redhat.com> (raw)
In-Reply-To: <CAJQtwF3-REoeETR46BKr0Q6=b6ZHALbeiBBFtp4fEdFxKz8gwA@mail.gmail.com>

On 04/15/21 06:01, Ethin Probst wrote:
> Hi Mike and Andrew,
> 
> Thanks for your responses. I'm looking at the VirtIO block device now
> but will certainly have a look at the others as well. We'll also need
> to define a completely new protocol for audio, as well, as no existing
> protocol will fit the bill. The generic protocol proposed by Andrew
> might work, though I was thinking of a couple modifications: primarily
> that the audio interface will most likely be asynchronous in nature.

EFI_SIMPLE_NETWORK_PROTOCOL is a good design for a request queueing API.
(One limitation that I could mention here is that it does not permit the
queueing of the exact same buffer (= bus adress) multiple times at the
same time, but that's not a grave limitation in practice.) For audio
output inspiration, you could excise the "admin" type member functions,
just focus on the queueing (also ignore Rx, only focus on Tx).

And then I suggest reading "OvmfPkg/VirtioNetDxe/TechNotes.txt", which
explains how EFI_SIMPLE_NETWORK_PROTOCOL is implemented for virtio-net.
It's the most complex of the virtio drivers in OvmfPkg (regarding virtio
exchanges), exactly because it needs to deal with bidirectional async
transfer. You can ignore the Rx direction and just look at Tx.

VirtioLib contains several utility functions. A subset of those
functions is only useful to the simpler (synchronous) virtio drivers,
such as virtio-blk, virtio-scsi, ..., that implement request-response
patterns. Because virtio-net is asynchronous (it does real queueing,
down from the EFI protocol interface), some of the request-response
helper functions in VirtioLib do not apply.

virtio-net is still used with polling; what's important to know is that
it's not the driver itself that performs the repeated checking. The SNP
protocol specifies three members that relate to polling; in all three
cases, the polling is driven from outside of the driver.

Tx polling is performed via EFI_SIMPLE_NETWORK.GetStatus(), it is called
repeatedly by whatever agent is using SNP.

Rx polling is performed either via EFI_SIMPLE_NETWORK.Receive() (called
repeatedly by whatever agent is using SNP), or via the "WaitForPacket"
event. The latter is still polling, only the loop is iternal the
WaitForEvent() boot service. Anyway, Rx should be OK to ignore for now.

Thanks
Laszlo


  parent reply	other threads:[~2021-04-15  9:51 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29 20:28 VirtIO Sound Driver (GSoC 2021) Ethin Probst
2021-03-30  3:17 ` [edk2-devel] " Nate DeSimone
2021-03-30 14:41   ` Ethin Probst
2021-03-31  6:34     ` Nate DeSimone
2021-03-30 21:50 ` Rafael Machado
2021-03-30 22:12   ` Ethin Probst
     [not found]   ` <16713E6D64EE917D.25648@groups.io>
2021-03-31  0:01     ` Ethin Probst
2021-03-31  5:02       ` Andrew Fish
2021-03-31  6:41         ` Nate DeSimone
2021-04-01  5:05           ` Ethin Probst
2021-04-05  4:42             ` Andrew Fish
2021-04-05  4:43               ` Ethin Probst
2021-04-05  5:10                 ` Andrew Fish
2021-04-06 14:16           ` Laszlo Ersek
2021-04-06 15:17             ` Ethin Probst
2021-04-13 12:28               ` Leif Lindholm
2021-04-13 14:16                 ` Andrew Fish
2021-04-13 16:53                   ` Ethin Probst
2021-04-13 21:38                     ` Andrew Fish
2021-04-13 23:47                       ` Ethin Probst
     [not found]                       ` <16758FB6436B1195.32393@groups.io>
2021-04-14  1:20                         ` Ethin Probst
2021-04-14  3:52                           ` Andrew Fish
2021-04-14 20:47                             ` Ethin Probst
2021-04-14 22:30                               ` Michael D Kinney
2021-04-14 23:54                                 ` Andrew Fish
2021-04-15  4:01                                   ` Ethin Probst
2021-04-15  4:58                                     ` Andrew Fish
2021-04-15  5:28                                       ` Ethin Probst
2021-04-15 12:07                                         ` Michael Brown
2021-04-15 16:42                                           ` Andrew Fish
2021-04-15 20:11                                             ` Ethin Probst
2021-04-15 22:35                                               ` Andrew Fish
2021-04-15 23:42                                                 ` Ethin Probst
2021-04-16  0:59                                                   ` Michael Brown
2021-04-16  5:13                                                     ` Andrew Fish
2021-04-16  5:33                                                       ` Ethin Probst
2021-04-16 11:34                                                         ` Leif Lindholm
2021-04-16 17:03                                                           ` Andrew Fish
2021-04-16 17:45                                                             ` Ethin Probst
2021-04-16 17:55                                                               ` Ethin Probst
2021-04-16 18:09                                                                 ` Andrew Fish
2021-04-16 23:50                                                                   ` Ethin Probst
2021-04-16 18:02                                                               ` Andrew Fish
2021-04-17 16:51                                                               ` Marvin Häuser
2021-04-17 17:31                                                                 ` Andrew Fish
2021-04-17 18:04                                                                   ` Marvin Häuser
2021-04-18  8:55                                                                     ` Ethin Probst
2021-04-18 15:22                                                                       ` Andrew Fish
2021-04-18 19:11                                                                         ` Marvin Häuser
2021-04-18 19:22                                                                           ` Marvin Häuser
2021-04-18 21:00                                                                             ` Andrew Fish
2021-04-16 13:22                                                   ` Marvin Häuser
2021-04-16 14:34                                                     ` Andrew Fish
2021-04-16 15:03                                                       ` Marvin Häuser
     [not found]                                                 ` <16762C957671127A.12361@groups.io>
2021-04-16  0:59                                                   ` Ethin Probst
2021-04-16  1:03                                                     ` Michael Brown
2021-04-16  2:06                                                       ` Ethin Probst
2021-04-16  3:48                                                       ` Andrew Fish
2021-04-16  4:29                                                         ` Ethin Probst
2021-04-15  9:51                                     ` Laszlo Ersek [this message]
2021-04-15 16:01                                       ` Andrew Fish
2021-04-04 22:05 ` Marvin Häuser

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-list 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=6b973fc0-e6ee-bca0-ab65-94a0a57633d3@redhat.com \
    --to=devel@edk2.groups.io \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox