summaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/bindings/virtio/iommu.txt
blob: 2407fea0651c9232646506894582e205e761d91b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
* virtio IOMMU PCI device

When virtio-iommu uses the PCI transport, its programming interface is
discovered dynamically by the PCI probing infrastructure. However the
device tree statically describes the relation between IOMMU and DMA
masters. Therefore, the PCI root complex that hosts the virtio-iommu
contains a child node representing the IOMMU device explicitly.

Required properties:

- compatible:	Should be "virtio,pci-iommu"
- reg:		PCI address of the IOMMU. As defined in the PCI Bus
		Binding reference [1], the reg property is a five-cell
		address encoded as (phys.hi phys.mid phys.lo size.hi
		size.lo). phys.hi should contain the device's BDF as
		0b00000000 bbbbbbbb dddddfff 00000000. The other cells
		should be zero.
- #iommu-cells:	Each platform DMA master managed by the IOMMU is assigned
		an endpoint ID, described by the "iommus" property [2].
		For virtio-iommu, #iommu-cells must be 1.

Notes:

- DMA from the IOMMU device isn't managed by another IOMMU. Therefore the
  virtio-iommu node doesn't have an "iommus" property, and is omitted from
  the iommu-map property of the root complex.

Example:

pcie@10000000 {
	compatible = "pci-host-ecam-generic";
	...

	/* The IOMMU programming interface uses slot 00:01.0 */
	iommu0: iommu@0008 {
		compatible = "virtio,pci-iommu";
		reg = <0x00000800 0 0 0 0>;
		#iommu-cells = <1>;
	};

	/*
	 * The IOMMU manages all functions in this PCI domain except
	 * itself. Omit BDF 00:01.0.
	 */
	iommu-map = <0x0 &iommu0 0x0 0x8>
		    <0x9 &iommu0 0x9 0xfff7>;
};

pcie@20000000 {
	compatible = "pci-host-ecam-generic";
	...
	/*
	 * The IOMMU also manages all functions from this domain,
	 * with endpoint IDs 0x10000 - 0x1ffff
	 */
	iommu-map = <0x0 &iommu0 0x10000 0x10000>;
};

ethernet@fe001000 {
	...
	/* The IOMMU manages this platform device with endpoint ID 0x20000 */
	iommus = <&iommu0 0x20000>;
};

[1] Documentation/devicetree/bindings/pci/pci.txt
[2] Documentation/devicetree/bindings/iommu/iommu.txt