Skip to content

Commit 0e07350

Browse files
virtio-msg: clarify dev_num semantics for bus and transport messages
Clarify that bus messages are identified by the common-header type field, not by dev_num, while still requiring bus messages to carry dev_num = 0. Also state explicitly that device number 0 is not reserved for transport messages, and require bus implementations to validate the target device number before forwarding transport traffic. These changes resolve ambiguity in the common-header and forwarding text without changing message definitions or the transport model. Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
1 parent 7a2d5e2 commit 0e07350

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

transport-msg.tex

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,17 @@ \subsubsection{Relationship Between Bus and Transport}
124124

125125
\busnormative{\paragraph}{Transport Message Forwarding}{Virtio Transport Options / Virtio Over Messages / Basic Concepts / Relationship between bus and transport / Transport Message Forwarding}
126126
\begin{itemize}
127+
\item A bus implementation MUST validate the device number in each transport
128+
message before forwarding it.
127129
\item A bus implementation MUST relay each transport message to the device
128130
number identified in the message header, regardless of how it
129131
discovered or enumerated that device.
130132
\item A bus implementation SHOULD treat transport messages as opaque apart
131133
from enforcing generic transport limits, such as the advertised maximum
132134
message size, and SHOULD NOT modify the transport payload.
133-
\item If a bus implementation cannot route a transport message to a device
134-
number, it MAY drop the message or surface a transport-visible failure.
135+
\item If a bus implementation cannot validate or route a transport message to
136+
a device number, it MAY drop the message or surface a
137+
transport-visible failure.
135138
\end{itemize}
136139

137140
\subsubsection{Known Bus Implementation Examples}
@@ -522,7 +525,7 @@ \subsubsection{Common Message Format}
522525
le16 token; /* bus-managed correlation identifier */
523526
le16 msg_size; /* total size: header (16) + payload */
524527
le16 reserved; /* reserved, MUST be zero */
525-
le64 dev_num; /* device number (0 for bus messages) */
528+
le64 dev_num; /* target device number; bus messages MUST use 0 */
526529
u8 payload[];
527530
};
528531
\end{lstlisting}
@@ -548,7 +551,9 @@ \subsubsection{Common Message Format}
548551
\item \field{reserved}: Reserved for future use. Transmitters set this field
549552
to zero, and receivers ignore it.
550553
\item \field{dev_num}: For transport messages, the device number that should
551-
receive the message. Bus messages operate on device number 0.
554+
receive the message. Device number 0 is not reserved for transport
555+
messages. Bus messages are identified by \field{type} and MUST carry
556+
\field{dev_num}=0.
552557
\item \field{payload}: Operation-specific data. If a bus introduces extra
553558
padding bytes, those bytes are not part of the payload semantics.
554559
\end{itemize}

0 commit comments

Comments
 (0)