Skip to content

Commit 188b0c3

Browse files
virtio-msg: mark direct message-field references with \field{} (Manos Pitsidianakis)
Manos Pitsidianakis noted that direct references to message fields should use the \field{} macro for consistency with the rest of the spec. Update the remaining direct field references in prose and normative text to use \field{} where they refer to concrete message fields, including GET_CONFIG/SET_CONFIG, SET_DEVICE_STATUS, GET_SHM, EVENT_CONFIG, and GET_DEVICES wording. Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
1 parent 0e07350 commit 188b0c3

1 file changed

Lines changed: 84 additions & 73 deletions

File tree

transport-msg.tex

Lines changed: 84 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ \subsubsection{Configuration Semantics Profiles}
354354
\msgref{GET_CONFIG}, \msgref{SET_CONFIG}, and \msgref{EVENT_CONFIG}.
355355
\item In baseline profile, upon \msgref{EVENT_CONFIG}, a driver SHOULD refresh
356356
required configuration via \msgref{GET_CONFIG} when event data is
357-
omitted or when offset/length are zero.
357+
omitted or when \field{offset} and \field{length} are zero.
358358
\item In strict profile, a driver MUST track generation values from
359359
\msgref{GET_CONFIG}/\msgref{EVENT_CONFIG} and MUST include its most
360360
recent generation value in \msgref{SET_CONFIG}.
@@ -776,9 +776,10 @@ \subsubsection{Device Configuration}
776776
\label{sec:Virtio Transport Options / Virtio Over Messages / Device Initialization / Device Configuration}
777777

778778
Drivers use \msgref{GET_CONFIG} to read portions of the configuration space by
779-
supplying an offset and length; the device returns the requested data plus the
780-
configuration generation field. Writing is performed via \msgref{SET_CONFIG},
781-
which carries the same offset/length plus generation and new data.
779+
supplying \field{offset} and \field{length}; the device returns the requested
780+
data plus the configuration generation field. Writing is performed via
781+
\msgref{SET_CONFIG}, which carries the same \field{offset}/\field{length} plus
782+
generation and new data.
782783
Generation-field handling follows the active profile defined in
783784
\ref{sec:Virtio Transport Options / Virtio Over Messages / Basic Concepts / Configuration Semantics Profiles}.
784785

@@ -789,7 +790,7 @@ \subsubsection{Device Configuration}
789790

790791
\drivernormative{\paragraph}{Device Configuration}{Virtio Transport Options / Virtio Over Messages / Device Initialization / Device Configuration / Driver}
791792
\begin{itemize}
792-
\item A driver MUST ensure that the offset and length in each
793+
\item A driver MUST ensure that the \field{offset} and \field{length} in each
793794
\msgref{GET_CONFIG} or \msgref{SET_CONFIG} request stay within the
794795
configuration size reported by \msgref{GET_DEVICE_INFO}.
795796
\item A driver MUST follow the active configuration semantics profile in
@@ -1054,13 +1055,13 @@ \subsubsection{Virtqueue Changes During Operation}
10541055
\subsubsection{Device Reset and Shutdown}
10551056
\label{sec:Virtio Transport Options / Virtio Over Messages / Device Operation / Reset}
10561057

1057-
Drivers request a device reset by writing 0 to the status field via
1058+
Drivers request a device reset by writing 0 to \field{status} via
10581059
\msgref{SET_DEVICE_STATUS}. Reset completion can be synchronous or
10591060
asynchronous. A driver confirms completion from a
1060-
\msgref{SET_DEVICE_STATUS} response status of 0 or by polling
1061-
\msgref{GET_DEVICE_STATUS} until status is 0. A device may also signal that a
1062-
reset is required by setting DEVICE\_NEEDS\_RESET in its status and reporting
1063-
the updated status to the driver.
1061+
\msgref{SET_DEVICE_STATUS} response \field{status} of 0 or by polling
1062+
\msgref{GET_DEVICE_STATUS} until \field{status} is 0. A device may also signal
1063+
that a reset is required by setting DEVICE\_NEEDS\_RESET in its
1064+
\field{status} and reporting the updated \field{status} to the driver.
10641065

10651066
\drivernormative{\paragraph}{Reset and Shutdown}{Virtio Transport Options / Virtio Over Messages / Device Operation / Reset / Driver}
10661067
\begin{itemize}
@@ -1318,9 +1319,9 @@ \subsubsection{Overview}
13181319
\msgdef{GET_CONFIG}
13191320

13201321
\msgref{GET_CONFIG} reads a portion of the configuration space. The request
1321-
specifies the byte offset and length; the response echoes those values, returns
1322-
the data, and includes generation. Generation semantics follow the active
1323-
configuration profile defined in
1322+
specifies the byte \field{offset} and \field{length}; the response echoes those
1323+
values, returns the data, and includes generation. Generation semantics follow
1324+
the active configuration profile defined in
13241325
\ref{sec:Virtio Transport Options / Virtio Over Messages / Basic Concepts / Configuration Semantics Profiles}.
13251326

13261327
\begin{lstlisting}
@@ -1339,8 +1340,9 @@ \subsubsection{Overview}
13391340

13401341
\drivernormative{\paragraph}{GET\_CONFIG}{Virtio Transport Options / Virtio Over Messages / Transport Messages / VIRTIO_MSG_GET_CONFIG / Driver}
13411342
\begin{itemize}
1342-
\item A driver MUST ensure the requested offset and length in \msgref{GET_CONFIG}
1343-
stay within the configuration size reported by \msgref{GET_DEVICE_INFO}.
1343+
\item A driver MUST ensure the requested \field{offset} and \field{length}
1344+
in \msgref{GET_CONFIG} stay within the configuration size reported by
1345+
\msgref{GET_DEVICE_INFO}.
13441346
\end{itemize}
13451347

13461348
\devicenormative{\paragraph}{GET\_CONFIG}{Virtio Transport Options / Virtio Over Messages / Transport Messages / VIRTIO_MSG_GET_CONFIG / Device}
@@ -1353,10 +1355,11 @@ \subsubsection{Overview}
13531355
\msgdef{SET_CONFIG}
13541356

13551357
\msgref{SET_CONFIG} writes a portion of configuration space, supplying the
1356-
offset, length, the driver's view of the generation count, and the new data.
1357-
The device echoes the offset/length, returns the resulting generation count,
1358-
and may mirror the applied data or set the length to zero if the write was
1359-
rejected. A rejected response uses \field{length}=0 and no payload bytes.
1358+
\field{offset}, \field{length}, the driver's view of the generation count, and
1359+
the new data. The device echoes the \field{offset}/\field{length}, returns the
1360+
resulting generation count, and may mirror the applied data or set
1361+
\field{length} to zero if the write was rejected. A rejected response uses
1362+
\field{length}=0 and no payload bytes.
13601363
Generation-mismatch rejection is defined only for strict profile.
13611364
Generation semantics follow the active configuration profile defined
13621365
in
@@ -1380,7 +1383,8 @@ \subsubsection{Overview}
13801383

13811384
\drivernormative{\paragraph}{SET\_CONFIG}{Virtio Transport Options / Virtio Over Messages / Transport Messages / VIRTIO_MSG_SET_CONFIG / Driver}
13821385
\begin{itemize}
1383-
\item A driver MUST keep the offset and length within the reported
1386+
\item A driver MUST keep the \field{offset} and \field{length} within the
1387+
reported
13841388
configuration size in each \msgref{SET_CONFIG} request.
13851389
\item A driver MUST follow the active configuration semantics profile in
13861390
\ref{sec:Virtio Transport Options / Virtio Over Messages / Basic Concepts / Configuration Semantics Profiles}
@@ -1427,11 +1431,12 @@ \subsubsection{Overview}
14271431

14281432
\msgref{SET_DEVICE_STATUS} writes a new device status value. Drivers use it to
14291433
progress through the virtio-defined states or to request a reset by writing 0.
1430-
The response reports the status value observed when the response is generated.
1431-
For a reset request (\field{status} == 0), a response status of 0 indicates
1432-
reset completion; a non-zero response status indicates that reset completion may
1433-
still be pending. The resulting status may differ from the requested status (for
1434-
example, if the device refuses FEATURES\_OK or sets DEVICE\_NEEDS\_RESET).
1434+
The response reports the \field{status} value observed when the response is
1435+
generated. For a reset request (\field{status} == 0), a response
1436+
\field{status} of 0 indicates reset completion; a non-zero \field{status}
1437+
indicates that reset completion may still be pending. The resulting
1438+
\field{status} may differ from the requested \field{status} (for example, if
1439+
the device refuses FEATURES\_OK or sets DEVICE\_NEEDS\_RESET).
14351440

14361441
\begin{lstlisting}
14371442
struct virtio_msg_set_device_status_req {
@@ -1448,23 +1453,23 @@ \subsubsection{Overview}
14481453
\item A driver MUST write 0 via \msgref{SET_DEVICE_STATUS} to request a device
14491454
reset.
14501455
\item A driver that needs to confirm reset completion MUST treat a
1451-
\msgref{SET_DEVICE_STATUS} response status of 0 as completion;
1456+
\msgref{SET_DEVICE_STATUS} response \field{status} of 0 as completion;
14521457
otherwise it MUST poll \msgref{GET_DEVICE_STATUS} until the device
1453-
reports status 0 before reinitializing the device.
1458+
reports \field{status}=0 before reinitializing the device.
14541459
\end{itemize}
14551460

14561461
\devicenormative{\paragraph}{SET\_DEVICE\_STATUS}{Virtio Transport Options / Virtio Over Messages / Transport Messages / VIRTIO_MSG_SET_DEVICE_STATUS / Device}
14571462
\begin{itemize}
14581463
\item A device MAY clear FEATURES\_OK or set DEVICE\_NEEDS\_RESET in its
1459-
response if it cannot accept the requested status, but it MUST report
1460-
the resulting status accurately.
1464+
response if it cannot accept the requested \field{status}, but it MUST
1465+
report the resulting \field{status} accurately.
14611466
\item Upon receiving \msgref{SET_DEVICE_STATUS} with \field{status} set to 0,
14621467
a device MUST start reset processing and MUST eventually complete reset
1463-
by reporting status 0.
1468+
by reporting \field{status}=0.
14641469
\item A device MAY complete reset before sending the
14651470
\msgref{SET_DEVICE_STATUS} response (synchronous completion) or after
14661471
sending it (asynchronous completion).
1467-
\item A device MUST NOT report status 0 until reset completion.
1472+
\item A device MUST NOT report \field{status}=0 until reset completion.
14681473
\end{itemize}
14691474

14701475
\msgdef{GET_VQUEUE}
@@ -1627,9 +1632,10 @@ \subsubsection{Overview}
16271632
\msgdef{GET_SHM}
16281633

16291634
\msgref{GET_SHM} returns the location and size of a device-owned shared memory
1630-
region. The request carries the region index; the response echoes the index and
1631-
provides the base physical address and length. A length of zero indicates that
1632-
the specified region does not exist.
1635+
region. The request carries the region \field{index}; the response echoes
1636+
\field{index} and provides the base physical \field{address} and
1637+
\field{length}. A
1638+
\field{length} of zero indicates that the specified region does not exist.
16331639

16341640
\begin{lstlisting}
16351641
struct virtio_msg_get_shm_req {
@@ -1646,9 +1652,9 @@ \subsubsection{Overview}
16461652

16471653
\devicenormative{\paragraph}{GET\_SHM}{Virtio Transport Options / Virtio Over Messages / Transport Messages / VIRTIO_MSG_GET_SHM / Device}
16481654
\begin{itemize}
1649-
\item A device MUST return zero length if the requested shared memory region
1650-
does not exist and MUST report accurate physical address/length
1651-
information for regions it supports.
1655+
\item A device MUST return zero \field{length} if the requested shared memory
1656+
region does not exist and MUST report accurate physical
1657+
\field{address}/\field{length} information for regions it supports.
16521658
\item A device MUST set the \field{reserved} field in \msgref{GET_SHM}
16531659
responses to zero.
16541660
\end{itemize}
@@ -1657,12 +1663,12 @@ \subsubsection{Overview}
16571663

16581664
\msgref{EVENT_CONFIG} notifies the driver about configuration or status changes.
16591665
The payload includes current device status, generation, and
1660-
configuration offset/length. The configuration data can be omitted; if omitted,
1661-
the driver re-fetches via \msgref{GET_CONFIG}. Generation and offset/length
1662-
semantics follow the active profile defined in
1666+
configuration \field{offset}/\field{length}. The configuration data can be
1667+
omitted; if omitted, the driver re-fetches via \msgref{GET_CONFIG}. Generation
1668+
and \field{offset}/\field{length} semantics follow the active profile defined in
16631669
\ref{sec:Virtio Transport Options / Virtio Over Messages / Basic Concepts / Configuration Semantics Profiles}.
16641670
If the event reports only a status change with no configuration update, the
1665-
device sets offset and length to zero.
1671+
device sets \field{offset} and \field{length} to zero.
16661672

16671673
\begin{lstlisting}
16681674
struct virtio_msg_event_config {
@@ -1678,12 +1684,13 @@ \subsubsection{Overview}
16781684
\begin{itemize}
16791685
\item When \msgref{EVENT_CONFIG} provides configuration data, the driver
16801686
SHOULD apply it; otherwise it SHOULD re-read the affected range
1681-
indicated by offset/length via \msgref{GET_CONFIG} before proceeding.
1682-
If offset/length are both zero and no data is provided, the driver
1683-
SHOULD re-read required configuration via \msgref{GET_CONFIG}.
1687+
indicated by \field{offset}/\field{length} via \msgref{GET_CONFIG}
1688+
before proceeding. If \field{offset}/\field{length} are both zero and
1689+
no data is provided, the driver SHOULD re-read required configuration
1690+
via \msgref{GET_CONFIG}.
16841691
\item A driver MUST follow the active configuration semantics profile in
16851692
\ref{sec:Virtio Transport Options / Virtio Over Messages / Basic Concepts / Configuration Semantics Profiles}
1686-
for generation and offset/length interpretation in
1693+
for generation and \field{offset}/\field{length} interpretation in
16871694
\msgref{EVENT_CONFIG}.
16881695
\end{itemize}
16891696

@@ -1693,11 +1700,12 @@ \subsubsection{Overview}
16931700
configuration data or status in a way that is visible to the driver.
16941701
\item A device MUST follow the active configuration semantics profile in
16951702
\ref{sec:Virtio Transport Options / Virtio Over Messages / Basic Concepts / Configuration Semantics Profiles}
1696-
for generation and offset/length handling in \msgref{EVENT_CONFIG}.
1703+
for generation and \field{offset}/\field{length} handling in
1704+
\msgref{EVENT_CONFIG}.
16971705
\item In baseline profile, a device MUST NOT send \msgref{EVENT_CONFIG}
16981706
solely to report a \msgref{SET_CONFIG} generation mismatch.
16991707
\item If \msgref{EVENT_CONFIG} reports only a status change, a device MUST set
1700-
the offset and length fields to zero.
1708+
the \field{offset} and \field{length} fields to zero.
17011709
\end{itemize}
17021710

17031711
\msgdef{EVENT_AVAIL}
@@ -1836,47 +1844,50 @@ \subsubsection{Overview}
18361844
};
18371845
\end{lstlisting}
18381846

1839-
The \textbf{(offset, count)} tuple defines a window of \textbf{count}
1840-
consecutive device numbers beginning at \textbf{offset}. The number of present
1841-
devices equals the number of set bits in the first \textbf{count} bitmap
1842-
positions. The bitmap size in bytes is \textbf{(count + 7) / 8}.
1843-
The response \textbf{count} MUST NOT exceed the request \textbf{count}.
1844-
Responders SHOULD return the requested \textbf{count} unless constrained
1847+
The (\field{offset}, \field{count}) tuple defines a window of \field{count}
1848+
consecutive device numbers beginning at \field{offset}. The number of present
1849+
devices equals the number of set bits in the first \field{count} positions of
1850+
\field{bitmap}. The \field{bitmap} size in bytes is
1851+
\textbf{(\field{count} + 7) / 8}. The response \field{count} MUST NOT exceed
1852+
the request \field{count}. Responders SHOULD return the requested
1853+
\field{count} unless constrained
18451854
(e.g., by maximum message size) or when trailing parts of the requested window
18461855
contain no present device numbers; in those cases they MAY return a smaller
1847-
value, and the bitmap covers the reduced window. If no devices are present in
1848-
the requested window, returning \textbf{count}=0 and an empty bitmap is valid.
1856+
value, and the \field{bitmap} covers the reduced window. If no devices are
1857+
present in the requested window, returning \field{count}=0 and an empty
1858+
\field{bitmap} is valid.
18491859

1850-
Example: a request with \textbf{offset}=0, \textbf{count}=16 might produce
1851-
\textbf{bitmap}=0b00100101 00000000 and \textbf{next_offset}=16. That indicates
1860+
Example: a request with \field{offset}=0, \field{count}=16 might produce
1861+
\field{bitmap}=0b00100101 00000000 and \field{next_offset}=16. That indicates
18521862
devices 0, 2, and 5 are present within the 0–15 window and suggests continuing
18531863
at device number 16.
18541864

18551865
\paragraph{Intended usage}
18561866
Drivers MAY use this message to enumerate device numbers. Treat each window as
1857-
a snapshot, advance using \textbf{next_offset}, and confirm candidates via
1867+
a snapshot, advance using \field{next_offset}, and confirm candidates via
18581868
\msgref{GET_DEVICE_INFO} before issuing other transport messages.
18591869

18601870
\busnormative{\paragraph}{GET\_DEVICES}{Virtio Transport Options / Virtio Over Messages / Bus Messages / GET_DEVICES / Bus}
18611871
\begin{itemize}
1862-
\item The bus-side responder MUST interpret \textbf{count} as a number of
1863-
device-number slots and MUST return a bitmap of length
1864-
\textbf{(count + 7) / 8} bytes, packed least-significant-bit first.
1865-
\item The bus-side responder MUST NOT return a \textbf{count} value greater
1866-
than the \textbf{count} value from the request.
1867-
\item If \textbf{count} is not a multiple of 8, the responder MUST set unused
1868-
bits in the last bitmap byte (positions at or above \textbf{count}) to
1869-
zero.
1870-
\item \textbf{next\_offset} MUST be 0 (indicating no further windows) or an
1871-
value $\ge \textbf{offset} + \textbf{count}$ recommending where the
1872+
\item The bus-side responder MUST interpret \field{count} as a number of
1873+
device-number slots and MUST return a \field{bitmap} of
1874+
\textbf{(\field{count} + 7) / 8} bytes, packed least-significant-bit
1875+
first.
1876+
\item The bus-side responder MUST NOT return a \field{count} value greater
1877+
than the \field{count} value from the request.
1878+
\item If \field{count} is not a multiple of 8, the responder MUST set unused
1879+
bits in the last \field{bitmap} byte (positions at or above
1880+
\field{count}) to zero.
1881+
\item \field{next\_offset} MUST be 0 (indicating no further windows) or an
1882+
value $\ge \field{offset} + \field{count}$ recommending where the
18721883
driver should query next.
1873-
\item Responders SHOULD return the requested \textbf{count} unless constrained
1884+
\item Responders SHOULD return the requested \field{count} unless constrained
18741885
(e.g., by maximum message size) or when trailing parts of the requested
1875-
window contain no present device numbers; if a smaller count is
1876-
returned, the bitmap MUST still represent the window defined by the
1877-
echoed \textbf{offset} and \textbf{count}.
1886+
window contain no present device numbers; if a smaller \field{count} is
1887+
returned, the \field{bitmap} MUST still represent the window defined by
1888+
the echoed \field{offset} and \field{count}.
18781889
\item If no devices are present in the requested window, a responder MAY
1879-
return \textbf{count}=0 with a zero-length bitmap.
1890+
return \field{count}=0 with a zero-\field{length} \field{bitmap}.
18801891
\end{itemize}
18811892

18821893
\busdef{PING}

0 commit comments

Comments
 (0)