Skip to content

Commit 6c9e92e

Browse files
Jean-Philippe Bruckermstsirkin
authored andcommitted
dt-bindings: virtio: Add virtio-pci-iommu node
Some systems implement virtio-iommu as a PCI endpoint. The operating system needs to discover the relationship between IOMMU and masters long before the PCI endpoint gets probed. Add a PCI child node to describe the virtio-iommu device. The virtio-pci-iommu is conceptually split between a PCI programming interface and a translation component on the parent bus. The latter doesn't have a node in the device tree. The virtio-pci-iommu node describes both, by linking the PCI endpoint to "iommus" property of DMA master nodes and to "iommu-map" properties of bus nodes. Reviewed-by: Rob Herring <[email protected]> Reviewed-by: Eric Auger <[email protected]> Signed-off-by: Jean-Philippe Brucker <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 8447d84 commit 6c9e92e

File tree

1 file changed

+66
-0
lines changed
  • Documentation/devicetree/bindings/virtio

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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

0 commit comments

Comments
 (0)