| 1 |
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) |
| 2 |
%YAML 1.2 |
| 3 |
--- |
| 4 |
$id: http://devicetree.org/schemas/virtio/pci-iommu.yaml# |
| 5 |
$schema: http://devicetree.org/meta-schemas/core.yaml# |
| 6 |
|
| 7 |
title: virtio-iommu device using the virtio-pci transport |
| 8 |
|
| 9 |
maintainers: |
| 10 |
- Jean-Philippe Brucker <[email protected]> |
| 11 |
|
| 12 |
description: | |
| 13 |
When virtio-iommu uses the PCI transport, its programming interface is |
| 14 |
discovered dynamically by the PCI probing infrastructure. However the |
| 15 |
device tree statically describes the relation between IOMMU and DMA |
| 16 |
masters. Therefore, the PCI root complex that hosts the virtio-iommu |
| 17 |
contains a child node representing the IOMMU device explicitly. |
| 18 |
|
| 19 |
DMA from the IOMMU device isn't managed by another IOMMU. Therefore the |
| 20 |
virtio-iommu node doesn't have an "iommus" property, and is omitted from |
| 21 |
the iommu-map property of the root complex. |
| 22 |
|
| 23 |
allOf: |
| 24 |
- $ref: /schemas/pci/pci-device.yaml# |
| 25 |
|
| 26 |
properties: |
| 27 |
# If compatible is present, it should contain the vendor and device ID |
| 28 |
# according to the PCI Bus Binding specification. Since PCI provides |
| 29 |
# built-in identification methods, compatible is not actually required. |
| 30 |
compatible: |
| 31 |
oneOf: |
| 32 |
- items: |
| 33 |
- const: virtio,pci-iommu |
| 34 |
- const: pci1af4,1057 |
| 35 |
- items: |
| 36 |
- const: pci1af4,1057 |
| 37 |
|
| 38 |
reg: |
| 39 |
maxItems: 1 |
| 40 |
|
| 41 |
'#iommu-cells': |
| 42 |
const: 1 |
| 43 |
|
| 44 |
required: |
| 45 |
- compatible |
| 46 |
- reg |
| 47 |
- '#iommu-cells' |
| 48 |
|
| 49 |
additionalProperties: false |
| 50 |
|
| 51 |
examples: |
| 52 |
- | |
| 53 |
bus { |
| 54 |
#address-cells = <2>; |
| 55 |
#size-cells = <2>; |
| 56 |
|
| 57 |
pcie@40000000 { |
| 58 |
device_type = "pci"; |
| 59 |
#address-cells = <3>; |
| 60 |
#size-cells = <2>; |
| 61 |
reg = <0x0 0x40000000 0x0 0x1000000>; |
| 62 |
ranges = <0x02000000 0x0 0x41000000 0x0 0x41000000 0x0 0x0f000000>; |
| 63 |
|
| 64 |
/* |
| 65 |
* The IOMMU manages all functions in this PCI domain except |
| 66 |
* itself. Omit BDF 00:01.0. |
| 67 |
*/ |
| 68 |
iommu-map = <0x0 &iommu0 0x0 0x8 |
| 69 |
0x9 &iommu0 0x9 0xfff7>; |
| 70 |
|
| 71 |
/* The IOMMU programming interface uses slot 00:01.0 */ |
| 72 |
iommu0: iommu@1,0 { |
| 73 |
compatible = "pci1af4,1057"; |
| 74 |
reg = <0x800 0 0 0 0>; |
| 75 |
#iommu-cells = <1>; |
| 76 |
}; |
| 77 |
}; |
| 78 |
|
| 79 |
pcie@50000000 { |
| 80 |
device_type = "pci"; |
| 81 |
#address-cells = <3>; |
| 82 |
#size-cells = <2>; |
| 83 |
reg = <0x0 0x50000000 0x0 0x1000000>; |
| 84 |
ranges = <0x02000000 0x0 0x51000000 0x0 0x51000000 0x0 0x0f000000>; |
| 85 |
|
| 86 |
/* |
| 87 |
* The IOMMU also manages all functions from this domain, |
| 88 |
* with endpoint IDs 0x10000 - 0x1ffff |
| 89 |
*/ |
| 90 |
iommu-map = <0x0 &iommu0 0x10000 0x10000>; |
| 91 |
}; |
| 92 |
|
| 93 |
ethernet { |
| 94 |
/* The IOMMU manages this platform device with endpoint ID 0x20000 */ |
| 95 |
iommus = <&iommu0 0x20000>; |
| 96 |
}; |
| 97 |
}; |
| 98 |
|
| 99 |
... |