Back to home page

OSCL-LXR

 
 

    


0001 * virtio IOMMU PCI device
0002 
0003 When virtio-iommu uses the PCI transport, its programming interface is
0004 discovered dynamically by the PCI probing infrastructure. However the
0005 device tree statically describes the relation between IOMMU and DMA
0006 masters. Therefore, the PCI root complex that hosts the virtio-iommu
0007 contains a child node representing the IOMMU device explicitly.
0008 
0009 Required properties:
0010 
0011 - compatible:   Should be "virtio,pci-iommu"
0012 - reg:          PCI address of the IOMMU. As defined in the PCI Bus
0013                 Binding reference [1], the reg property is a five-cell
0014                 address encoded as (phys.hi phys.mid phys.lo size.hi
0015                 size.lo). phys.hi should contain the device's BDF as
0016                 0b00000000 bbbbbbbb dddddfff 00000000. The other cells
0017                 should be zero.
0018 - #iommu-cells: Each platform DMA master managed by the IOMMU is assigned
0019                 an endpoint ID, described by the "iommus" property [2].
0020                 For virtio-iommu, #iommu-cells must be 1.
0021 
0022 Notes:
0023 
0024 - DMA from the IOMMU device isn't managed by another IOMMU. Therefore the
0025   virtio-iommu node doesn't have an "iommus" property, and is omitted from
0026   the iommu-map property of the root complex.
0027 
0028 Example:
0029 
0030 pcie@10000000 {
0031         compatible = "pci-host-ecam-generic";
0032         ...
0033 
0034         /* The IOMMU programming interface uses slot 00:01.0 */
0035         iommu0: iommu@0008 {
0036                 compatible = "virtio,pci-iommu";
0037                 reg = <0x00000800 0 0 0 0>;
0038                 #iommu-cells = <1>;
0039         };
0040 
0041         /*
0042          * The IOMMU manages all functions in this PCI domain except
0043          * itself. Omit BDF 00:01.0.
0044          */
0045         iommu-map = <0x0 &iommu0 0x0 0x8>
0046                     <0x9 &iommu0 0x9 0xfff7>;
0047 };
0048 
0049 pcie@20000000 {
0050         compatible = "pci-host-ecam-generic";
0051         ...
0052         /*
0053          * The IOMMU also manages all functions from this domain,
0054          * with endpoint IDs 0x10000 - 0x1ffff
0055          */
0056         iommu-map = <0x0 &iommu0 0x10000 0x10000>;
0057 };
0058 
0059 ethernet@fe001000 {
0060         ...
0061         /* The IOMMU manages this platform device with endpoint ID 0x20000 */
0062         iommus = <&iommu0 0x20000>;
0063 };
0064 
0065 [1] Documentation/devicetree/bindings/pci/pci.txt
0066 [2] Documentation/devicetree/bindings/iommu/iommu.txt