dt-bindings: iommu: riscv: Add bindings for Tenstorrent RISC-V IOMMU
Subsystems (4)
PATCH v3 1/1 dt-bindings: iommu: riscv: Add bindings for Tenstorrent RISC-V IOMMU
From: Nicholas Piggin <[email protected]>
Extend the binding to cover details specific to the Tenstorrent RISC-V IOMMU. In particular, a second register range is added which contains M-privileged registers, e.g., PMAs and PMPs.
The RISC-V spec S-privileged registers remain in the first register range and are compatible with "riscv,iommu" so the Linux driver does not notice any difference, but the binding will be used by OpenSBI and potentially other M-mode software.
---
v3 changes:
- Move tenstorrent,riscv-iommu to the enum with qemu,riscv-iommu
- Move descriptions out of the allOf:
- Add minItems: 2 for tenstorrent,riscv-iommu in allOf:
- Fix reg syntax in Example 5
- Link to v2:
https://lore.kernel.org/lkml/[email protected]/
v2 changes:
- Fix dt_binding_check errors
- Add the Acked-by: from Joerg
- Drop RFC prefix
- Link to v1:
https://lore.kernel.org/lkml/[email protected]/
.../bindings/iommu/riscv,iommu.yaml | 54 ++++++++++++++++--- 1 file changed, 46 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/iommu/riscv,iommu.yaml +46 -8
@@ -32,22 +32,34 @@ properties: # should be specified along with 'reg' property providing MMIO location. compatible: oneOf: - - items: + - description: Platform (non-PCIe) IOMMU implementations + items: - enum: - qemu,riscv-iommu + - tenstorrent,riscv-iommu - const: riscv,iommu - - items: + - description: PCIe IOMMU implementations + items: - enum: - pci1efd,edf1 - const: riscv,pci-iommu reg: - maxItems: 1 - description: - For non-PCI devices this represents base address and size of for the - IOMMU memory mapped registers interface. - For PCI IOMMU hardware implementation this should represent an address - of the IOMMU, as defined in the PCI Bus Binding reference. + minItems: 1 + items: + - description: + For non-PCI devices, base address and size of the IOMMU memory + mapped registers interface. For PCI IOMMU hardware + implementation, an address of the IOMMU, as defined in the PCI + Bus Binding reference. + - description: + Region containing platform specific MMRs for machine-mode + configuration, such as PMA and PMP registers. + + reg-names: + items: + - const: base + - const: machine '#iommu-cells': const: 1
@@ -75,6 +87,22 @@ required: additionalProperties: false +allOf: + - if: + properties: + compatible: + contains: + enum: + - tenstorrent,riscv-iommu + then: + properties: + reg: + minItems: 2 + else: + properties: + reg: + maxItems: 1 + examples: - |+ /* Example 1 (IOMMU device with wired interrupts) */
@@ -145,3 +173,13 @@ examples: }; }; }; + + - |+ + /* Example 5 (Tenstorrent IOMMU device with MSIs) */ + iommu5: iommu@d2020000 { + compatible = "tenstorrent,riscv-iommu", "riscv,iommu"; + reg = <0xd2020000 0x10000>, <0xaa000000 0x10000>; + reg-names = "base", "machine"; + msi-parent = <&imsics_smode>; + #iommu-cells = <1>; + };
Signature · 1 line
2.43.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `reg-names` property is missing `minItems: 1`, implicitly requiring exactly 2 items and…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The reg-names property is missing minItems: 1, implicitly requiring exactly 2 items and breaking single-region nodes that attempt to use reg-names. --
commit 4e6445ae92ce6111a15e470ab7f01dc3081a9f0b
Author: Nicholas Piggin <[email protected]>
dt-bindings: iommu: riscv: Add bindings for Tenstorrent RISC-V IOMMU
This commit extends the riscv,iommu binding to support the Tenstorrent RISC-V IOMMU. It adds a second register range for M-privileged registers like PMAs and PMPs.
Quoted 4 lines
Documentation/devicetree/bindings/iommu/riscv,iommu.yaml +0
-0
[ ... ]
Quoted 1 line
Documentation/devicetree/bindings/iommu/riscv,iommu.yaml +0
-0@@ -32,22 +32,34 @@ properties:
[ ... ]
Documentation/devicetree/bindings/iommu/riscv,iommu.yaml properties: · line 62
Quoted 4 lines
Documentation/devicetree/bindings/iommu/riscv,iommu.yaml +4
-0+ reg-names: + items: + - const: base + - const: machine
[Severity: Medium]
Will this implicitly require exactly two items for reg-names?
In dt-schema, defining an array property with a list of items sets both the minimum and maximum to the length of the list unless overridden.
If standard single-region IOMMUs attempt to provide a single reg-names entry, will they fail schema validation because the schema expects exactly two items?
Should minItems: 1 be added to the reg-names property?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 11 lines · Drew Fustini
From: Nicholas Piggin <[email protected]>
Extend the binding to cover details specific to the Tenstorrent RISC-V IOMMU. In particular, a second register range is added which contains M-privileged registers, e.g., PMAs and PMPs.
The RISC-V spec S-privileged registers remain in the first register range and are compatible with "riscv,iommu" so the Linux driver does not notice any difference, but the binding will be used by OpenSBI and potentially other M-mode software.
Quoted 5 lines
Reviewed-by Joel Stanley <[email protected]>Acked-by Joerg Roedel <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>[fustini: fix dt_binding_check errors]Signed-off-by Drew Fustini <[email protected]>
Discussed on IRC I think, sashiko complaint to be fixed.
pw-bot: changes-requested