Skip to contentSkip to conversation

virtio-snd: add virtio sound device specification

PATCH Superseded Anton Yakovlev 2 participants 5 messages Mar 11, 2020 – Mar 17, 2020

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v7 1/1 virtio-snd: add virtio sound device specification

This patch proposes virtio specification for a new virtio sound device, that may be useful in case when having audio is required but a device passthrough or emulation is not an option.

---

v6 -> v7 changes:
1. Add more detailed rationale of relationships with the High Definition Audio specification.
2. Rework jack configuration structure, now it's more aligned with the HDA spec.
3. Extend explanation of the VIRTIO_SND_PCM_F_MSG_POLLING feature.

 conformance.tex  |  32 ++-
 content.tex      |   1 +
 introduction.tex |   3 +
 virtio-sound.tex | 729 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 762 insertions(+), 3 deletions(-)
 create mode 100644 virtio-sound.tex
conformance.tex +29 -3
index b6fdec0..4de3317 100644
@@ -15,7 +15,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
   \begin{itemize}
     \item Clause \ref{sec:Conformance / Driver Conformance}.
     \item One of clauses \ref{sec:Conformance / Driver Conformance / PCI Driver Conformance}, \ref{sec:Conformance / Driver Conformance / MMIO Driver Conformance} or \ref{sec:Conformance / Driver Conformance / Channel I/O Driver Conformance}.
-    \item One of clauses \ref{sec:Conformance / Driver Conformance / Network Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Block Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Console Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Entropy Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Traditional Memory Balloon Driver Conformance}, \ref{sec:Conformance / Driver Conformance / SCSI Host Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Input Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Crypto Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Socket Driver Conformance} or \ref{sec:Conformance / Driver Conformance / IOMMU Driver Conformance}.
+    \item One of clauses \ref{sec:Conformance / Driver Conformance / Network Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Block Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Console Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Entropy Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Traditional Memory Balloon Driver Conformance}, \ref{sec:Conformance / Driver Conformance / SCSI Host Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Input Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Crypto Driver Conformance}, \ref{sec:Conformance / Driver Conformance / Socket Driver Conformance}, \ref{sec:Conformance / Driver Conformance / IOMMU Driver Conformance} or \ref{sec:Conformance / Driver Conformance / Sound Driver Conformance}.
     \item Clause \ref{sec:Conformance / Legacy Interface: Transitional Device and Transitional Driver Conformance}.
   \end{itemize}
 \item[Device] A device MUST conform to four conformance clauses:
@@ -32,8 +32,9 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \ref{sec:Conformance / Device Conformance / Input Device Conformance}, 
 \ref{sec:Conformance / Device Conformance / Crypto Device Conformance}, 
 \ref{sec:Conformance / Device Conformance / Socket Device Conformance}, 
-\ref{sec:Conformance / Device Conformance / RPMB Device Conformance} or 
-\ref{sec:Conformance / Device Conformance / IOMMU Device Conformance}.
+\ref{sec:Conformance / Device Conformance / RPMB Device Conformance},
+\ref{sec:Conformance / Device Conformance / IOMMU Device Conformance} or
+\ref{sec:Conformance / Device Conformance / Sound Device Conformance}.
     \item Clause \ref{sec:Conformance / Legacy Interface: Transitional Device and Transitional Driver Conformance}.
   \end{itemize}
 \end{description}
@@ -220,6 +221,17 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \item \ref{drivernormative:Device Types / IOMMU Device / Device operations / Fault reporting}
 \end{itemize}
 
+\conformance{\subsection}{Sound Driver Conformance}\label{sec:Conformance / Driver Conformance / Sound Driver Conformance}
+
+A sound driver MUST conform to the following normative statements:
+
+\begin{itemize}
+\item \ref{drivernormative:Device Types / Sound Device / Device Initialization}
+\item \ref{drivernormative:Device Types / Sound Device / Device Operation / PCM Stream Parameters}
+\item \ref{drivernormative:Device Types / Sound Device / Device Operation / PCM Output Stream}
+\item \ref{drivernormative:Device Types / Sound Device / Device Operation / PCM Input Stream}
+\end{itemize}
+
 \conformance{\section}{Device Conformance}\label{sec:Conformance / Device Conformance}
 
 A device MUST conform to the following normative statements:
@@ -408,6 +420,20 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \item \ref{devicenormative:Device Types / IOMMU Device / Device operations / Fault reporting}
 \end{itemize}
 
+\conformance{\subsection}{Sound Device Conformance}\label{sec:Conformance / Device Conformance / Sound Device Conformance}
+
+A sound device MUST conform to the following normative statements:
+
+\begin{itemize}
+\item \ref{devicenormative:Device Types / Sound Device / Device Initialization}
+\item \ref{devicenormative:Device Types / Sound Device / Device Operation / Jack Configuration}
+\item \ref{devicenormative:Device Types / Sound Device / Device Operation / PCM Stream Configuration}
+\item \ref{devicenormative:Device Types / Sound Device / Device Operation / PCM Stream Parameters}
+\item \ref{devicenormative:Device Types / Sound Device / Device Operation / PCM Stream Release}
+\item \ref{devicenormative:Device Types / Sound Device / Device Operation / PCM Output Stream}
+\item \ref{devicenormative:Device Types / Sound Device / Device Operation / PCM Input Stream}
+\end{itemize}
+
 \conformance{\section}{Legacy Interface: Transitional Device and Transitional Driver Conformance}\label{sec:Conformance / Legacy Interface: Transitional Device and Transitional Driver Conformance}
 A conformant implementation MUST be either transitional or
 non-transitional, see \ref{intro:Legacy
content.tex +1 -0
index b91a132..edab0ca 100644
@@ -6062,6 +6062,7 @@ \subsubsection{Legacy Interface: Framing Requirements}\label{sec:Device
 \input{virtio-fs.tex}
 \input{virtio-rpmb.tex}
 \input{virtio-iommu.tex}
+\input{virtio-sound.tex}
 
 \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
 
introduction.tex +3 -0
index 33da3ec..07674f8 100644
@@ -66,6 +66,9 @@ \section{Normative References}\label{sec:Normative References}
         \phantomsection\label{intro:eMMC}\textbf{[eMMC]} &
         eMMC Electrical Standard (5.1), JESD84-B51,
         \newline\url{http://www.jedec.org/sites/default/files/docs/JESD84-B51.pdf}\\
+	\phantomsection\label{intro:HDA}\textbf{[HDA]} &
+	High Definition Audio Specification,
+	\newline\url{https://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/high-definition-audio-specification.pdf}\\
 
 \end{longtable}
 
virtio-sound.tex new file +729 -0

729 lines not on this page · raw message

Signature · 6 lines
2.25.1


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#1 lore raw

Hi,

Quoted 1 line

2. Rework jack configuration structure, now it's more aligned with the HDA spec.

Yep, that looks good.

Quoted 2 lines

+\item[\field{hda_fn_nid}] indicates a functional node identifier +(see \hyperref[intro:HDA]{HDA}, section 7.1.2).

How is the nid used?

In general some of the defconf and caps fields might need some clarification if and how they are used, given we just cherry-pick some items from the HDA spec ...

Quoted 2 lines

+\item[\field{hda_reg_caps}] indicates a pin capabilities value +(see \hyperref[intro:HDA]{HDA}, section 7.3.4.9).

... for example:

If the "Presence Detect Capable" bit is set the status is available in the "connected" field.

"VRef Control" is not supported and must be zero.

Quoted 2 lines

+\item[\field{connected}] indicates the current jack connection status +(1 - connected, 0 - disconnected).

cheers,
Gerd

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

#2 lore raw

Hi,

Quoted 10 lines · Gerd Hoffmann
   Hi,
Quoted 1 line

2. Rework jack configuration structure, now it's more aligned with the HDA spec.

Yep, that looks good.

Quoted 2 lines

+\item[\field{hda_fn_nid}] indicates a functional node identifier +(see \hyperref[intro:HDA]{HDA}, section 7.1.2).

How is the nid used?

Since a functional group in HDA links entities of different kinds together, as an example, the linux driver can provide different groups as different PCM devices (and this well aligns with hardware case when streams with different capabilities live in different groups). This may be necessary to reassign the jack, because you need to know which streams are attached to the jacks. In addition, it will allow you to associate device controls with the stream/PCM device.

Quoted 3 lines

In general some of the defconf and caps fields might need some clarification if and how they are used, given we just cherry-pick some items from the HDA spec ...

Yes, I also thought about it. But will this lead to a direct dependence on the HDA specification? If something changes there, we should update here. Therefore, I left these elements transparent and allowed the device/driver to decide on the wise use of these fields.

Quoted 22 lines
Quoted 2 lines

+\item[\field{hda_reg_caps}] indicates a pin capabilities value +(see \hyperref[intro:HDA]{HDA}, section 7.3.4.9).

... for example:

If the "Presence Detect Capable" bit is set the status is available in the "connected" field.

"VRef Control" is not supported and must be zero.

Quoted 2 lines

+\item[\field{connected}] indicates the current jack connection status +(1 - connected, 0 - disconnected).

cheers,
Gerd

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

Signature · 9 lines
Anton Yakovlev
Senior Software Engineer

OpenSynergy GmbH
Rotherstr. 20, 10245 Berlin

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#3 lore raw
Quoted 14 lines · Anton Yakovlev

Hi,

Quoted 10 lines · Gerd Hoffmann
   Hi,
Quoted 1 line

2. Rework jack configuration structure, now it's more aligned with the HDA spec.

Yep, that looks good.

Quoted 2 lines

+\item[\field{hda_fn_nid}] indicates a functional node identifier +(see \hyperref[intro:HDA]{HDA}, section 7.1.2).

How is the nid used?

Quoted 7 lines

Since a functional group in HDA links entities of different kinds together, as an example, the linux driver can provide different groups as different PCM devices (and this well aligns with hardware case when streams with different capabilities live in different groups). This may be necessary to reassign the jack, because you need to know which streams are attached to the jacks. In addition, it will allow you to associate device controls with the stream/PCM device.

Ah, there is virtio_snd_pcm_config.hda_fn_nid. So this is how jacks are associated with streams. Havn't noticed this update before.

Quoted 8 lines
Quoted 3 lines

In general some of the defconf and caps fields might need some clarification if and how they are used, given we just cherry-pick some items from the HDA spec ...

Yes, I also thought about it. But will this lead to a direct dependence on the HDA specification? If something changes there, we should update here. Therefore, I left these elements transparent and allowed the device/driver to decide on the wise use of these fields.

I'm mostly thinking about virtio-sound specific stuff which obviously isn't covered by the HDA spec, like this:

Quoted 2 lines
Quoted 2 lines

If the "Presence Detect Capable" bit is set the status is available in the "connected" field.

Most fields don't need a comment in virtio-sound, things like the jack color should be pretty clear without that.

cheers,
Gerd

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

#4 lore raw

Hi,

Quoted 23 lines · Gerd Hoffmann
Quoted 14 lines · Anton Yakovlev

Hi,

Quoted 10 lines · Gerd Hoffmann
    Hi,
Quoted 1 line

2. Rework jack configuration structure, now it's more aligned with the HDA spec.

Yep, that looks good.

Quoted 2 lines

+\item[\field{hda_fn_nid}] indicates a functional node identifier +(see \hyperref[intro:HDA]{HDA}, section 7.1.2).

How is the nid used?

Quoted 7 lines

Since a functional group in HDA links entities of different kinds together, as an example, the linux driver can provide different groups as different PCM devices (and this well aligns with hardware case when streams with different capabilities live in different groups). This may be necessary to reassign the jack, because you need to know which streams are attached to the jacks. In addition, it will allow you to associate device controls with the stream/PCM device.

Quoted 2 lines

Ah, there is virtio_snd_pcm_config.hda_fn_nid. So this is how jacks are associated with streams. Havn't noticed this update before.

Yes, you are right.

Also, I think we should decouple a chmap from stream configuration and make it as yet one optional module of a functional group. Because now, if a group contains more than one stream, then it's not clear how to
properly provide chmap information.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

In general some of the defconf and caps fields might need some clarification if and how they are used, given we just cherry-pick some items from the HDA spec ...

Quoted 10 lines
Quoted 4 lines

Yes, I also thought about it. But will this lead to a direct dependence on the HDA specification? If something changes there, we should update here. Therefore, I left these elements transparent and allowed the device/driver to decide on the wise use of these fields.

I'm mostly thinking about virtio-sound specific stuff which obviously isn't covered by the HDA spec, like this:

Quoted 2 lines
Quoted 2 lines

If the "Presence Detect Capable" bit is set the status is available in the "connected" field.

I think, the connected field is valid in any case. Since it indicates device presence at the moment of jack initialization. This is done so as not to send unnecessary notification after the virtio device is initialized.

Signature · 9 lines
Anton Yakovlev
Senior Software Engineer

OpenSynergy GmbH
Rotherstr. 20, 10245 Berlin

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]