Thread (16 messages) 16 messages, 3 authors, 2025-08-13

Re: [RFC PATCH 0/6] virtio: Add support for Virtio message transport

From: Viresh Kumar <viresh.kumar@linaro.org>
Date: 2025-08-13 06:28:26
Also in: linux-devicetree, lkml

On 12-08-25, 08:28, Rob Herring wrote:
On Tue, Aug 12, 2025 at 4:50 AM Viresh Kumar [off-list ref] wrote:
quoted
I tried something like this now:

      reserved-memory {
        #address-cells = <2>;
        #size-cells   = <2>;
        ranges;

        rmem@100000000 {
          compatible = "restricted-dma-pool", "virtio-msg,loopback";
The order is wrong here. The 2nd one seems more specific to me.
Right.
But is "restricted-dma-pool" useful?
I need this to call kernel/dma/swiotlb.c: rmem_swiotlb_setup(), which
makes all the memory allocation for the device happen from that area.
Should an OS that only understands that and not
"virtio-msg,loopback" use it?
Since the reserved memory isn't linked to a device in the DT (via the
"memory-region" property), I don't expect an OS to use it without
virtio-msg.
The format of compatibles is <vendor>,<device/block/interface> and
"virtio-msg" is not a vendor.
"virtio,msg" is fine then I guess ? Just like "virtio,mmio".
quoted
          reg = <0x00000001 0x00000000  0x0 0x00400000>; /* 4 MiB */
        };
      };

and this works fine. I am adding two compatibles for virtio-msg:
"virtio-msg,loopback" and "virtio-msg,ffa". Yes I will properly
document them in the next version.
Why do you need 2 compatibles? Can't you discover what the remote end
is with some message? We only define "virtio-mmio" in DT for example,
not that the device is a console, rng, etc.
In case of virtio-mmio, the reg-range is trapped by the other side and
meaningful MMIO messages are exchanged. And so the OS knows the kind
of device the DT node is related to.

In this case however, this memory is going to be used for virtqueues
and buffers and I don't see a way of communicating the device type
here. Maybe I can get rid of two compatibles and add a property that
links to a device type ? The memory is otherwise exactly same in both
the cases, it is just about which device is using it eventually.

-- 
viresh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help