@@ -286,41 +286,52 @@ \subsubsection{Endianness}
286286\subsubsection {Common Message Format }
287287\label {sec:Virtio Transport Options / Virtio Over Messages / Basic Concepts / Common Message Format }
288288
289- All virtio-msg exchanges, whether \emph {bus messages } or \emph {transport messages },
290- begin with a shared header that indicates how the recipient should parse the
291- rest of the payload. This header has the following format:
289+ All virtio-msg exchanges, whether \emph {bus messages } or
290+ \emph {transport messages }, begin with an 8 byte header followed by an optional
291+ payload.
292+
293+ The header layout is:
292294\ begin{lstlisting}
293- struct virtio_msg_message {
294- uint8_t type;
295- uint8_t msg_id;
296- uint16_t dev_num;
297- uint16_t msg_size;
298- u8 payload[];
295+ struct virtio_msg_header {
296+ uint8_t type; /* request/response + bus/transport */
297+ uint8_t msg_op; /* message operation code */
298+ uint16_t dev_num; /* device number (0 for bus messages) */
299+ uint16_t msg_uid; /* correlation identifier (0 for events) */
300+ uint16_t msg_size; /* total size: header (8) + payload */
301+ uint8_t payload[];
299302};
300303\end {lstlisting }
301304
302- The fields in this header have the following usage :
305+ Field semantics :
303306\begin {itemize }
304307 \item \field {type}:
305308 \begin {itemize }
306- \item Bit[0]: Identifies if a message is a request (0) or a response
307- to a request (1).
308- \item Bit[1]: Identifies if a message is a Transport Message (0) or a
309- Bus Message (1).
310- \item Bit[2-7] Are reserved for future use and must be zero.
309+ \item Bit[0]: 0=request, 1=response.
310+ \item Bit[1]: 0=Transport Message, 1=Bus Message.
311+ \item Bits[2..7]: \textbf {MUST } be zero; receivers \textbf {MUST } ignore.
311312 \end {itemize }
312- \item \field {msg_id}:
313- Uniquely identifies which message definition applies (e.g., GET_DEVICES,
314- GET_DEVICE_FEATURES, SET_CONFIG). The specific range or enumeration of types is
315- defined in sections \ref {sec:Virtio Transport Options / Virtio Over Messages / Transport Messages }
316- and \ref {sec:Virtio Transport Options / Virtio Over Messages / Bus Messages }.
317- \item \field {dev_num}:
318- Identifies the Device Number the message is targeting or is coming from for
319- Transport Message and must be zero of Bus messages.
320- \item \field {msg_size};
321- Indicates the total length of the message payload including the header.
313+ \item \field {msg_op}: Operation code identifying the message definition. Ranges
314+ are defined in
315+ \ref {sec:Virtio Transport Options / Virtio Over Messages / Transport Messages }
316+ and
317+ \ref {sec:Virtio Transport Options / Virtio Over Messages / Bus Messages }.
318+ \item \field {dev_num}: For Transport Messages, the target device number; for
319+ Bus Messages \textbf {MUST } be zero.
320+ \item \field {msg_uid}: Non-zero for requests that expect a response; zero
321+ \textbf {MUST } be used only for event (one-way) messages. Responses
322+ \textbf {MUST } echo the request's \field {msg_uid}.
323+ \item \field {msg_size}: Total size in bytes of the complete message (header +
324+ payload). \textbf {MUST } be \( \ge 8\) and \textbf {MUST NOT } exceed the
325+ bus's maximum message size.
326+ \item \field {payload}: Operation-specific data. Unused trailing bytes (if any
327+ introduced by a bus framing) \textbf {MUST } be zero and \textbf {MUST } be
328+ ignored by receivers.
322329\end {itemize }
323330
331+ All reserved header bits and any unspecified header values \textbf {MUST } be
332+ sent as zero and \textbf {MUST } be ignored on receive to preserve forward
333+ compatibility.
334+
324335\subsection {Bus Operation }
325336\label {sec:Virtio Transport Options / Virtio Over Messages / Bus Operation }
326337
@@ -391,8 +402,8 @@ \subsubsection{Monitoring the Bus}
391402\subsubsection {Bus Specific Messages }
392403\label {sec:Virtio Transport Options / Virtio Over Messages / Bus Operation / Bus Specific Messages }
393404
394- A range of message IDs are reserved for use by the specific bus
395- implementation. These messages can be used for any implementation specific
405+ A range of message operation identifiers are reserved for use by the specific
406+ bus implementation. These messages can be used for any implementation specific
396407usage. Example usage could include:
397408
398409\begin {itemize }
@@ -715,11 +726,11 @@ \subsubsection{Overview}
715726Most transport messages adopt a \emph {request/response } pattern, but some are
716727unidirectional (e.g., asynchronous notifications).
717728
718- \paragraph {Messages IDs and issuers }
729+ \paragraph {Messages Operation (OP) identifiers and issuers }
719730
720731\begin {tabular }{|l|l|l|}
721732\hline
722- Name & ID & Sender \\
733+ Name & OP identifier & Sender \\
723734\hline
724735\hline
725736Reserved & 0x0 & \\
@@ -756,8 +767,8 @@ \subsubsection{Overview}
756767\hline
757768\end {tabular }
758769
759- Transport message IDs 0x00 to 0x3F are used for messages that require a response
760- and IDs 0x40 to 0x7F are used for event messages. Transport message IDs 0x80
770+ Transport message OPs 0x00 to 0x3F are used for messages that require a response
771+ and OPs 0x40 to 0x7F are used for event messages. Transport message OPs 0x80
761772and above are reserved by this specification.
762773
763774\paragraph {Mandatory Transport Messages }
@@ -1080,11 +1091,11 @@ \subsection{Bus Messages}\label{sec:Virtio Transport Options / Virtio Over Messa
10801091firmware tables, device trees). Each bus instance \emph {may } use a subset of or
10811092all these messages according to its design.
10821093
1083- \paragraph {Messages IDs and issuers }
1094+ \paragraph {OPs identifiers and issuers }
10841095
10851096\begin {tabular }{|l|l|l|}
10861097\hline
1087- Name & ID & Sender \\
1098+ Name & OP identifier & Sender \\
10881099\hline
10891100\hline
10901101Reserved & 0x0 & \\
@@ -1099,14 +1110,14 @@ \subsection{Bus Messages}\label{sec:Virtio Transport Options / Virtio Over Messa
10991110\hline
11001111\end {tabular }
11011112
1102- Bus message IDs below 0x80 are reserved for standardizes (but optional) bus
1113+ Bus message OPs below 0x80 are reserved for standardizes (but optional) bus
11031114messages. A few are used here and more are expected in the future. Bus message
1104- IDs below 0x40 are used for request/response messages and 0x40 and above for
1115+ OPs below 0x40 are used for request/response messages and 0x40 and above for
11051116event messages.
11061117
1107- Bus message IDs 0x80 and above are bus implementation specific. Bus
1108- implementations \emph {MAY } specify the policy that IDs below 0xC0 be used
1109- for request/response messages and IDs 0xC0 and above are used for event messages.
1118+ Bus message OPs 0x80 and above are bus implementation specific. Bus
1119+ implementations \emph {MAY } specify the policy that OPs below 0xC0 be used
1120+ for request/response messages and OPs 0xC0 and above are used for event messages.
11101121
11111122\paragraph {Note: } A bus implementation \textbf {is not required } to use these
11121123messages if it already provides equivalent functionality through some
0 commit comments