Skip to content

Conversation

@wmamills
Copy link
Collaborator

@wmamills wmamills commented Oct 16, 2025

Redone after discussion at Oct 23 meeting

PDF version here

  • Dropped the "remove redundant length fields" commit
  • Added GET/SET_VQUEUE padding
  • A few fixups/simplifications for response matching

---- Older
Redone after discussion at Oct 16 meeting

PDF version here

Included @bertrand-marquis patches as-is and then made my changes as new commits. I was going to keep that branch for transparency but squash them for the PR. I decided instead to not squash in the PR for better local project transparency. When we do PATCHv1 or RFCv3 all local commits will be squashed anyway.

DROPPED

  • virtio-msg: add req_id to common header

ADDED:

  • virtio-msg: 8 byte header with unique identifier
    • virtio-msg: revert chucks of msg_id -> msg_op
    • virtio-msg: rename msg_uid to token and msg_op back to msg_id
  • virtio-msg: introduce a message correlation protocol
    • virtio-msg: fix up message correlation protocol
  • virtio-msg: Relax error handling in the bus
    • virtio-msg: Fix-up error handling in the bus

As before:

  • virtio-msg: remove redundant length fields
  • virtio-msg: editorial changes from Matias
  • virtio-msg: editorial changes from Peter
    • Minor fixups in message header, use new text but use types from Peter

bertrand-marquis and others added 6 commits October 9, 2025 09:48
Move the header to be 8 bytes and include a unique identifier that can
be use to correlate request to responses.

Rename the msg_id field to msg_op as having a msg_id and msg_uid field
and using identifiers in 2 contexts would have been unclear.

Rework ID to OP and change wording message identifer to message
operation to be coherent in the rest of the specification.

Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
This reverts commit 4c2274c.

Signed-off-by: Bill Mills <bill.mills@linaro.org>
Rename these as agreed in the meeting on Oct 17.

Signed-off-by: Bill Mills <bill.mills@linaro.org>
Add a sub-section to do a first explanation draft of how the message
correlation is to be done using a combination of a message device number
and the message unique identifier value.

Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
* change msg_uid to token and msg_op back to msg_id
* More explicitly define tuple
* Use "request originator" not "driver"
* Restate that Requests have responses and Events don't in intro then
  drop those qualifications from the rules.
  Otherwise it sounds like some requests might not have responses and
  some events might have them
* Specify that an implementation does not need to support sending
  multiple requests in parallel
* Use the word "assign" not "allocate" as it is less suggestive of
  implementation choice

Signed-off-by: Bill Mills <bill.mills@linaro.org>
Relax error handling in the virtio-msg bus and introduce wording to
allow the virtio-msg bus to report error to the virtio-msg transport if
a request could not be transmited or a malformed response was received.

This prevents the need to generate dummy responses in the bus and make
the specification coherent with the current Linux PoC implementation.

Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
@wmamills wmamills changed the title Proposed changes Oct 16: req_id, redundant messages sizes and editorial input from Matias and Peter Proposed changes Oct 16: token and response matching, error handling, redundant messages sizes and editorial input from Matias and Peter Oct 18, 2025
* change msg_op back to msg_id

Signed-off-by: Bill Mills <bill.mills@linaro.org>
Copy link
Collaborator

@bertrand-marquis bertrand-marquis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments.
I am also not really a fan of removing the size fields in specific messages as it makes the computation and text a bit more complex.

\item The request originator assigns a non-zero \field{token} for every
request such that the tuple is unique for all inflight requests.
\item Event (one-way) messages \textbf{MUST} set \field{token}=0
\item A response \textbf{MUST} echo \field{token}, \field{dev_num} (for
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even for bus messages, dev_num (which should be 0) should be echoed. SO i suggest remove "(for transport)"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bertrand-marquis This should be updated in this PR with a new commit.
If you agree please close this part of the convo; if not add comments to that commit

request such that the tuple is unique for all inflight requests.
\item Event (one-way) messages \textbf{MUST} set \field{token}=0
\item A response \textbf{MUST} echo \field{token}, \field{dev_num} (for
transport), and \field{msg_id}.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to remove msg_id here. Correlation should only be based on dev_num and token.
In some cases, the bus might use a different message id for responses.
I have 2 examples in ffa bus:

  • event poll which returns an event as response to a poll
  • bus error messages which are returned in case of error to a request

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, can we then also say that dev_num should match even in the case of bus messages? After all 0 == 0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bertrand-marquis same for this one and others

\textbf{SHOULD} result in discarding the response without further protocol
action.
\item Implementations \textbf{MAY} deliver responses out of order unless a
specific message definition mandates ordering.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have this case ?
I am wondering if we should not completely remove the "unless ..." here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are cases where order has to be enforced but I don't think it is mandated by the "message definition" and I think it is up to the sender to wait for responses before sending new messages.

So, yes, I think we can drop the last sentence

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

\msgref{SET_CONFIG}, providing:
\begin{itemize}
\item \textbf{Offset} and \textbf{Number of bytes},
\item \textbf{Offset},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the paragraph just before we say that the driver supplies "offset and number of bytes". We might want to update that part or specify here that the number of bytes is deducted from the payload size in the header

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropped this commit

A feature block is a group of 32 bits. The feature data \emph{MUST} be a
multiple of 4 bytes in length.
multiple of 4 bytes in length. The number of feature blocks is calculated from
the message length in the common message header.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we would make all that simpler by no enforcing feature blocks of 32bits.
But i am really not a fan of removing those size fields after reading the result

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropped this commit

Copy link
Collaborator

@edgarigl edgarigl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if itwas intentional but you may have forgotten to remove the number of blocks from the get_features response (I understand it must be there in the get_features request).

Looking at get_config, the number of bytes is in the request but not in the response.

@wmamills
Copy link
Collaborator Author

@edgarigl said "Not sure if itwas intentional but you may have forgotten to remove the number of blocks from the get_features response"

OK if we keep the commit, I will fix that

* drop 'underlying'
* add MUST to Optional Bus Messages
* s/tables/table/
  (Matias suggested s/defines/define/ but there is only one table ATM)
  (Also change table defines to table lists to avoid double "define")
* If the bus adds s/it/its/
* Fix feature {itemize} list
  * drop verb from {Block Index}
  * Also fix s/32 bits values/32 bit values/
* drop \emph{chooses} in two places
* s/defines/defined/ in Endianness section
* add "and the buffer has been added to the used ring of the virtqueue"
* s/in band/in-band and s/out of band event/out-of-band event
* (Did not add "on", the sentience reads ok without it)
* Replace sentence with "it should prevent this feature ..."
* s/standardizes/standardized/
* Fix sentence about PING being optional

Signed-off-by: Bill Mills <bill.mills@linaro.org>
* add missing ')'
* clarify that bus properties are advertised from the bus to the transport
  layer and change "driver" to bus or transport layer to more clearly
  show whom is targeted by the requirements
* Avoid passive voice and clearly specify which element must conform
* s/All encoding of values and fields/All values and fields/
* Use u8 and le16 types for virtio_msg_message
* s/must be zero of Bus messages/must be zero for Bus messages/
* use ':' at end of item in list, not ';'
* Add missing verb and s/posted/available in Runtime Notifications


Signed-off-by: Bill Mills <bill.mills@linaro.org>
Align 8 byte fields to offsets that are multiples of 8.

Messages are byte streams not directly addressable C structures.
Custom messages may use any field alignment they wish.

However, for the current standard messages there is no harm in aligning
them.

This only effects GET_VQUEUE and SET_VQUEUE.

Signed-off-by: Bill Mills <bill.mills@linaro.org>
Simplify the response matching as discussed in the PR and in the Oct 23
meeting.

* Bus messages have a dev_num and it is normally 0 so we don't need to
  say that matching dev_num if only for transport messages.
* Drop msg_id from matching.  Altough the msg_id would normally match
  there may be some cases where it would not.  The token field should
  be unique for a given dev_num.
* This simplifys the description of the matching tuple as well

Signed-off-by: Bill Mills <bill.mills@linaro.org>
Copy link
Collaborator

@bertrand-marquis bertrand-marquis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to discuss the point on correlation responsibility but this is definitely not a reason to block this. Just something to remember.


Rules:
\begin{itemize}
\item The request originator assigns a non-zero \field{token} for every
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have something unclear here that we should define: who is generating the token and handling the correlation ? All models are possible:

  1. transport generating the token and doing correlation
  2. bus generating token and doing correlation
  3. transport generating token and bus doing correlation
  4. bus generating token and transport doing correlation

In my view solutions 3 and 4 do not make sense as the one doing correlation must be in charge of generating the token.

I see some arguments to consider:

  • a bus that only handles one message a time does not need the token -> in favor of 2
  • a bus doing the correlation would want to generate itself the token, same for transport -> against 3 and 4
  • having the token and correlation handled at transport level would allow to reuse some code and simplify the bus work -> in favor of 1
  • in case of 1, the bus would still have to handle its own correlation for bus messages -> in favor of 2
  • OS blocking semantics for drivers might be easier to handle in the transport to prevent busses to potentially block where they should not -> in favor of 1

I am in favor of 1, even if the bus would have to handle correlation for its own messages because of the OS blocking semantics arguments but definitely something open for discussion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today AMP does the thread resumption in the bus. Resuming the right thread means matching the token. So this is number 2 above. This is required from the nature of the interface between transport and bus: one call with pointer to tx data and (optional) pointer to rx buffer.

If we change to number 1 we would need to change the interface between transport and bus.

Of course this choice can be made per implementation. Linux could do it one way and BSD or RTOS a different way. So I would prefer to keep it out of the virtio spec.

Copy link
Collaborator Author

@wmamills wmamills Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this discussion to Issue #26 so we can find it easily after this PR is closed

@bertrand-marquis
Copy link
Collaborator

bertrand-marquis commented Oct 25, 2025 via email

@wmamills wmamills merged commit fb00064 into Linaro:virtio-msg-rfc2 Nov 2, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants