Skip to content

Commit d150afd

Browse files
virtio-msg: remove bus operation section
Merge content into messages description directly by adding an intended usage paragraph or into the Basic Concepts section. This makes the transport content look more like PCI or Channel IO. Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
1 parent 92a39c6 commit d150afd

1 file changed

Lines changed: 74 additions & 79 deletions

File tree

transport-msg.tex

Lines changed: 74 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,18 @@ \subsubsection{Message Correlation}
376376
action.
377377
\end{itemize}
378378

379+
\subsubsection{Bus and Transport Messages}
380+
\label{sec:Virtio Transport Options / Virtio Over Messages / Basic Concepts / Bus and Transport Messages}
381+
382+
The bus is responsible for forwarding device-specific \emph{transport
383+
messages} to the correct device for each device number. Typically the bus does
384+
not interpret or modify these transport messages; its role is simply to ensure
385+
they reach the intended device. If the bus does not rely on messages for device
386+
enumeration or hotplug itself, it MUST still be capable of transporting
387+
\msgref{GET_DEVICE_INFO}, \msgref{GET_DEVICE_FEATURES}, \msgref{SET_CONFIG}, etc.
388+
once the OS driver has identified a device and is performing initialization
389+
via the virtio-msg transport.
390+
379391
\subsection{Device Discovery}\label{sec:Virtio Transport Options / Virtio Over Messages / Device Discovery}
380392

381393
A virtio-msg implementation can learn about devices via bus-level enumeration
@@ -400,79 +412,6 @@ \subsection{Device Discovery}\label{sec:Virtio Transport Options / Virtio Over M
400412
and vendor ID. The bus can then register the device with the host OS
401413
so the appropriate virtio driver probe routine is invoked.
402414

403-
\subsection{Bus Operation}
404-
\label{sec:Virtio Transport Options / Virtio Over Messages / Bus Operation}
405-
406-
A \textbf{virtio-msg bus} is responsible for identifying available virtio devices
407-
and informing the operating system (or higher-level software environment) so
408-
that those devices can be bound to the appropriate driver. The following
409-
subsections describe optional messaging mechanisms that a bus MAY use to
410-
discover or manage devices, as well as general guidelines for completing the
411-
device registration process.
412-
413-
\subsubsection{Device Hotplug}
414-
\label{sec:Virtio Transport Options / Virtio Over Messages / Bus Operation / Device Hotplug}
415-
416-
If the bus supports dynamic addition or removal of devices at runtime, it
417-
MAY announce these events using messages:
418-
\begin{itemize}
419-
\item \busref{EVENT_DEVICE} with state DEVICE_BUS_STATE_READY for a newly
420-
available device,
421-
\item \busref{EVENT_DEVICE} with state DEVICE_BUS_STATE_REMOVED for a device
422-
that is no longer accessible.
423-
\end{itemize}
424-
425-
Alternatively, the bus MAY rely on external signals (e.g., an event from
426-
the platform or hypervisor) and inform the OS of hotplug changes out-of-band.
427-
This specification \emph{defines} \busref{EVENT_DEVICE}
428-
for implementations that prefer a fully message-based
429-
approach but does not require their use. In any scenario, once notified that a
430-
device has appeared, the bus SHOULD query the device (e.g., via
431-
\msgref{GET_DEVICE_INFO}) and register it with the OS. If a device is
432-
removed, the bus SHOULD prompt the OS to unbind and release resources.
433-
434-
\subsubsection{Monitoring the Bus}
435-
\label{sec:Virtio Transport Options / Virtio Over Messages / Bus Operation / Monitoring}
436-
437-
An optional \busref{PING} message is provided for bus implementations that want
438-
to periodically verify connectivity with the other end (driver or device).
439-
Implementations MAY use other keepalive or health-check
440-
protocols instead. The general usage of \busref{PING} (if implemented) is:
441-
442-
\begin{itemize}
443-
\item The initiator sends a 32-bit data field,
444-
\item The recipient responds by echoing this same 32-bit data,
445-
\item If a response does not arrive in time, the initiator MAY treat
446-
the bus as unresponsive and trigger a global reset or other fallback
447-
procedure.
448-
\end{itemize}
449-
450-
\subsubsection{Bus Specific Messages}
451-
\label{sec:Virtio Transport Options / Virtio Over Messages / Bus Operation / Bus Specific Messages}
452-
453-
A range of message IDs are reserved for use by the specific bus
454-
implementation. These messages can be used for any implementation specific
455-
usage. Example usage could include:
456-
457-
\begin{itemize}
458-
\item Configuration of out-of-band notification methods
459-
\item Setup shared memory regions to be used for buffers or virtqueues
460-
\item Declare bus specific error conditions
461-
\item Provide extra debug or logging information
462-
\end{itemize}
463-
464-
\subsubsection{Interaction with Transport Messages}
465-
\label{sec:Virtio Transport Options / Virtio Over Messages / Bus Operation / Interaction with Transport}
466-
467-
The bus is also responsible for forwarding device-specific \emph{transport
468-
messages} to the correct device for each device number. Typically the bus does
469-
not interpret or modify these transport messages; its role is simply to ensure
470-
they reach the intended device. If the bus does not rely on messages for device
471-
enumeration or hotplug itself, it MUST still be capable of transporting
472-
\msgref{GET_DEVICE_INFO}, \msgref{GET_DEVICE_FEATURES}, \msgref{SET_CONFIG}, etc.
473-
once the OS driver has identified a device and is performing initialization
474-
via the virtio-msg transport.
475-
476415
\subsection{Device Initialization}
477416
\label{sec:Virtio Transport Options / Virtio Over Messages / Device Initialization}
478417

@@ -754,6 +693,27 @@ \subsubsection{Device Reset and Shutdown}
754693
via the \msgref{SET_DEVICE_STATUS} message. The driver MAY reinitialize
755694
the device if it wishes to use the device again.
756695

696+
\subsubsection{Hotplug and Removal}
697+
\label{sec:Virtio Transport Options / Virtio Over Messages / Device Operation / Hotplug and Removal}
698+
699+
If the bus supports dynamic addition or removal of devices at runtime, it
700+
MAY announce these events using messages:
701+
\begin{itemize}
702+
\item \busref{EVENT_DEVICE} with state DEVICE_BUS_STATE_READY for a newly
703+
available device,
704+
\item \busref{EVENT_DEVICE} with state DEVICE_BUS_STATE_REMOVED for a device
705+
that is no longer accessible.
706+
\end{itemize}
707+
708+
Alternatively, the bus MAY rely on external signals (e.g., an event from
709+
the platform or hypervisor) and inform the OS of hotplug changes out-of-band.
710+
This specification \emph{defines} \busref{EVENT_DEVICE}
711+
for implementations that prefer a fully message-based
712+
approach but does not require their use. In any scenario, once notified that a
713+
device has appeared, the bus SHOULD query the device (e.g., via
714+
\msgref{GET_DEVICE_INFO}) and register it with the OS. If a device is
715+
removed, the bus SHOULD prompt the OS to unbind and release resources.
716+
757717
\subsection{Transport Messages}\label{sec:Virtio Transport Options / Virtio Over Messages / Transport Messages}
758718

759719
Transport messages are used to configure and operate individual virtio devices.
@@ -1140,6 +1100,15 @@ \subsection{Bus Messages}\label{sec:Virtio Transport Options / Virtio Over Messa
11401100
firmware tables, device trees). Each bus instance MAY use a subset of or
11411101
all these messages according to its design.
11421102

1103+
\subsubsection{Overview}
1104+
\label{sec:Virtio Transport Options / Virtio Over Messages / Bus Messages / Overview}
1105+
1106+
A bus implementation \textbf{is not required} to use these
1107+
messages if it already provides equivalent functionality through some
1108+
platform-specific mechanism. However, if a bus chooses to handle enumeration,
1109+
hotplug, etc. via virtio-msg, it SHOULD implement the corresponding
1110+
message definitions below.
1111+
11431112
\paragraph{Messages IDs and issuers}
11441113

11451114
\begin{tabular}{|l|l|l|}
@@ -1168,11 +1137,19 @@ \subsection{Bus Messages}\label{sec:Virtio Transport Options / Virtio Over Messa
11681137
implementations MAY specify the policy that IDs below 0xC0 be used
11691138
for request/response messages and IDs 0xC0 and above are used for event messages.
11701139

1171-
\paragraph{Note:} A bus implementation \textbf{is not required} to use these
1172-
messages if it already provides equivalent functionality through some
1173-
platform-specific mechanism. However, if a bus chooses to handle enumeration,
1174-
hotplug, etc. via virtio-msg, it SHOULD implement the corresponding
1175-
message definitions below.
1140+
\paragraph{Bus Specific Messages}
1141+
\label{sec:Virtio Transport Options / Virtio Over Messages / Bus Operation / Bus Specific Messages}
1142+
1143+
A range of message IDs are reserved for use by the specific bus
1144+
implementation. These messages can be used for any implementation specific
1145+
usage. Example usage could include:
1146+
1147+
\begin{itemize}
1148+
\item Configuration of out-of-band notification methods
1149+
\item Setup shared memory regions to be used for buffers or virtqueues
1150+
\item Declare bus specific error conditions
1151+
\item Provide extra debug or logging information
1152+
\end{itemize}
11761153

11771154
\busdef{GET_DEVICES}
11781155

@@ -1212,6 +1189,11 @@ \subsection{Bus Messages}\label{sec:Virtio Transport Options / Virtio Over Messa
12121189
devices 0, 2, and 5 are present within the 0–15 window and suggests continuing
12131190
at device number 16.
12141191

1192+
\paragraph{Intended usage}
1193+
Drivers MAY use this message to enumerate device numbers. Treat each window as
1194+
a snapshot, advance using \textbf{next_offset}, and confirm candidates via
1195+
\msgref{GET_DEVICE_INFO} before issuing other transport messages.
1196+
12151197
\busdef{EVENT_DEVICE}
12161198

12171199
This message is sent by the virtio-msg device side bus and there is no response.
@@ -1244,6 +1226,14 @@ \subsection{Bus Messages}\label{sec:Virtio Transport Options / Virtio Over Messa
12441226
It can indicate when a device is added or removed. It MAY also be used by
12451227
bus implementations to indicate other states.
12461228

1229+
\paragraph{Intended usage}
1230+
This message advertises device presence or removal. Upon READY, drivers SHOULD
1231+
probe the device via \msgref{GET_DEVICE_INFO} and proceed with initialization
1232+
if successful. Upon REMOVED, drivers MUST stop queueing new requests,
1233+
quiesce/reset as applicable, and release resources. Drivers SHOULD tolerate
1234+
duplicates and out-of-order events, and MAY use bus-level monitoring (see
1235+
\busref{PING}) to refine policy.
1236+
12471237
\busdef{PING}
12481238

12491239
This message is sent by the virtio-msg driver side bus or device side bus and
@@ -1252,13 +1242,18 @@ \subsection{Bus Messages}\label{sec:Virtio Transport Options / Virtio Over Messa
12521242
\begin{tabular}{|l|l|l|l|}
12531243
\hline
12541244
Type & Offset & Size (bytes) & Content \\
1255-
\hline \hline
1245+
\hline \hline
12561246
Request & 0 & 4 & Data \\
12571247
\hline
12581248
Answer & 0 & 4 & Request Data \\
12591249
\hline
12601250
\end{tabular}
12611251

1252+
\paragraph{Intended usage}
1253+
Drivers MAY treat \busref{PING} as an optional keepalive or monitoring
1254+
mechanism. Timeouts or missing replies SHOULD trigger validation of device
1255+
state via \msgref{GET_DEVICE_STATUS} and recovery as appropriate.
1256+
12621257
\subsection{Compliance}
12631258
\label{sec:Virtio Transport Options / Virtio Over Messages / Compliance}
12641259

0 commit comments

Comments
 (0)