Hello,
I will try to send this upstream early next week.
V2:
- Don't limit get/set config to 8 bytes only.
- Improved direct/indirect message handling.
- Take care of EBUSY error during indirect message.
- Static assertions.
-------------------------8<-------------------------
Hello,
This RFC series introduces support for a new Virtio transport type:
"virtio-msg", as proposed in [1]. Unlike existing transport types like
virtio-mmio or virtio-pci which rely on memory-mapped registers, virtio-msg
implements transport operations via structured messages. Those messages can be
transported through different mechanisms such as mailboxes, shared memory based
FIFO or specific protocols such as FF-A on Arm.
This series includes:
- Core virtio-msg transport support.
- Two message transport bus implementations:
- virtio-msg-ffa: based on ARM's Firmware Framework for Arm (FF-A).
- virtio-msg-loopback: a loopback device for testing and validation.
The code is available here for reference: [3] and virtio-msg loopback test setup
is explained here: [2].
This series is based on v6.16-rc6 and depends on commit [4] from linux-next.
### Memory Mapping and Reserved Memory Usage
The first two patches enhance the reserved-memory subsystem to support attaching
struct device`s that do not originate from DT nodes—essential for virtual or
dynamically discovered devices like the FF-A or loopback buses.
This reserved-memory region enables:
- Restricting all DMA-coherent and streaming DMA memory to a controlled range.
- Allowing the remote endpoint to pre-map this memory, reducing runtime overhead.
- Preventing unintentional data leaks, since memory is typically shared at page
granularity.
- For the loopback bus, it restricts the portion of kernel memory that can be
mapped into userspace, improving safety.
Device association with reserved-memory regions is based on DT node naming
conventions, such as vmsglb@ or vmsgffa@, similar to the remoteproc framework’s
approach.
Feedback on the design, API, and approach is welcome.
--
Viresh
[1] https://lore.kernel.org/all/20250620224426.3923880-2-bill.mills@linaro.org/
[2] https://linaro.atlassian.net/wiki/spaces/HVAC/pages/30104092673
[3] git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git virtio/msg-rfc-v1
[4] From linux-next: 5be53630b4f0 virtio-mmio: Remove virtqueue list from mmio device
Viresh Kumar (6):
of: reserved-memory: Add reserved_mem_device_init()
of: reserved-memory: Add of_reserved_mem_lookup_by_name
virtio: Add support for virtio-msg transport
virtio-msg: Add optional userspace interface for message I/O
virtio-msg: Add support for FF-A (Firmware Framework for Arm) bus
virtio-msg: Add support for loopback bus
MAINTAINERS | 7 +
drivers/of/of_reserved_mem.c | 91 ++--
drivers/virtio/Kconfig | 34 ++
drivers/virtio/Makefile | 5 +
drivers/virtio/virtio_msg.c | 611 +++++++++++++++++++++++++++
drivers/virtio/virtio_msg.h | 88 ++++
drivers/virtio/virtio_msg_ffa.c | 505 ++++++++++++++++++++++
drivers/virtio/virtio_msg_loopback.c | 323 ++++++++++++++
drivers/virtio/virtio_msg_user.c | 119 ++++++
include/linux/of_reserved_mem.h | 13 +
include/uapi/linux/virtio_msg.h | 221 ++++++++++
include/uapi/linux/virtio_msg_ffa.h | 94 +++++
include/uapi/linux/virtio_msg_lb.h | 22 +
13 files changed, 2109 insertions(+), 24 deletions(-)
create mode 100644 drivers/virtio/virtio_msg.c
create mode 100644 drivers/virtio/virtio_msg.h
create mode 100644 drivers/virtio/virtio_msg_ffa.c
create mode 100644 drivers/virtio/virtio_msg_loopback.c
create mode 100644 drivers/virtio/virtio_msg_user.c
create mode 100644 include/uapi/linux/virtio_msg.h
create mode 100644 include/uapi/linux/virtio_msg_ffa.h
create mode 100644 include/uapi/linux/virtio_msg_lb.h
--
2.31.1.272.g89b43f80a514
All,
I have pushed and tagged a new version of the hvac-demo repo.
I have also updated the pre-built container image at:
docker.io/wmills/hvac-demo
Remember you may need to pull the container image again to see the new version:
podman pull docker.io/wmills/hvac-demo
- or -
docker pull docker.io/wmills/hvac-demo
Changes include:
* added demo-loopback to show virtio-msg-loopback (based on Viresh's work)
* added demo-amp-qemu-pci with virtio-msg-amp on an emulated pcie card in QEMU
* renamed all the demos to describe the demo instead of numbers
* rebased demo-ffa-xen to use Viresh's latest kernel and rust code
* other demos are just renamed
Old name New name
----------------------------------
new demo-loopback
new demo-amp-qemu-pci
demo1 demoo-ffa-xen
demo2a (deleted)
demo2b demo-proxy-qemu
demo3 demo-amp-zephyr
demo4 demo-amp-dual-linux
The following issues are known:
1) demo-ffa-xen hangs or crashes 1 out of 5 or 10 times
Just run again if you see this
2) ./Build all does not build linux-virtio-msg-v2, use
./Build all linux-virtio-msg-amp-v2
You do not need to build the demos to run them
3) The timeout in demo-amp-dual-linux to too short for VERY slow systems
Most people won't see this issue. I was testing on a RPiv5
Fixes for the last two issues are in the wip-v0.6-fixes branch.
--
Bill Mills
Principal Technical Consultant, Linaro
+1-240-643-0836
TZ: US Eastern
Work Schedule: Tues/Wed/Thur