Skip to content

Commit 8f7ed9e

Browse files
virtio-msg: align feature negotiation with core virtio
Define GET_DEVICE_FEATURES as device-offered features and SET_DRIVER_FEATURES as the driver-selected subset. Keep FEATURES_OK as the point where the device accepts or rejects the negotiated set. Remove wording that implied GET_DEVICE_FEATURES later reflects negotiated state. Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
1 parent 7f276db commit 8f7ed9e

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

transport-msg.tex

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,9 @@ \subsubsection{Device Feature Blocks}
482482
features 0-31, block 1 for features 32-63, etc.).
483483
\item \textbf{Number of Blocks}: How many blocks the driver wishes to retrieve
484484
or modify in a single message.
485-
\item \textbf{Feature Data}: The 32-bit values representing the supported (or
486-
driver-requested) feature bits in the selected blocks.
485+
\item \textbf{Feature Data}: The 32-bit values representing either the
486+
device-offered feature bits or the driver-selected subset for the
487+
selected blocks.
487488
\end{itemize}
488489

489490
Virtio-msg device feature blocks may include core virtio feature bits. They are
@@ -499,11 +500,11 @@ \subsubsection{Device Feature Blocks}
499500
features a device implements, the device MUST return zero for the
500501
feature data in those positions.
501502
\item After processing \msgref{SET_DRIVER_FEATURES}, a device MUST update
502-
only the acknowledged feature blocks addressed by that request and MUST
503-
leave all other acknowledged feature blocks unchanged.
504-
\item After processing \msgref{SET_DRIVER_FEATURES}, a device MUST report the
505-
resulting acknowledged feature set consistently in subsequent
506-
\msgref{GET_DEVICE_FEATURES} responses.
503+
only the driver-selected feature blocks addressed by that request and
504+
MUST leave all other driver-selected feature blocks unchanged.
505+
\item A device MUST report the device-offered feature set in
506+
\msgref{GET_DEVICE_FEATURES} responses and MUST NOT reflect the
507+
driver-selected subset in those responses.
507508
\end{itemize}
508509

509510
\subsubsection{Error Signaling}
@@ -819,7 +820,7 @@ \subsubsection{Initialization Flow Overview}
819820
\msgref{SET_DEVICE_STATUS}.
820821
\item \textbf{Negotiate Device Features:}
821822
Read device feature blocks via \msgref{GET_DEVICE_FEATURES}, decide which
822-
to enable, and acknowledge them via one or more
823+
to enable, and send the selected subset via one or more
823824
\msgref{SET_DRIVER_FEATURES} requests. Verify FEATURES\_OK via
824825
\msgref{SET_DEVICE_STATUS}. Transport feature bits are bus-instance
825826
parameters and are determined separately from this per-device exchange.
@@ -878,7 +879,7 @@ \subsubsection{Feature Negotiation}
878879
Drivers read available device feature bits in 32-bit blocks using
879880
\msgref{GET_DEVICE_FEATURES}; the device returns the requested bitfields,
880881
padding with zeros for any out-of-range blocks. To enable selected device
881-
features, the driver acknowledges the desired blocks with one or more
882+
features, the driver sends the desired subset with one or more
882883
\msgref{SET_DRIVER_FEATURES} requests and then updates the device status via
883884
\msgref{SET_DEVICE_STATUS}, checking whether the FEATURES\_OK bit remains set.
884885
Transport feature bits are bus-instance
@@ -900,9 +901,9 @@ \subsubsection{Feature Negotiation}
900901
\devicenormative{\paragraph}{Feature Negotiation}{Virtio Transport Options / Virtio Over Messages / Device Initialization / Device Features / Device}
901902
\begin{itemize}
902903
\item A device MUST NOT offer VIRTIO\_F\_NOTIF\_CONFIG\_DATA.
903-
\item If the device cannot support the resulting acknowledged feature set
904-
after processing \msgref{SET_DRIVER_FEATURES}, it MUST clear the
905-
FEATURES\_OK bit in the status returned by \msgref{SET_DEVICE_STATUS}.
904+
\item If the device cannot support the driver-selected feature set presented
905+
before FEATURES\_OK is processed, it MUST clear the FEATURES\_OK bit in
906+
the status returned by \msgref{SET_DEVICE_STATUS}.
906907
\end{itemize}
907908

908909
\subsubsection{Device Configuration}
@@ -1308,7 +1309,8 @@ \subsubsection{Overview}
13081309

13091310
Drivers retrieve device feature bits in 32-bit blocks via
13101311
\msgref{GET_DEVICE_FEATURES}; the response echoes the requested block index and
1311-
returns one or more 32-bit values with the feature bits in that range.
1312+
returns one or more 32-bit values with the device-offered feature bits in that
1313+
range.
13121314

13131315
\begin{lstlisting}
13141316
struct virtio_msg_get_device_features_req {
@@ -1335,17 +1337,17 @@ \subsubsection{Overview}
13351337

13361338
\msgdef{SET_DRIVER_FEATURES}
13371339

1338-
Drivers use \msgref{SET_DRIVER_FEATURES} to acknowledge the subset of feature
1340+
Drivers use \msgref{SET_DRIVER_FEATURES} to convey the subset of feature
13391341
bits they wish to enable. The payload mirrors \msgref{GET_DEVICE_FEATURES},
13401342
supplying an index, count, and 32-bit feature data for the selected blocks.
13411343
Each \msgref{SET_DRIVER_FEATURES} request updates only the addressed blocks;
13421344
blocks outside the addressed range are unchanged. Drivers MAY send multiple
13431345
\msgref{SET_DRIVER_FEATURES} requests at different block offsets before setting
1344-
FEATURES\_OK.
1346+
FEATURES\_OK. The response has no payload.
13451347

13461348
\begin{lstlisting}
13471349
struct virtio_msg_set_driver_features_req {
1348-
le32 block_index; /* starting block being acknowledged */
1350+
le32 block_index; /* starting block being selected */
13491351
le32 num_blocks; /* number of blocks provided */
13501352
le32 features[]; /* num_blocks entries with desired bits */
13511353
};
@@ -1360,7 +1362,7 @@ \subsubsection{Overview}
13601362
\item A driver MUST set only the feature bits it intends to enable in the
13611363
blocks supplied to \msgref{SET_DRIVER_FEATURES}.
13621364
\item A driver MAY use multiple \msgref{SET_DRIVER_FEATURES} requests with
1363-
different \field{block_index} values to build the final acknowledged
1365+
different \field{block_index} values to build the final driver-selected
13641366
feature set before setting FEATURES\_OK.
13651367
\end{itemize}
13661368

0 commit comments

Comments
 (0)