Add support for AMD MDB IP as Root Port
Subsystems (4)
v5 cover Add support for AMD MDB IP as Root Port
This series of patch add support for AMD MDB IP as Root Port.
The AMD MDB IP support's 32 bit and 64bit BAR's at Gen5 speed. As Root Port it supports MSI and legacy interrupts.
Thippeswamy Havalige (3):
dt-bindings: PCI: dwc: Add AMD Versal2 mdb slcr support
dt-bindings: PCI: amd-mdb: Add AMD Versal2 MDB PCIe Root Port Bridge
PCI: amd-mdb: Add AMD MDB Root Port driver
.../bindings/pci/amd,versal2-mdb-host.yaml | 121 +++++ .../devicetree/bindings/pci/snps,dw-pcie.yaml | 2 + drivers/pci/controller/dwc/Kconfig | 10 + drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-amd-mdb.c | 439 ++++++++++++++++++ 5 files changed, 573 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml create mode 100644 drivers/pci/controller/dwc/pcie-amd-mdb.c
Signature · 1 line
2.34.1
PATCH RESEND v5 1/3 dt-bindings: PCI: dwc: Add AMD Versal2 mdb slcr support
Add support for mdb slcr aperture that is only supported for AMD Versal2 devices.
---
Changes in v3:
-------------
- Introduced below changes in dwc yaml schema.
Changes in v5:
-------------
- Modify mdb_pcie_slcr as constant.
--- Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +2 -0
@@ -113,6 +113,8 @@ properties: enum: [ smu, mpu ] - description: Tegra234 aperture enum: [ ecam ] + - description: AMD MDB PCIe slcr region + const: mdb_pcie_slcr allOf: - contains: const: dbi
Signature · 1 line
2.34.1
Rob Herring
maintainerRe: [RESEND PATCH v5 1/3] dt-bindings: PCI: dwc: Add AMD Versal2 mdb slcr support
Quoted 20 lines · Thippeswamy Havalige
Add support for mdb slcr aperture that is only supported for AMD Versal2 devices.
Signed-off-by Thippeswamy Havalige <[email protected]>---
Changes in v3:
-------------
- Introduced below changes in dwc yaml schema.
Changes in v5:
-------------
- Modifymdb_pcie_slcras constant.--- Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +0
-0
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml properties: · line 117
Quoted 5 lines
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +2
-0@@ -113,6 +113,8 @@ properties: enum: [ smu, mpu ] - description: Tegra234 aperture enum: [ ecam ] + - description: AMD MDB PCIe slcr region + const: mdb_pcie_slcr
Including the block name is redundant. Just 'slcr' is sufficient.
Quoted 6 lines
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +0
-0allOf: - contains: const: dbiSignature · 1 line
2.34.1
RE: [RESEND PATCH v5 1/3] dt-bindings: PCI: dwc: Add AMD Versal2 mdb slcr support
Hi Rob,
Quoted 29 lines
-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Tuesday, December 17, 2024 8:31 PM
To: Havalige, Thippeswamy <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; Simek, Michal <[email protected]>; Gogada, Bharat Kumar <[email protected]>
Subject: Re: [RESEND PATCH v5 1/3] dt-bindings: PCI: dwc: Add AMD Versal2 mdb slcr supportQuoted 15 lines · Thippeswamy Havalige
Add support for mdb slcr aperture that is only supported for AMD Versal2 devices.
Signed-off-by Thippeswamy Havalige <[email protected]>---
Changes in v3:
-------------
- Introduced below changes in dwc yaml schema.
Changes in v5:
-------------
- Modifymdb_pcie_slcras constant.--- Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml | 2 ++ 1 file changed, 2 insertions(+)
Quoted 13 lines
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml properties: · line 117
Quoted 11 lines
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +2
-0@@ -113,6 +113,8 @@ properties: enum: [ smu, mpu ] - description: Tegra234 aperture enum: [ ecam ] + - description: AMD MDB PCIe slcr region + const: mdb_pcie_slcrIncluding the block name is redundant. Just 'slcr' is sufficient.
Thank you for your comments, I'll update this in next patch.
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +0
-1allOf: - contains: const: dbi --2.34.1
PATCH RESEND v5 2/3 dt-bindings: PCI: amd-mdb: Add AMD Versal2 MDB PCIe Root Port Bridge
In reply to Thippeswamy HavaligeAdd AMD Versal2 MDB (Multimedia DMA Bridge) PCIe Root Port Bridge.
---
Changes in v2:
-------------
- Modify patch subject.
- Add pcie host bridge reference.
- Modify filename as per compatible string.
- Remove standard PCI properties.
- Modify interrupt controller description.
- Indentation
Changes in v3:
-------------
- Modified SLCR to lower case.
- Add dwc schemas.
- Remove common properties.
- Move additionalProperties below properties.
- Remove ranges property from required properties.
- Drop blank line.
- Modify pci@ to pcie@
Changes in v4:
-------------
- None.
Changes in v5:
-------------
- None.
--- .../bindings/pci/amd,versal2-mdb-host.yaml | 121 ++++++++++++++++++ --- .../bindings/pci/amd,versal2-mdb-host.yaml | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +121 -0
@@ -0,0 +1,121 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/amd,versal2-mdb-host.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Versal2 MDB(Multimedia DMA Bridge) Host Controller + +maintainers: + - Thippeswamy Havalige <[email protected]> + +allOf: + - $ref: /schemas/pci/pci-host-bridge.yaml# + - $ref: /schemas/pci/snps,dw-pcie.yaml# + +properties: + compatible: + const: amd,versal2-mdb-host + + reg: + items: + - description: MDB PCIe controller 0 SLCR + - description: configuration region + - description: data bus interface + - description: address translation unit register + + reg-names: + items: + - const: mdb_pcie_slcr + - const: config + - const: dbi + - const: atu + + ranges: + maxItems: 2 + + msi-map: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupt-map-mask: + items: + - const: 0 + - const: 0 + - const: 0 + - const: 7 + + interrupt-map: + maxItems: 4 + + "#interrupt-cells": + const: 1 + + interrupt-controller: + description: identifies the node as an interrupt controller + type: object + additionalProperties: false + properties: + interrupt-controller: true + + "#address-cells": + const: 0 + + "#interrupt-cells": + const: 1 + + required: + - interrupt-controller + - "#address-cells" + - "#interrupt-cells" + +required: + - reg + - reg-names + - interrupts + - interrupt-map + - interrupt-map-mask + - msi-map + - "#interrupt-cells" + - interrupt-controller + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + soc { + #address-cells = <2>; + #size-cells = <2>; + pcie@ed931000 { + compatible = "amd,versal2-mdb-host"; + reg = <0x0 0xed931000 0x0 0x2000>, + <0x1000 0x100000 0x0 0xff00000>, + <0x1000 0x0 0x0 0x100000>, + <0x0 0xed860000 0x0 0x2000>; + reg-names = "mdb_pcie_slcr", "config", "dbi", "atu"; + ranges = <0x2000000 0x00 0xa8000000 0x00 0xa8000000 0x00 0x10000000>, + <0x43000000 0x1100 0x00 0x1100 0x00 0x00 0x1000000>; + interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&gic>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &pcie_intc_0 0>, + <0 0 0 2 &pcie_intc_0 1>, + <0 0 0 3 &pcie_intc_0 2>, + <0 0 0 4 &pcie_intc_0 3>; + msi-map = <0x0 &gic_its 0x00 0x10000>; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + device_type = "pci"; + pcie_intc_0: interrupt-controller { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + }; + }; + };
Signature · 1 line
2.34.1
Rob Herring
maintainerRe: [RESEND PATCH v5 2/3] dt-bindings: PCI: amd-mdb: Add AMD Versal2 MDB PCIe Root Port Bridge
Quoted 131 lines · Thippeswamy Havalige
Add AMD Versal2 MDB (Multimedia DMA Bridge) PCIe Root Port Bridge.
Signed-off-by Thippeswamy Havalige <[email protected]>---
Changes in v2:
-------------
- Modify patch subject.
- Add pcie host bridge reference.
- Modify filename as per compatible string.
- Remove standard PCI properties.
- Modify interrupt controller description.
- IndentationChanges in v3:
-------------
- Modified SLCR to lower case.
- Add dwc schemas.
- Remove common properties.
- Move additionalProperties below properties.
- Remove ranges property from required properties.
- Drop blank line.
- Modify pci@ to pcie@Changes in v4:
-------------
- None.Changes in v5:
-------------
- None.--- .../bindings/pci/amd,versal2-mdb-host.yaml | 121 ++++++++++++++++++ --- .../bindings/pci/amd,versal2-mdb-host.yaml | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yamlDocumentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +88
-0@@ -0,0 +1,121 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/amd,versal2-mdb-host.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Versal2 MDB(Multimedia DMA Bridge) Host Controller + +maintainers: + - Thippeswamy Havalige <[email protected]> + +allOf: + - $ref: /schemas/pci/pci-host-bridge.yaml# + - $ref: /schemas/pci/snps,dw-pcie.yaml# + +properties: + compatible: + const: amd,versal2-mdb-host + + reg: + items: + - description: MDB PCIe controller 0 SLCR + - description: configuration region + - description: data bus interface + - description: address translation unit register + + reg-names: + items: + - const: mdb_pcie_slcr + - const: config + - const: dbi + - const: atu + + ranges: + maxItems: 2 + + msi-map: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupt-map-mask: + items: + - const: 0 + - const: 0 + - const: 0 + - const: 7 + + interrupt-map: + maxItems: 4 + + "#interrupt-cells": + const: 1 + + interrupt-controller: + description: identifies the node as an interrupt controller + type: object + additionalProperties: false + properties: + interrupt-controller: true + + "#address-cells": + const: 0 + + "#interrupt-cells": + const: 1 + + required: + - interrupt-controller + - "#address-cells" + - "#interrupt-cells" + +required: + - reg + - reg-names + - interrupts + - interrupt-map + - interrupt-map-mask + - msi-map + - "#interrupt-cells" + - interrupt-controller + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h>
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml line 98
Quoted 10 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +10
-0+ #include <dt-bindings/interrupt-controller/irq.h> + + soc { + #address-cells = <2>; + #size-cells = <2>; + pcie@ed931000 { + compatible = "amd,versal2-mdb-host"; + reg = <0x0 0xed931000 0x0 0x2000>, + <0x1000 0x100000 0x0 0xff00000>, + <0x1000 0x0 0x0 0x100000>,
DBI space is 1MB? Last I checked, there's less than 4KB worth of registers.
The address looks odd. The config space is purely iATU configuration. Really, we should have described the entire address space (like the endpoint) available to the ATU. So the 1MB offset in the base address seems like just that. Most h/w design to cut down signal routing would put the base address for the ATU input at something aligned greater than the size of the address space.
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml line 99
Quoted 1 line
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +1
-0+ <0x0 0xed860000 0x0 0x2000>;
And then the DBI and ATU registers are nowhere near each other? Possible, but seems odd.
Quoted 25 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +22
-0+ reg-names = "mdb_pcie_slcr", "config", "dbi", "atu"; + ranges = <0x2000000 0x00 0xa8000000 0x00 0xa8000000 0x00 0x10000000>, + <0x43000000 0x1100 0x00 0x1100 0x00 0x00 0x1000000>; + interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&gic>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &pcie_intc_0 0>, + <0 0 0 2 &pcie_intc_0 1>, + <0 0 0 3 &pcie_intc_0 2>, + <0 0 0 4 &pcie_intc_0 3>; + msi-map = <0x0 &gic_its 0x00 0x10000>; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + device_type = "pci"; + pcie_intc_0: interrupt-controller { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + }; + }; + };Signature · 1 line
2.34.1
RE: [RESEND PATCH v5 2/3] dt-bindings: PCI: amd-mdb: Add AMD Versal2 MDB PCIe Root Port Bridge
Hi Rob,
Quoted 152 lines
-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Tuesday, December 17, 2024 8:41 PM
To: Havalige, Thippeswamy <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; Simek, Michal <[email protected]>; Gogada, Bharat Kumar <[email protected]>
Subject: Re: [RESEND PATCH v5 2/3] dt-bindings: PCI: amd-mdb: Add AMD Versal2 MDB PCIe Root Port BridgeQuoted 30 lines · Thippeswamy Havalige
Add AMD Versal2 MDB (Multimedia DMA Bridge) PCIe Root Port Bridge.
Signed-off-by Thippeswamy Havalige <[email protected]>---
Changes in v2:
-------------
- Modify patch subject.
- Add pcie host bridge reference.
- Modify filename as per compatible string.
- Remove standard PCI properties.
- Modify interrupt controller description.
- IndentationChanges in v3:
-------------
- Modified SLCR to lower case.
- Add dwc schemas.
- Remove common properties.
- Move additionalProperties below properties.
- Remove ranges property from required properties.
- Drop blank line.
- Modify pci@ to pcie@Changes in v4:
-------------
- None.Changes in v5:
-------------
- None.Quoted 6 lines
--- .../bindings/pci/amd,versal2-mdb-host.yaml | 121 ++++++++++++++++++ --- .../bindings/pci/amd,versal2-mdb-host.yaml | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/amd,versal2-mdb-
host.yamlReview
Quoted 2 lines
(quoted diff) +0
-0
b/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yamlQuoted 98 lines
new file mode 100644
index 000000000000..c319adeeee66Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +93
-0@@ -0,0 +1,121 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/amd,versal2-mdb-host.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Versal2 MDB(Multimedia DMA Bridge) Host Controller + +maintainers: + - Thippeswamy Havalige <[email protected]> + +allOf: + - $ref: /schemas/pci/pci-host-bridge.yaml# + - $ref: /schemas/pci/snps,dw-pcie.yaml# + +properties: + compatible: + const: amd,versal2-mdb-host + + reg: + items: + - description: MDB PCIe controller 0 SLCR + - description: configuration region + - description: data bus interface + - description: address translation unit register + + reg-names: + items: + - const: mdb_pcie_slcr + - const: config + - const: dbi + - const: atu + + ranges: + maxItems: 2 + + msi-map: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupt-map-mask: + items: + - const: 0 + - const: 0 + - const: 0 + - const: 7 + + interrupt-map: + maxItems: 4 + + "#interrupt-cells": + const: 1 + + interrupt-controller: + description: identifies the node as an interrupt controller + type: object + additionalProperties: false + properties: + interrupt-controller: true + + "#address-cells": + const: 0 + + "#interrupt-cells": + const: 1 + + required: + - interrupt-controller + - "#address-cells" + - "#interrupt-cells" + +required: + - reg + - reg-names + - interrupts + - interrupt-map + - interrupt-map-mask + - msi-map + - "#interrupt-cells" + - interrupt-controller + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + soc { + #address-cells = <2>; + #size-cells = <2>;
Quoted 8 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml line 98
Quoted 5 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +5
-0+ pcie@ed931000 { + compatible = "amd,versal2-mdb-host"; + reg = <0x0 0xed931000 0x0 0x2000>, + <0x1000 0x100000 0x0 0xff00000>, + <0x1000 0x0 0x0 0x100000>,DBI space is 1MB? Last I checked, there's less than 4KB worth of registers.
Thank you for your feedback. I will reduce the size to 4KB, as the DBI space primarily uses less than 4KB for its registers. Beyond this, the space includes port logic registers, which can be safely ignored in this context.
Quoted 6 lines
The address looks odd. The config space is purely iATU configuration. Really, we should have described the entire address space (like the endpoint) available to the ATU. So the 1MB offset in the base address seems like just that. Most h/w design to cut down signal routing would put the base address for the ATU input at something aligned greater than the size of the address space.
In AMD (Xilinx) PCIe IPs, the configuration space for the endpoint typically starts after 1MB. To align with this, I initially set the DBI size to 1MB. However, considering the actual utilization of less than 4KB for DBI registers, this allocation I'll update in the next patch.
Quoted 5 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml line 99
Quoted 2 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +1
-0+ <0x0 0xed860000 0x0 0x2000>;And then the DBI and ATU registers are nowhere near each other? Possible, but seems odd.
Thank you for your feedback. The DBI address provided in the device tree serves as one way to access the local ECAM space, which corresponds to a relative address of 0xED840000.
The internal IP uses the 0xED840000 address to configure all PCIe attributes. When accessing the address 0x1000_0000_0000, PCIe internally translates and implicitly accesses the 0xED840000 address.
Quoted 26 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml line 101
Quoted 2 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +2
-0+ reg-names = "mdb_pcie_slcr", "config", "dbi", "atu"; + ranges = <0x2000000 0x00 0xa8000000 0x00 0xa8000000 0x00
0x10000000>,Quoted 23 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +20
-1+ <0x43000000 0x1100 0x00 0x1100 0x00 0x00 0x1000000>; + interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&gic>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &pcie_intc_0 0>, + <0 0 0 2 &pcie_intc_0 1>, + <0 0 0 3 &pcie_intc_0 2>, + <0 0 0 4 &pcie_intc_0 3>; + msi-map = <0x0 &gic_its 0x00 0x10000>; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + device_type = "pci"; + pcie_intc_0: interrupt-controller { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + }; + }; + }; --2.34.1
Regards,
Thippeswamy H
Rob Herring
maintainerRe: [RESEND PATCH v5 2/3] dt-bindings: PCI: amd-mdb: Add AMD Versal2 MDB PCIe Root Port Bridge
Quoted 180 lines · Thippeswamy
Hi Rob,
Quoted 152 lines
-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Tuesday, December 17, 2024 8:41 PM
To: Havalige, Thippeswamy <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; Simek, Michal <[email protected]>; Gogada, Bharat Kumar <[email protected]>
Subject: Re: [RESEND PATCH v5 2/3] dt-bindings: PCI: amd-mdb: Add AMD Versal2 MDB PCIe Root Port BridgeQuoted 30 lines · Thippeswamy Havalige
Add AMD Versal2 MDB (Multimedia DMA Bridge) PCIe Root Port Bridge.
Signed-off-by Thippeswamy Havalige <[email protected]>---
Changes in v2:
-------------
- Modify patch subject.
- Add pcie host bridge reference.
- Modify filename as per compatible string.
- Remove standard PCI properties.
- Modify interrupt controller description.
- IndentationChanges in v3:
-------------
- Modified SLCR to lower case.
- Add dwc schemas.
- Remove common properties.
- Move additionalProperties below properties.
- Remove ranges property from required properties.
- Drop blank line.
- Modify pci@ to pcie@Changes in v4:
-------------
- None.Changes in v5:
-------------
- None.Quoted 6 lines
--- .../bindings/pci/amd,versal2-mdb-host.yaml | 121 ++++++++++++++++++ --- .../bindings/pci/amd,versal2-mdb-host.yaml | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/amd,versal2-mdb-
host.yamlReview
Quoted 2 lines
(quoted diff) +0
-0
b/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yamlQuoted 98 lines
new file mode 100644
index 000000000000..c319adeeee66Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +93
-0@@ -0,0 +1,121 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/amd,versal2-mdb-host.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Versal2 MDB(Multimedia DMA Bridge) Host Controller + +maintainers: + - Thippeswamy Havalige <[email protected]> + +allOf: + - $ref: /schemas/pci/pci-host-bridge.yaml# + - $ref: /schemas/pci/snps,dw-pcie.yaml# + +properties: + compatible: + const: amd,versal2-mdb-host + + reg: + items: + - description: MDB PCIe controller 0 SLCR + - description: configuration region + - description: data bus interface + - description: address translation unit register + + reg-names: + items: + - const: mdb_pcie_slcr + - const: config + - const: dbi + - const: atu + + ranges: + maxItems: 2 + + msi-map: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupt-map-mask: + items: + - const: 0 + - const: 0 + - const: 0 + - const: 7 + + interrupt-map: + maxItems: 4 + + "#interrupt-cells": + const: 1 + + interrupt-controller: + description: identifies the node as an interrupt controller + type: object + additionalProperties: false + properties: + interrupt-controller: true + + "#address-cells": + const: 0 + + "#interrupt-cells": + const: 1 + + required: + - interrupt-controller + - "#address-cells" + - "#interrupt-cells" + +required: + - reg + - reg-names + - interrupts + - interrupt-map + - interrupt-map-mask + - msi-map + - "#interrupt-cells" + - interrupt-controller + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + soc { + #address-cells = <2>; + #size-cells = <2>;Quoted 8 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml line 98
Quoted 5 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +5
-0+ pcie@ed931000 { + compatible = "amd,versal2-mdb-host"; + reg = <0x0 0xed931000 0x0 0x2000>, + <0x1000 0x100000 0x0 0xff00000>, + <0x1000 0x0 0x0 0x100000>,DBI space is 1MB? Last I checked, there's less than 4KB worth of registers.
Thank you for your feedback. I will reduce the size to 4KB, as the DBI space primarily uses less than 4KB for its registers. Beyond this, the space includes port logic registers, which can be safely ignored in this context.
Quoted 6 lines
The address looks odd. The config space is purely iATU configuration. Really, we should have described the entire address space (like the endpoint) available to the ATU. So the 1MB offset in the base address seems like just that. Most h/w design to cut down signal routing would put the base address for the ATU input at something aligned greater than the size of the address space.
In AMD (Xilinx) PCIe IPs, the configuration space for the endpoint typically starts after 1MB. To align with this, I initially set the DBI size to 1MB. However, considering the actual utilization of less than 4KB for DBI registers, this allocation I'll update in the next patch.
Quoted 5 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml line 99
Quoted 2 lines
Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml new file +1
-0+ <0x0 0xed860000 0x0 0x2000>;And then the DBI and ATU registers are nowhere near each other? Possible, but seems odd.
Quoted 7 lines
Thank you for your feedback. The DBI address provided in the device tree serves as one way to access the local ECAM space, which corresponds to a relative address of
0xED840000.The internal IP uses the
0xED840000address to configure all PCIe attributes. When accessing the address 0x1000_0000_0000, PCIe internally translates and implicitly accesses the0xED840000address.
Using the 0xED840000 address would be more aligned with how everyone else accesses the DBI. If you support ECAM, then doesn't 0x1000_0010_0000 also correspond to the same registers in the DBI space? Though I thought only the generic PCI config space registers would be exposed there.
Speaking of ECAM, if that's supported, it would be better if the driver used that (there's not any support in the driver for that). The advantage would be you could skip reconfiguring the iATU on every access. Ideally, the result would be utilizing what's in drivers/pci/ecam.c. Not something that needs to be done in this series, but you need to make sure the DT correctly describes the ECAM region (seems like it should be large enough). The hisi driver does this though it suffers from not handling devfn>0 on the root bus correctly (also a quirk in the generic ECAM based driver for DWC based implementations) and also needs 32-bit accesses to the root bus.
Rob
PATCH RESEND v5 3/3 PCI: amd-mdb: Add AMD MDB Root Port driver
In reply to Thippeswamy HavaligeAdd support for AMD MDB(Multimedia DMA Bridge) IP core as Root Port.
The Versal2 devices include MDB Module. The integrated block for MDB along with the integrated bridge can function as PCIe Root Port controller at Gen5 32-Gb/s operation per lane.
Bridge supports error and legacy interrupts and are handled using platform specific interrupt line in Versal2.
---
changes in v2:
-------------
- Update Gen5 speed in the patch description.
- Modify Kconfig file.
- Update string _leg_ to intx.
- Get platform structure through automic variables.
- Remove _rp_ in function.
Changes in v3:
--------------
-None.
Changes in v4:
--------------
-None.
Changes in v5:
--------------
-None.
--- drivers/pci/controller/dwc/Kconfig | 10 + drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-amd-mdb.c | 439 ++++++++++++++++++++++ 3 files changed, 450 insertions(+) create mode 100644 drivers/pci/controller/dwc/pcie-amd-mdb.c
drivers/pci/controller/dwc/Kconfig +10 -0
@@ -27,6 +27,16 @@ config PCIE_AL required only for DT-based platforms. ACPI platforms with the Annapurna Labs PCIe controller don't need to enable this. +config PCIE_AMD_MDB + bool "AMD PCIe controller (host mode)" + depends on OF || COMPILE_TEST + depends on PCI && PCI_MSI + select PCIE_DW_HOST + help + Say Y here to enable PCIe controller support on AMD SoCs. The + PCIe controller is based on DesignWare Hardware and uses AMD + hardware wrappers. + config PCI_MESON tristate "Amlogic Meson PCIe controller" default m if ARCH_MESON
drivers/pci/controller/dwc/Makefile +1 -0
@@ -3,6 +3,7 @@ obj-$(CONFIG_PCIE_DW) += pcie-designware.o obj-$(CONFIG_PCIE_DW_HOST) += pcie-designware-host.o obj-$(CONFIG_PCIE_DW_EP) += pcie-designware-ep.o obj-$(CONFIG_PCIE_DW_PLAT) += pcie-designware-plat.o +obj-$(CONFIG_PCIE_AMD_MDB) += pcie-amd-mdb.o obj-$(CONFIG_PCIE_BT1) += pcie-bt1.o obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o
drivers/pci/controller/dwc/pcie-amd-mdb.c new file +439 -0
439 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [RESEND PATCH v5 3/3] PCI: amd-mdb: Add AMD MDB Root Port driver
Quoted 1 line · Thippeswamy Havalige
Add support for AMD MDB(Multimedia DMA Bridge) IP core as Root Port.
Add space before "(".
drivers/pci/controller/dwc/Kconfig config PCIE_AL · line 31
Quoted 2 lines
drivers/pci/controller/dwc/Kconfig +2
-0+config PCIE_AMD_MDB + bool "AMD PCIe controller (host mode)"
Seems too generic to describe this as "the AMD PCIe controller". Perhaps at least "AMD MDB PCIe controller"? And/or include "Versal2"?
drivers/pci/controller/dwc/Kconfig config PCIE_AL · line 38
Quoted 7 lines
drivers/pci/controller/dwc/Kconfig +7
-0+ depends on OF || COMPILE_TEST + depends on PCI && PCI_MSI + select PCIE_DW_HOST + help + Say Y here to enable PCIe controller support on AMD SoCs. The + PCIe controller is based on DesignWare Hardware and uses AMD + hardware wrappers.
Make this help text a little more specific, too.
Quoted 3 lines
+ * struct
amd_mdb_pcie- PCIe port information
+ * @pci: DesignWare PCIe controller structure
+ * @mdb_base: MDB System Level Control and Status Register(SLCR) Base
Add space before "(".
Thanks for expanding this initialism. Capitalize it in the text of other patches so it's obvious that it's an initialism, not a word.
Quoted 1 line
+ * @intx_domain: Legacy IRQ domain pointer
Just say "INTx IRQ domain pointer". No point in using two terms when we use "INTx" everywhere else.
Quoted 5 lines
+ * @mdb_domain: MDB IRQ domain pointer
+ */(quoted diff) +3
-0+struct amd_mdb_pcie { + struct dw_pcie pci; + void __iomem *mdb_base;
Review
Quoted 10 lines
(quoted diff) +9
-0+ struct irq_domain *intx_domain; + struct irq_domain *mdb_domain; +}; + * amd_mdb_pcie_init_port - Initialize hardware + * @pcie: PCIe port information + * @pdev: platform device + */ +static int amd_mdb_pcie_init_port(struct amd_mdb_pcie *pcie, + struct platform_device *pdev)
"pdev" is unused, why include it?
drivers/pci/controller/dwc/pcie-amd-mdb.c line 176
Quoted 7 lines
drivers/pci/controller/dwc/pcie-amd-mdb.c new file +7
-0+static irqreturn_t amd_mdb_pcie_event_flow (int irq,void *args) +{ +struct amd_mdb_pcie *pcie = args; +unsigned long val; +int i; + + val =pcie_read (pcie,AMD_MDB_TLP_IR_STATUS_MISC );
Spurious extra space.
Quoted 9 lines
drivers/pci/controller/dwc/pcie-amd-mdb.c new file +9
-0+static int amd_mdb_pcie_init_irq_domains (struct amd_mdb_pcie *pcie, +struct platform_device *pdev) +{ +struct dw_pcie *pci = &pcie->pci; +struct dw_pcie_rp *pp = &pci->pp; +struct device *dev = &pdev->dev; +struct device_node *node = dev->of_node; +struct device_node *pcie_intc_node; +
drivers/pci/controller/dwc/pcie-amd-mdb.c line 284
Quoted 10 lines
drivers/pci/controller/dwc/pcie-amd-mdb.c new file +10
-0+/* Setup INTx */ + pcie_intc_node =of_get_next_child (node,NULL ); +if (!pcie_intc_node) { +dev_err (dev,"No PCIe Intc node found\n" ); +return -EINVAL ; + } + + pcie->mdb_domain =irq_domain_add_linear (pcie_intc_node,32 , + &event_domain_ops, + pcie);
Fix whitespace. "pcie" would fit on the previous line.
Bjorn
RE: [RESEND PATCH v5 3/3] PCI: amd-mdb: Add AMD MDB Root Port driver
Hi Bjorn,
Thanks for review comments, will fix all below comments in next patch.
Regards,
Thippeswamy H
Quoted 96 lines
-----Original Message-----
From: Bjorn Helgaas <[email protected]>
Sent: Friday, December 13, 2024 10:58 PM
To: Havalige, Thippeswamy <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; Simek, Michal <[email protected]>; Gogada, Bharat Kumar <[email protected]>
Subject: Re: [RESEND PATCH v5 3/3] PCI: amd-mdb: Add AMD MDB Root Port driverQuoted 1 line · Thippeswamy Havalige
Add support for AMD MDB(Multimedia DMA Bridge) IP core as Root Port.
Add space before "(".
drivers/pci/controller/dwc/Kconfig config PCIE_AL · line 31
Quoted 2 lines
drivers/pci/controller/dwc/Kconfig +2
-0+config PCIE_AMD_MDB + bool "AMD PCIe controller (host mode)"Seems too generic to describe this as "the AMD PCIe controller". Perhaps at least "AMD MDB PCIe controller"? And/or include "Versal2"?
drivers/pci/controller/dwc/Kconfig config PCIE_AL · line 38
Quoted 7 lines
drivers/pci/controller/dwc/Kconfig +7
-0+ depends on OF || COMPILE_TEST + depends on PCI && PCI_MSI + select PCIE_DW_HOST + help + Say Y here to enable PCIe controller support on AMD SoCs. The + PCIe controller is based on DesignWare Hardware and uses AMD + hardware wrappers.Make this help text a little more specific, too.
Quoted 3 lines
+ * struct
amd_mdb_pcie- PCIe port information
+ * @pci: DesignWare PCIe controller structure
+ * @mdb_base: MDB System Level Control and Status Register(SLCR) BaseAdd space before "(".
Thanks for expanding this initialism. Capitalize it in the text of other patches so it's obvious that it's an initialism, not a word.
Quoted 1 line
+ * @intx_domain: Legacy IRQ domain pointer
Just say "INTx IRQ domain pointer". No point in using two terms when we use "INTx" everywhere else.
Review
Quoted 13 lines
+ * @mdb_domain: MDB IRQ domain pointer */ struct
amd_mdb_pcie{(quoted diff) +11
-0+ struct dw_pcie pci; + void __iomem *mdb_base; + struct irq_domain *intx_domain; + struct irq_domain *mdb_domain; +}; + * amd_mdb_pcie_init_port - Initialize hardware + * @pcie: PCIe port information + * @pdev: platform device + */ +static int amd_mdb_pcie_init_port(struct amd_mdb_pcie *pcie, + struct platform_device *pdev)"pdev" is unused, why include it?
drivers/pci/controller/dwc/pcie-amd-mdb.c line 176
Quoted 6 lines
drivers/pci/controller/dwc/pcie-amd-mdb.c new file +6
-0+static irqreturn_t amd_mdb_pcie_event_flow (int irq,void *args) { +struct amd_mdb_pcie *pcie = args; +unsigned long val; +int i; + + val =pcie_read (pcie,AMD_MDB_TLP_IR_STATUS_MISC );Spurious extra space.
Quoted 9 lines
drivers/pci/controller/dwc/pcie-amd-mdb.c new file +9
-0+static int amd_mdb_pcie_init_irq_domains (struct amd_mdb_pcie *pcie, +struct platform_device *pdev) +{ +struct dw_pcie *pci = &pcie->pci; +struct dw_pcie_rp *pp = &pci->pp; +struct device *dev = &pdev->dev; +struct device_node *node = dev->of_node; +struct device_node *pcie_intc_node; +drivers/pci/controller/dwc/pcie-amd-mdb.c line 284
Quoted 10 lines
drivers/pci/controller/dwc/pcie-amd-mdb.c new file +10
-0+/* Setup INTx */ + pcie_intc_node =of_get_next_child (node,NULL ); +if (!pcie_intc_node) { +dev_err (dev,"No PCIe Intc node found\n" ); +return -EINVAL ; + } + + pcie->mdb_domain =irq_domain_add_linear (pcie_intc_node,32 , + &event_domain_ops, + pcie);Fix whitespace. "pcie" would fit on the previous line.
Bjorn
Quoted 4 lines · Thippeswamy Havalige
This series of patch add support for AMD MDB IP as Root Port.
The AMD MDB IP support's 32 bit and 64bit BAR's at Gen5 speed. As Root Port it supports MSI and legacy interrupts.
Why are you resending patches after 5 days? Your cover letter should explain this.
Read submitting patches about timeframes so you won't annoy/spam maintainers.
Best regards,
Krzysztof
Hi Krzysztof Kozlowski,
Thanks for your inputs, Sorry Will take care of this next patch.
Regards,
Thippeswamy H
Quoted 26 lines
-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Friday, December 13, 2024 2:26 PM
To: Havalige, Thippeswamy <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; Simek, Michal <[email protected]>; Gogada, Bharat Kumar <[email protected]>
Subject: Re: [RESEND PATCH v5 0/3] Add support for AMD MDB IP as Root PortQuoted 4 lines · Thippeswamy Havalige
This series of patch add support for AMD MDB IP as Root Port.
The AMD MDB IP support's 32 bit and 64bit BAR's at Gen5 speed. As Root Port it supports MSI and legacy interrupts.
Why are you resending patches after 5 days? Your cover letter should explain this.
Read submitting patches about timeframes so you won't annoy/spam maintainers.
Best regards,
Krzysztof