Skip to content

Commit 53ef5f8

Browse files
virtio-msg: switch generation count to normative
Rework Generation Count section in basic concept to use normative statements. Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
1 parent 5be24d3 commit 53ef5f8

1 file changed

Lines changed: 23 additions & 20 deletions

File tree

transport-msg.tex

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -258,28 +258,31 @@ \subsubsection{Configuration Generation Count}
258258

259259
Each device maintains a \textbf{Configuration Generation Count} to prevent
260260
inconsistent updates. This count is incremented at least once by the device for
261-
every driver visible change it makes to its own copy of the configuration data.
262-
A configuration change is made visible to the driver via \msgref{EVENT_CONFIG}
263-
or the response to \msgref{GET_CONFIG} which also both provide the device's
264-
current configuration count. The device MAY change any amount of data for one
265-
generation count increment. If the change cannot fit in one \msgref{EVENT_CONFIG}
266-
message, the device SHOULD send an \msgref{EVENT_CONFIG} message
267-
with a zero data length and the new generation count to the driver.
268-
The device MUST NOT provide the same generation count in
269-
multiple \msgref{EVENT_CONFIG} messages that contain non-zero length config
270-
data. The driver includes its view of the current generation count in
271-
\msgref{SET_CONFIG} requests. The configuration generation count does not
272-
necessarily start at 0 and SHOULD NOT reset to 0 on device reset.
261+
every driver-visible change it makes to its configuration data. The current
262+
count is exposed in \msgref{EVENT_CONFIG} and \msgref{GET_CONFIG} responses so
263+
the driver can determine whether its view of the configuration is current. The
264+
count does not necessarily start at zero and is not automatically reset when
265+
the device resets.
273266

267+
\devicenormative{\paragraph}{Configuration Generation Count (Device)}{Virtio Transport Options / Virtio Over Messages / Basic Concepts / ConfigGen / Device}
274268
\begin{itemize}
275-
\item If the driver's generation count does not match the device's current
276-
count, the \msgref{SET_CONFIG} request MUST be rejected by the
277-
device.
278-
\item The driver MAY have received \msgref{EVENT_CONFIG} messages
279-
between the request and the response and will know the current
280-
configuration data and generation count. If not it SHOULD
281-
re-read the configuration and generation count via \msgref{GET_CONFIG}),
282-
and then resend the \msgref{SET_CONFIG} if still desired.
269+
\item A device MUST increment the generation count before it makes a change that is visible to the
270+
driver and MUST ensure that each \msgref{EVENT_CONFIG} carrying configuration data uses a
271+
unique generation count.
272+
\item If updated configuration data cannot fit in a single \msgref{EVENT_CONFIG}, the device SHOULD
273+
send an \msgref{EVENT_CONFIG} with zero data length to advertise the new generation count and
274+
MUST make the updated data available via \msgref{GET_CONFIG}.
275+
\item If a \msgref{SET_CONFIG} request includes a generation count that does not match the device's
276+
current count, the device MUST reject the request.
277+
\end{itemize}
278+
279+
\drivernormative{\paragraph}{Configuration Generation Count (Driver)}{Virtio Transport Options / Virtio Over Messages / Basic Concepts / ConfigGen / Driver}
280+
\begin{itemize}
281+
\item A driver MUST track the most recent generation count observed (via \msgref{EVENT_CONFIG} or
282+
\msgref{GET_CONFIG}) and include it in every \msgref{SET_CONFIG} request.
283+
\item If a \msgref{SET_CONFIG} request is rejected due to a mismatched generation count, the driver
284+
SHOULD issue \msgref{GET_CONFIG} to obtain the latest configuration data and generation count
285+
before retrying.
283286
\end{itemize}
284287

285288
This mechanism ensures updates are not lost or overwritten due to stale

0 commit comments

Comments
 (0)