Skip to content

Commit a6aed6b

Browse files
nxpfrankliKAGA-KOKO
authored andcommitted
dt-bindings: PCI: pci-ep: Add support for iommu-map and msi-map
Document the use of (msi|iommu)-map for PCI Endpoint (EP) controllers, which can use MSI as a doorbell mechanism. Each EP controller can support up to 8 physical functions and 65,536 virtual functions. Define how to construct device IDs using function bits [2:0] and virtual function index bits [31:3], enabling (msi|iommu)-map to associate each child device with a specific (msi|iommu)-specifier. The EP cannot rely on PCI Requester ID (RID) because the RID is determined by the PCI topology of the host system. Since the EP may be connected to different PCI hosts, the RID can vary between systems and is therefore not a reliable identifier. Signed-off-by: Frank Li <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Rob Herring (Arm) <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent fd120c3 commit a6aed6b

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

Documentation/devicetree/bindings/pci/pci-ep.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ properties:
1717
$nodename:
1818
pattern: "^pcie-ep@"
1919

20+
iommu-map:
21+
$ref: /schemas/types.yaml#/definitions/uint32-matrix
22+
items:
23+
items:
24+
- description: Device ID (see msi-map) base
25+
maximum: 0x7ffff
26+
- description: phandle to IOMMU
27+
- description: IOMMU specifier base (currently always 1 cell)
28+
- description: Number of Device IDs
29+
maximum: 0x80000
30+
31+
iommu-map-mask:
32+
description:
33+
A mask to be applied to each Device ID prior to being mapped to an
34+
IOMMU specifier per the iommu-map property.
35+
$ref: /schemas/types.yaml#/definitions/uint32
36+
maximum: 0x7ffff
37+
2038
max-functions:
2139
description: Maximum number of functions that can be configured
2240
$ref: /schemas/types.yaml#/definitions/uint8
@@ -35,6 +53,56 @@ properties:
3553
$ref: /schemas/types.yaml#/definitions/uint32
3654
enum: [ 1, 2, 3, 4 ]
3755

56+
msi-map:
57+
description: |
58+
Maps a Device ID to an MSI and associated MSI specifier data.
59+
60+
A PCI Endpoint (EP) can use MSI as a doorbell function. This is achieved by
61+
mapping the MSI controller's address into PCI BAR<n>. The PCI Root Complex
62+
can write to this BAR<n>, triggering the EP to generate IRQ. This notifies
63+
the EP-side driver of an event, eliminating the need for the driver to
64+
continuously poll for status changes.
65+
66+
However, the EP cannot rely on Requester ID (RID) because the RID is
67+
determined by the PCI topology of the host system. Since the EP may be
68+
connected to different PCI hosts, the RID can vary between systems and is
69+
therefore not a reliable identifier.
70+
71+
Each EP can support up to 8 physical functions and up to 65,536 virtual
72+
functions. To uniquely identify each child device, a device ID is defined
73+
as
74+
- Bits [2:0] for the function number (func)
75+
- Bits [18:3] for the virtual function index (vfunc)
76+
77+
The resulting device ID is computed as:
78+
79+
(func & 0x7) | (vfunc << 3)
80+
81+
The property is an arbitrary number of tuples of
82+
(device-id-base, msi, msi-base,length).
83+
84+
Any Device ID id in the interval [id-base, id-base + length) is
85+
associated with the listed MSI, with the MSI specifier
86+
(id - id-base + msi-base).
87+
$ref: /schemas/types.yaml#/definitions/uint32-matrix
88+
items:
89+
items:
90+
- description: The Device ID base matched by the entry
91+
maximum: 0x7ffff
92+
- description: phandle to msi-controller node
93+
- description: (optional) The msi-specifier produced for the first
94+
Device ID matched by the entry. Currently, msi-specifier is 0 or
95+
1 cells.
96+
- description: The length of consecutive Device IDs following the
97+
Device ID base
98+
maximum: 0x80000
99+
100+
msi-map-mask:
101+
description: A mask to be applied to each Device ID prior to being
102+
mapped to an msi-specifier per the msi-map property.
103+
$ref: /schemas/types.yaml#/definitions/uint32
104+
maximum: 0x7ffff
105+
38106
num-lanes:
39107
description: maximum number of lanes
40108
$ref: /schemas/types.yaml#/definitions/uint32

0 commit comments

Comments
 (0)