libxl/arm: Create specific IOMMU node to be referred by virtio-mmio device
authorOleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Fri, 15 Jul 2022 19:20:26 +0000 (22:20 +0300)
committerJulien Grall <jgrall@amazon.com>
Thu, 28 Jul 2022 18:26:37 +0000 (19:26 +0100)
commitca45d3cb4586372909f350e54482246f994e1bc7
treeca74c0fef4576bf7c7bc424b3b8480c64aa4e9ea
parent2128143c114c52c7536e37c32935fdd77f23edc1
libxl/arm: Create specific IOMMU node to be referred by virtio-mmio device

Reuse generic IOMMU device tree bindings to communicate Xen specific
information for the virtio devices for which the restricted memory
access using Xen grant mappings need to be enabled.

Insert "iommus" property pointed to the IOMMU node with "xen,grant-dma"
compatible to all virtio devices which backends are going to run in
non-hardware domains (which are non-trusted by default).

Based on device-tree binding from Linux:
Documentation/devicetree/bindings/iommu/xen,grant-dma.yaml

The example of generated nodes:

xen_iommu {
    compatible = "xen,grant-dma";
    #iommu-cells = <0x01>;
    phandle = <0xfde9>;
};

virtio@2000000 {
    compatible = "virtio,mmio";
    reg = <0x00 0x2000000 0x00 0x200>;
    interrupts = <0x00 0x01 0xf01>;
    interrupt-parent = <0xfde8>;
    dma-coherent;
    iommus = <0xfde9 0x01>;
};

virtio@2000200 {
    compatible = "virtio,mmio";
    reg = <0x00 0x2000200 0x00 0x200>;
    interrupts = <0x00 0x02 0xf01>;
    interrupt-parent = <0xfde8>;
    dma-coherent;
    iommus = <0xfde9 0x01>;
};

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
tools/libs/light/libxl_arm.c
xen/include/public/device_tree_defs.h