Cc'ing Gustavo
On 24/2/26 16:57, Edgar E. Iglesias wrote:
From: "Edgar E. Iglesias" <[email protected]>
This adds virtio-msg, a new virtio transport. Virtio-msg works by
exchanging messages over a bus and doesn't rely on trapping and emulation
making it a good fit for a number of applications such as AMP, real-time
and safety applications.
Together with the new transport, this series adds a PCI device that
implements an AMP setup much like it could look if two SoC's would
use virtio-msg across a PCI link.
Current gaps and limitations:
No support for SHM regions yet.
Temporarily uses PCI Vendor Xilinx / Device 0x9039.
The virtio-msg draft spec:
https://github.com/Linaro/virtio-msg-spec/
QEMU with these patches:
https://github.com/edgarigl/qemu/tree/edgar/virtio-msg-rfc
Linux with virtio-msg support:
https://github.com/edgarigl/linux/tree/edgari/virtio-msg-6.17
To try it, first build Linux with the following enabled:
CONFIG_VIRTIO_MSG=y
CONFIG_VIRTIO_MSG_AMP=y
CONFIG_VIRTIO_MSG_AMP_PCI=y
Boot linux on QEMU with a virtio-msg-amp-pci device, in this example
with a virtio-net device attached to it:
-device virtio-msg-amp-pci
-device virtio-net-device,netdev=n0
-netdev user,id=n0
If you're running on a QEMU machine that has virtio-mmio enabled, e.g
ARM virt, you'll need to specify the virtio-bus for the device, otherwise
QEMU will connect it to virtio-mmio. For ARM virt machines:
-device virtio-msg-amp-pci
-device
virtio-net-device,netdev=n0,bus=/gpex-pcihost/pcie.0/virtio-msg-amp-pci/fifo0/virtio-msg/bus0/virtio-msg-dev
-netdev user,id=n0
Cheers,
Edgar
ChangeLog:
v1 -> v2:
* Clamp get_features block count.
* Remove virtio notify_queue in favor of per queue vectors.
* Enable NOTIFICATION_DATA.
* Drop unpexpected responses rather than assert.
* Fix msg handler bounds check.
* Guard handlers against missing devices.
* Respond to bus pings.
* Add BUS_GET_DEVICES.
* Fix use of uninitialized var in virtio_msg_reset_hold.
* Fix EVENT_CONFIG message length.
* amp-pci: Fix fifo offset computation.
* amp-pci: Don't notify when dropping messages.
* Document virtio_queue_get_rings.
* Add virtio-msg-amp-pci.rst to index.rst.
Edgar E. Iglesias (4):
virtio: Add virtio_queue_get_rings
virtio: Add the virtio-msg transport
hw/misc: Add generic virtio-msg AMP PCI device
docs: Describe virtio-msg-amp-pci
docs/system/devices/virtio/index.rst | 1 +
.../devices/virtio/virtio-msg-amp-pci.rst | 92 ++
hw/misc/Kconfig | 7 +
hw/misc/meson.build | 1 +
hw/misc/virtio-msg-amp-pci.c | 361 +++++++
hw/virtio/Kconfig | 4 +
hw/virtio/meson.build | 5 +
hw/virtio/virtio-msg-bus.c | 89 ++
hw/virtio/virtio-msg.c | 986 ++++++++++++++++++
hw/virtio/virtio.c | 16 +
include/hw/virtio/spsc_queue.h | 213 ++++
include/hw/virtio/virtio-msg-bus.h | 95 ++
include/hw/virtio/virtio-msg-prot.h | 949 +++++++++++++++++
include/hw/virtio/virtio-msg.h | 56 +
include/hw/virtio/virtio.h | 14 +
15 files changed, 2889 insertions(+)
create mode 100644 docs/system/devices/virtio/virtio-msg-amp-pci.rst
create mode 100644 hw/misc/virtio-msg-amp-pci.c
create mode 100644 hw/virtio/virtio-msg-bus.c
create mode 100644 hw/virtio/virtio-msg.c
create mode 100644 include/hw/virtio/spsc_queue.h
create mode 100644 include/hw/virtio/virtio-msg-bus.h
create mode 100644 include/hw/virtio/virtio-msg-prot.h
create mode 100644 include/hw/virtio/virtio-msg.h