Skip to content

Commit d045ab6

Browse files
virtio-msg: rework transport revision
Rework the transport revision and maximum message size section to switch to normative declarations. Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
1 parent 84b894d commit d045ab6

1 file changed

Lines changed: 51 additions & 31 deletions

File tree

transport-msg.tex

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -148,30 +148,49 @@ \subsubsection{Transport Revisions and Maximum Message Size}
148148
Each \textbf{virtio-msg bus instance} advertises the following to the transport
149149
layer:
150150
\begin{itemize}
151-
\item A \textbf{transport revision} indicating the protocol version it
152-
supports. This revision is separate from the overall Virtio
153-
specification version.
154-
\item A \textbf{maximum message size} representing the largest payload
155-
(in bytes) the bus can reliably carry per request or response.
156-
\item A \textbf{feature bits} indicating a list of revision specific
157-
optional features that are supported or not by the bus instance.
151+
\item \textbf{Transport revision}: the protocol version supported by the bus
152+
instance (independent of the overall Virtio specification version).
153+
\item \textbf{Maximum message size}: the largest payload (in bytes) that can
154+
be carried per request or response, including the common header.
155+
\item \textbf{Transport feature bits}: revision-specific optional features
156+
implemented by the bus instance.
158157
\end{itemize}
159158

160-
These parameters MAY vary between bus instances within the same system.
161-
The bus implementation obtains a bus's revision, maximum message size and list
162-
of features through an \emph{implementation-defined} mechanism, which could be:
159+
The mechanism for obtaining these parameters is implementation-defined and can
160+
vary between bus instances. Common approaches include:
163161
\begin{itemize}
164-
\item A device tree or firmware method providing bus configuration,
165-
\item A message exchange during bus setup,
166-
\item A per bus instance list of properties,
167-
\item A static definition built into the driver for a known environment.
162+
\item Reading firmware or device-tree data that describes each bus instance,
163+
\item Performing a message exchange during bus setup to retrieve the values,
164+
\item Relying on per-bus configuration structures or driver-specific defaults.
168165
\end{itemize}
169166

170-
After learning these parameters, the transport layer MUST respect them
171-
for all messages involving that bus instance. For example, it MUST NOT
172-
send a message exceeding the \textbf{maximum message size}, and it MUST
173-
avoid using advanced features or messages unavailable in the bus's advertised
174-
\textbf{transport revision}.
167+
\busnormative{\paragraph}{Advertising Transport Parameters}{Virtio Transport Options / Virtio Over Messages / Basic Concepts / Revisions / Advertising Transport Parameters}
168+
\begin{itemize}
169+
\item Each bus instance MUST make its transport revision, maximum message
170+
size, and transport feature bits available to the virtio-msg transport
171+
before any transport messages are exchanged for that device.
172+
\item A bus instance MUST apply the same limits to both driver-originated and
173+
device-originated transport messages; if the values change, the bus
174+
MUST inform the transport layer before accepting additional messages.
175+
\end{itemize}
176+
177+
\drivernormative{\paragraph}{Respecting Bus Limits (Driver)}{Virtio Transport Options / Virtio Over Messages / Basic Concepts / Revisions / Driver Limits}
178+
\begin{itemize}
179+
\item A driver MUST NOT send a transport message whose total size exceeds the
180+
maximum message size advertised for the target bus instance.
181+
\item A driver MUST NOT rely on transport features or messages that require a
182+
higher transport revision than the bus instance reports.
183+
\end{itemize}
184+
185+
\devicenormative{\paragraph}{Respecting Bus Limits (Device)}{Virtio Transport Options / Virtio Over Messages / Basic Concepts / Revisions / Device Limits}
186+
\begin{itemize}
187+
\item A device MUST ensure its responses and device-originated messages do
188+
not exceed the maximum message size advertised by the bus instance that
189+
relays them.
190+
\item A device MUST NOT require transport features or messages beyond the
191+
transport revision reported by the bus instance, and MUST respond with
192+
an error or ignore requests for unsupported features.
193+
\end{itemize}
175194

176195
\paragraph{virtio-msg revisions}
177196

@@ -188,21 +207,22 @@ \subsubsection{Transport Revisions and Maximum Message Size}
188207
Note that a change in the virtio standard does not necessarily
189208
correspond to a change in the virtio-msg revision.
190209

191-
The maximum message size is from the common transport level point of
192-
view and includes the headers and payload described here. If the bus adds its
193-
own overhead (e.x. its own header) this is not included in the maximum message
194-
size. The maximum useful message size is currently expected to be 274.
195-
This value is large enough to support a GET_CONFIG or SET_CONFIG message with a
196-
configuration data payload of 256 bytes.
210+
The maximum message size is specified from the transport-layer point of view
211+
and includes the 8-byte common header plus payload. Any extra encapsulation
212+
imposed by the underlying bus (for example, a framing header) does not count
213+
against this limit. Today the maximum useful transport payload is expected to
214+
be 274 bytes, which is sufficient for a GET_CONFIG or SET_CONFIG transfer with
215+
256 bytes of configuration data.
197216

198217
\paragraph{Versioning and Forward Compatibility}
199218

200-
A higher transport \textbf{transport revision} or additional \textbf{feature
201-
bits} MAY extend the protocol with new messages or capabilities. However,
202-
to remain compliant with earlier revisions, devices and drivers SHOULD
203-
continue to honor the mandatory messages and semantics from prior revisions. If
204-
a bus instance or device does not support an advanced feature, it SHOULD
205-
reject or ignore those requests rather than undefined behavior.
219+
A higher transport revision or additional transport feature bits extend the
220+
protocol with new messages or capabilities. Implementations are expected to
221+
remain interoperable across revisions: devices and drivers designed for a newer
222+
revision still implement the mandatory messages and semantics defined in prior
223+
revisions. When a bus instance, driver, or device encounters an unsupported
224+
message or feature, it should reject the request explicitly or ignore it rather
225+
than exhibit undefined behavior.
206226

207227
\subsubsection{Device Numbers and Enumeration}
208228
\label{sec:Virtio Transport Options / Virtio Over Messages / Basic Concepts /

0 commit comments

Comments
 (0)