All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC v2 0/1] virtio-msg transport layer
@ 2025-06-20 22:44 Bill Mills
  2025-06-20 22:44 ` [PATCH RFC v2 1/1] virtio-msg: Add virtio-msg, a message based virtio " Bill Mills
  2026-01-21 17:26 ` [PATCH RFC v2 0/1] virtio-msg " Manivannan Sadhasivam
  0 siblings, 2 replies; 11+ messages in thread
From: Bill Mills @ 2025-06-20 22:44 UTC (permalink / raw)
  To: virtio-comment
  Cc: Bertrand Marquis, Edgar E . Iglesias, Arnaud Pouliquen,
	Viresh Kumar, Alex Bennee, Bill Mills

This series adds the virtio-msg transport layer.

The individuals and organizations involved in this effort have had difficulty in
using the existing virtio-transports in various situations and desire to add one
more transport that performs its transport layer operations by sending and
receiving messages.

Implementations of virtio-msg will normally be done in multiple layers:
* common / device level
* bus level

The common / device level defines the messages exchanged between the driver
and a device. This common part should lead to a common driver holding most
of the virtio specifics and can be shared by all virtio-msg bus implementations.
The kernel implementation in [3] shows this separation. As with other transport
layers, virtio-msg should not require modifications to existing virtio device
implementations (virtio-net, virtio-blk etc). The common / device level is the
main focus of this version of the patch series.

The virtio-msg bus level implements the normal things a bus defines
(enumeration, dma operations, etc) but also implements the message send and
receive operations. A number of bus implementations are envisioned,
some of which will be reusable and general purpose. Other bus implementations
might be unique to a given situation, for example only used by a PCIe card
and its driver.

How much of the bus level should be described in the virtio spec is one item
we wish to discuss. This draft takes a middle approach by describing the bus
level and defining some standard bus level messages that MAY be used by the bus.
It also describes a range of bus messages that are implementation dependent.

The standard bus messages are an effort to avoid different bus implementations
doing the same thing in different ways for no good reason. However the
different environments will require different things. Instead of trying to
anticipate all needs and provide something very abstract, we think
implementation specific messages will be needed at the bus level. Over time,
if we see similar messages across multiple bus implementations, we will move to
standardize a bus level message for that.

We are working on two reusable bus implementations:

* virtio-msg-ffa based on Arm FF-A interface for use between:
  * normal world and secure world
  * host and VM or VM to VM
  * Can be used w/ or with out a hypervisor
  * Any Hypervisor that implements FF-A can be used

* virtio-msg-amp for use between heterogenous systems
  * The main processors and its co-processors on an AMP SOC
  * Two or more systems connected via PCIe
  * Minimal requirements: bi-directional interrupts and
    at least one shared memory area

We also anticipate a few more:

* virtio-msg-xen specific to Xen
  * Usable on any Xen system (including x86 where FF-A does not exist)
  * Using Xen events and page grants

* virtio-msg-loopback for userspace implemented devices
  * Allows user space to provide devices to its own kernel
  * This is similar to fuse, cuse or loopback block devices but for virtio
  * Once developed this can provide a single kernel demo of virtio-msg
  * [Work has begun on this]

* virtio-msg over admin virtqueues
  * This allows any virtio-pci device that supports admin virtqueues to also
    support a virtio-msg bus that supports sub devices
  * [We are looking for collaborators for this work]

Changes since RFC1:
* reformated document to better conform to the virtio spec style
  - created an introduction chapter
  - created a basic concept chapter
  - created bus operation and device initialization and operation chapters
  - reworked description of transport and bus messages
  - attempted a "compliance chapter"
  - reused spec macros
  - switched to MAY/MUST/SHALL/SHOULD wording
  - eliminate the use of terms front-end and back-end and use driver and device
* made the maximum message size variable per bus instance
* use "device number" for virtio-msg device instances on the bus instead of
  adding yet another meaning for "device ID"
* added the configuration generation count and its use
* described types of things that can be done with bus specific messages
  such as setup of bus level shared memory and out of band notifications
* removed wording of notification being optional at transport level and
  described bus level notifications of in-band, out-of-band, and polled
  from driver side bus
* removed the ERROR message from transport level. Errors should be handled at
  the bus level to better match virtio-pci and virtio-mmio
* removed bus level reset and status from standard bus messages
* replaced bus messages DEVICE_{ADDED,REMOVED} with EVENT_DEVICE
* changed names to GET_DEVICE_FEATURES and SET_DRIVER_FEATURES for clarity
* made SET_DEVICE_STATE return new state as it may not match
* Don't echo back the data in SET_VQUEUE (it cannot change)
* defined request/response vs event message id ranges
* match field size of next offset and wrap to virtio-{pci,mmio}
* added maximum number of virtqueues to DEVICE_INFO
* added admin virtqueue and SHM support

This series is a work in progress and we acknowledge at least the following
issues we need to work on:

* Better conformance documentation
* Publish an update to Arm FF-A spec that shows virtio-msg binding (work underway)
* Publish virtio-msg-amp data structures and messages somewhere
* Align implementations to this version and send PATCH v1 (non-rfc)

Background info and work in progress implementations:
* HVAC project page with intro slides [1]
* HVAC demo repo w/ instructions in README.md [2]
* Kernel w/ virtio-msg common level and ffa support [3]
* QEMU w/ support for one form of virtio-msg-amp [4]
* Portable RTOS library w/ one form of virtio-msg-amp [5]

In addition to the QEMU system based demos in the hvac-demo repo, we also have
two hardware systems running:
* AMD x86 + AMD Arm Versal connected via PCIe
* ST STM32MP157 A7 Linux using virtio-i2c provided by M4 Zephyr

Please note that although the demos work, they are not yet aligned with each
other nor this version of the spec.

[1] https://linaro.atlassian.net/wiki/spaces/HVAC/overview
[2] https://github.com/wmamills/hvac-demo
[3] https://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git/log/?h=virtio/msg
[4] https://github.com/edgarigl/qemu/commits/edgar/virtio-msg-new
[5] https://github.com/arnopo/open-amp/commits/virtio-msg/

Bill Mills (1):
  virtio-msg: Add virtio-msg, a message based virtio transport layer

 content.tex       |    1 +
 transport-msg.tex | 1354 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1355 insertions(+)
 create mode 100644 transport-msg.tex

-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [PATCH RFC v2 1/1] virtio-msg: Add virtio-msg, a message based virtio transport layer
@ 2026-03-06  1:33 Andrei Homescu
  2026-03-06  8:07 ` Bertrand Marquis
  0 siblings, 1 reply; 11+ messages in thread
From: Andrei Homescu @ 2026-03-06  1:33 UTC (permalink / raw)
  To: bill.mills
  Cc: alex.bennee, arnaud.pouliquen, Bertrand Marquis, edgar.iglesias,
	viresh.kumar, virtio-comment, Armelle Laine,
	Arve Hjønnevåg, Ayrton Munoz, ayrton, Andrei Homescu

Some minor comments below based on the Trusty implementation of
virtio-msg, and potential future issues for implementers:

> +  \item \textbf{Number of Feature Bits}: Indicates how many bits (organized in
> +    32-bit blocks) the device uses for feature negotiation.
I think v1 required this to be a multiple of 32, and would reject
invalid values (might be misremembering).
IMHO it would be simpler for implementers if this was "number of
feature blocks" instead, like in other places.
Is there a specific reason it is "bits" here?

> +The driver \emph{MAY} issue new \msgref{SET_VQUEUE} for virtqueues that have not
> +yet be setup.  If the VIRTIO_F_RING_RESET feature has been negotiated,
> +individual virtqueues can be reset and then optionally re-configured.
This implies that the device should reject SET_VQUEUE for queues that
have already been setup?
Or could a vqueue be configured multiple times?

> +\msgdef{SET_CONFIG}
> +
> +This message is sent by the virtio-msg transport driver and requires a
> +response from the device.
> +
> +\begin{tabular}{|l|l|l|l|}
> +\hline
> +Type & Offset & Size (bytes) & Content \\
> +\hline \hline
> +Request & 0 & 4 & Configuration generation count \\
> +& 4 & 4 & Configuration offset in bytes \\
> +& 8 & 4 & Number of bytes \\
> +& 12 & ... & Configuration data \\
> +\hline
> +Answer & 0 & 4 & New Configuration generation count \\
Is this a copy of the generation count from the request, or the actual
value from the device?

> +& 4 & 4 & Configuration offset in bytes \\
> +& 8 & 4 &  Number of bytes, or 0 if rejected \\
> +& 12 & ... & Configuration data \\
Is this empty in the "if rejected" case, or a copy of the request data?
My interpretation is "empty", but perhaps this should be specified.

> +\busdef{GET_DEVICES}
> +
> +This message is sent by the virtio-msg driver side bus and requires a response
> +from the device side bus.
> +
> +\begin{tabular}{|l|l|l|l|}
> +\hline
> +Type & Offset & Size (bytes) & Content \\
> +\hline \hline
> +Request & 0 & 2 & Offset \\
> +        & 2 & 2 & Number of device numbers requested \\
> +\hline
> +Answer & 0 & 2 & Offset \\
> +       & 2 & 2 & Number of device numbers in the answer \\
How should a driver handle the case where a misbehaving device sends
back more devices than requested? (in other words, if this value is
greater than the device count in the request)
Or is that not misbehaving?
A driver implementation could ask for e.g. 32 devices at a time and
store the resulting bitmap in a uint32_t.
How should it handle getting back more devices than it has space for?

> +The offset and number of device numbers requested \emph{MUST} be multiples of 8.
> +The next offset \emph{MUST} also be a multiple of 8.
Same question here as for feature bits: why not use bytes (defined as
8 bits, or alternatively octets) instead of bits as the unit for
GET_DEVICES?
Then the device implementation wouldn't need to check for and reject
invalid requests.

Andrei Homescu

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-03-06 10:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-20 22:44 [PATCH RFC v2 0/1] virtio-msg transport layer Bill Mills
2025-06-20 22:44 ` [PATCH RFC v2 1/1] virtio-msg: Add virtio-msg, a message based virtio " Bill Mills
2025-07-11 13:07   ` Peter Hilber
2025-09-01  9:20   ` Alex Bennée
2025-09-02 19:44     ` Matias Ezequiel Vara Larsen
2025-09-10 13:39   ` Matias Ezequiel Vara Larsen
2025-09-10 16:01     ` Bill Mills
2026-01-21 17:26 ` [PATCH RFC v2 0/1] virtio-msg " Manivannan Sadhasivam
  -- strict thread matches above, loose matches on Subject: below --
2026-03-06  1:33 [PATCH RFC v2 1/1] virtio-msg: Add virtio-msg, a message based virtio " Andrei Homescu
2026-03-06  8:07 ` Bertrand Marquis
2026-03-06 10:15   ` Bertrand Marquis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.