Linux-libre 5.4.48-gnu
[librecmc/linux-libre.git] / Documentation / devicetree / bindings / virtio / iommu.txt
1 * virtio IOMMU PCI device
2
3 When virtio-iommu uses the PCI transport, its programming interface is
4 discovered dynamically by the PCI probing infrastructure. However the
5 device tree statically describes the relation between IOMMU and DMA
6 masters. Therefore, the PCI root complex that hosts the virtio-iommu
7 contains a child node representing the IOMMU device explicitly.
8
9 Required properties:
10
11 - compatible:   Should be "virtio,pci-iommu"
12 - reg:          PCI address of the IOMMU. As defined in the PCI Bus
13                 Binding reference [1], the reg property is a five-cell
14                 address encoded as (phys.hi phys.mid phys.lo size.hi
15                 size.lo). phys.hi should contain the device's BDF as
16                 0b00000000 bbbbbbbb dddddfff 00000000. The other cells
17                 should be zero.
18 - #iommu-cells: Each platform DMA master managed by the IOMMU is assigned
19                 an endpoint ID, described by the "iommus" property [2].
20                 For virtio-iommu, #iommu-cells must be 1.
21
22 Notes:
23
24 - DMA from the IOMMU device isn't managed by another IOMMU. Therefore the
25   virtio-iommu node doesn't have an "iommus" property, and is omitted from
26   the iommu-map property of the root complex.
27
28 Example:
29
30 pcie@10000000 {
31         compatible = "pci-host-ecam-generic";
32         ...
33
34         /* The IOMMU programming interface uses slot 00:01.0 */
35         iommu0: iommu@0008 {
36                 compatible = "virtio,pci-iommu";
37                 reg = <0x00000800 0 0 0 0>;
38                 #iommu-cells = <1>;
39         };
40
41         /*
42          * The IOMMU manages all functions in this PCI domain except
43          * itself. Omit BDF 00:01.0.
44          */
45         iommu-map = <0x0 &iommu0 0x0 0x8>
46                     <0x9 &iommu0 0x9 0xfff7>;
47 };
48
49 pcie@20000000 {
50         compatible = "pci-host-ecam-generic";
51         ...
52         /*
53          * The IOMMU also manages all functions from this domain,
54          * with endpoint IDs 0x10000 - 0x1ffff
55          */
56         iommu-map = <0x0 &iommu0 0x10000 0x10000>;
57 };
58
59 ethernet@fe001000 {
60         ...
61         /* The IOMMU manages this platform device with endpoint ID 0x20000 */
62         iommus = <&iommu0 0x20000>;
63 };
64
65 [1] Documentation/devicetree/bindings/pci/pci.txt
66 [2] Documentation/devicetree/bindings/iommu/iommu.txt