PCI: dwc: Fix higher MSI vectors handling
Subsystems (13)
v17 cover PCI: dwc: Fix higher MSI vectors handling
I have replied with my Tested-by to the patch at [2], which has landed in the linux-next as the commit 20f1bfb8dd62 ("PCI: qcom:
Add support for handling MSIs from 8 endpoints"). However lately I noticed that during the tests I still had 'pcie_pme=nomsi', so the device was not forced to use higher MSI vectors.
After removing this option I noticed that hight MSI vectors are not delivered on tested platforms. After additional research I stumbled upon a patch in msm-4.14 ([1]), which describes that each group of MSI vectors is mapped to the separate interrupt. Implement corresponding mapping.
Changes since v16:
- Fix a typo in the dt schema (noticed and fixed by Johan).
Changes since v15:
- Rebased on top of linux-next to take care of the conflict with the comit 27235cd867cf ("PCI: dwc: Fix MSI msi_msg DMA mapping").
Changes since v14:
- Fixed the dtschema warnings in qcom,pcie.yaml (reported by Rob Herring)
Changes since v13:
- Changed msiX from pointer to the char array (reported by Johan).
Changes since v12:
- Dropped split_msi_names array in favour of generating the msi_name on the fly (Rob),
- Dropped separate split MSI ISR as requested by Rob,
- Many small syntax & spelling changes as suggested by Johan and Rob,
- Moved a revert to be a last patch, as it is now a reminder to Lorenzo,
- Renamed series to name dwc rather than qcom, as the are no more actual changes to the qcom PCIe driver (Johan thanks for all suggestions for making the code to work as is).
Changes since v11 (suggested by Johan):
- Added back reporting errors for the "msi0" interrupt,
- Stopped overriding num_vectors field if it is less than the amount of MSI vectors deduced from interrupt list,
- Added a warning (and an override) if the host specifies more MSI vectors than available,
- Moved has_split_msi_irq variable to the patch where it is used.
Changes since v10:
- Remove has_split_msi_irqs flag. Trust DT and use split MSI IRQs if they are described in the DT. This removes the need for the pcie-qcom.c changes (everything is handled by the core (suggested by Johan).
- Rebased on top of Lorenzo's DWC branch
Changes since v9:
- Relax requirements and stop validating the DT. If the has_split_msi was specified, parse as many msiN irqs as specified in DT. If there are none, fallback to the single "msi" IRQ.
Changes since v8:
- Fix typos noted by Bjorn Helgaas
- Add missing links to the patch 1 (revert)
- Fix sm8250 interrupt-names (Johan)
- Specify num_vectors in qcom configuration data (Johan)
- Rework parsing of MSI IRQs (Johan)
Changes since v7:
- Move code back to the dwc core driver (as required by Rob),
- Change dt schema to require either a single "msi" interrupt or an array of "msi0", "msi1", ... "msi7" IRQs. Disallow specifying a part of the array (the DT should specify the exact amount of MSI IRQs allowing fallback to a single "msi" IRQ),
- Fix in the DWC init code for the dma_mapping_error() return value.
Changes since v6:
- Fix indentation of the arguments as requested by Stanimir
Changes since v5:
- Fixed commit subject and in-comment code according to Bjorn's suggestion,
- Changed variable idx to i to follow dw_handle_msi_irq() style.
Changes since v4:
- Fix the minItems/maxItems properties in the YAML schema.
Changes since v3:
- Reimplement MSI handling scheme in the Qualcomm host controller driver.
Changes since v2:
- Fix and rephrase commit message for patch 2.
Changes since v1:
- Split a huge patch into three patches as suggested by Bjorn Helgaas
- snps,dw-pcie removal is now part of [3]
[1] https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/commit/671a3d5f129f4bfe477152292ada2194c8440d22
[2] https://lore.kernel.org/linux-arm-msm/[email protected]/
Dmitry Baryshkov (6):
PCI: dwc: Correct msi_irq condition in dw_pcie_free_msi()
PCI: dwc: Convert msi_irq to the array
PCI: dwc: split MSI IRQ parsing/allocation to a separate function
PCI: dwc: Handle MSIs routed to multiple GIC interrupts
dt-bindings: PCI: qcom: Support additional MSI interrupts
arm64: dts: qcom: sm8250: provide additional MSI interrupts
.../devicetree/bindings/pci/qcom,pcie.yaml | 51 +++++- arch/arm64/boot/dts/qcom/sm8250.dtsi | 12 +- drivers/pci/controller/dwc/pci-dra7xx.c | 2 +- drivers/pci/controller/dwc/pci-exynos.c | 2 +- .../pci/controller/dwc/pcie-designware-host.c | 164 +++++++++++++----- drivers/pci/controller/dwc/pcie-designware.h | 2 +- drivers/pci/controller/dwc/pcie-keembay.c | 2 +- drivers/pci/controller/dwc/pcie-spear13xx.c | 2 +- drivers/pci/controller/dwc/pcie-tegra194.c | 2 +- 9 files changed, 185 insertions(+), 54 deletions(-)
Signature · 1 line
2.35.1
PATCH v17 1/6 PCI: dwc: Correct msi_irq condition in dw_pcie_free_msi()
The subdrivers pass -ESOMETHING if they do not want the core to touch MSI IRQ. dw_pcie_host_init() also checks if (msi_irq > 0) rather than just if (msi_irq). So let's make dw_pcie_free_msi() also check that msi_irq is greater than zero.
--- drivers/pci/controller/dwc/pcie-designware-host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-designware-host.c +1 -1
@@ -257,7 +257,7 @@ int dw_pcie_allocate_domains(struct dw_pcie_rp *pp)static void dw_pcie_free_msi (struct dw_pcie_rp *pp) { -if (pp->msi_irq) +if (pp->msi_irq >0 )irq_set_chained_handler_and_data (pp->msi_irq,NULL ,NULL );irq_domain_remove (pp->msi_domain);
Signature · 1 line
2.35.1
PATCH v17 2/6 PCI: dwc: Convert msi_irq to the array
In reply to Dmitry BaryshkovQualcomm version of DWC PCIe controller supports more than 32 MSI interrupts, but they are routed to separate interrupts in groups of 32 vectors. To support such configuration, change the msi_irq field into an array. Let the DWC core handle all interrupts that were set in this array.
--- drivers/pci/controller/dwc/pci-dra7xx.c | 2 +- drivers/pci/controller/dwc/pci-exynos.c | 2 +- .../pci/controller/dwc/pcie-designware-host.c | 32 ++++++++++++------- drivers/pci/controller/dwc/pcie-designware.h | 2 +- drivers/pci/controller/dwc/pcie-keembay.c | 2 +- drivers/pci/controller/dwc/pcie-spear13xx.c | 2 +- drivers/pci/controller/dwc/pcie-tegra194.c | 2 +- 7 files changed, 26 insertions(+), 18 deletions(-)
drivers/pci/controller/dwc/pci-dra7xx.c +1 -1
@@ -483,7 +483,7 @@ static int dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,return pp->irq;/* MSI IRQ is muxed */ - pp->msi_irq = -ENODEV ; + pp->msi_irq[0 ] = -ENODEV ; ret =dra7xx_pcie_init_irq_domain (pp);if (ret <0 )
drivers/pci/controller/dwc/pci-exynos.c +1 -1
@@ -292,7 +292,7 @@ static int exynos_add_pcie_port(struct exynos_pcie *ep, } pp->ops = &exynos_pcie_host_ops; - pp->msi_irq = -ENODEV ; + pp->msi_irq[0 ] = -ENODEV ; ret =dw_pcie_host_init (pp);if (ret) {
drivers/pci/controller/dwc/pcie-designware-host.c +20 -12
@@ -257,8 +257,12 @@ int dw_pcie_allocate_domains(struct dw_pcie_rp *pp)static void dw_pcie_free_msi (struct dw_pcie_rp *pp) { -if (pp->msi_irq >0 ) -irq_set_chained_handler_and_data (pp->msi_irq,NULL ,NULL ); +u32 ctrl; + +for (ctrl =0 ; ctrl <MAX_MSI_CTRLS ; ctrl++) { +if (pp->msi_irq[ctrl] >0 ) +irq_set_chained_handler_and_data (pp->msi_irq[ctrl],NULL ,NULL ); + }irq_domain_remove (pp->msi_domain);irq_domain_remove (pp->irq_domain);
@@ -369,13 +373,15 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)for (ctrl =0 ; ctrl < num_ctrls; ctrl++) pp->irq_mask[ctrl] = ~0 ; -if (!pp->msi_irq) { - pp->msi_irq =platform_get_irq_byname_optional (pdev,"msi" ); -if (pp->msi_irq <0 ) { - pp->msi_irq =platform_get_irq (pdev,0 ); -if (pp->msi_irq <0 ) -return pp->msi_irq; +if (!pp->msi_irq[0 ]) { +int irq =platform_get_irq_byname_optional (pdev,"msi" ); + +if (irq <0 ) { + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) +return irq; } + pp->msi_irq[0 ] = irq; } pp->msi_irq_chip = &dw_pci_msi_bottom_irq_chip;
@@ -384,10 +390,12 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)if (ret)return ret; -if (pp->msi_irq >0 ) -irq_set_chained_handler_and_data (pp->msi_irq, - dw_chained_msi_isr, - pp); +for (ctrl =0 ; ctrl < num_ctrls; ctrl++) { +if (pp->msi_irq[ctrl] >0 ) +irq_set_chained_handler_and_data (pp->msi_irq[ctrl], + dw_chained_msi_isr, + pp); + } ret =dma_set_mask (dev,DMA_BIT_MASK (32 ));if (ret)
drivers/pci/controller/dwc/pcie-designware.h +1 -1
@@ -188,7 +188,7 @@ struct dw_pcie_rp {u32 io_size;int irq;const struct dw_pcie_host_ops *ops; -int msi_irq; +int msi_irq[MAX_MSI_CTRLS ];struct irq_domain *irq_domain;struct irq_domain *msi_domain;dma_addr_t msi_data;
drivers/pci/controller/dwc/pcie-keembay.c +1 -1
@@ -338,7 +338,7 @@ static int keembay_pcie_add_pcie_port(struct keembay_pcie *pcie,int ret; pp->ops = &keembay_pcie_host_ops; - pp->msi_irq = -ENODEV ; + pp->msi_irq[0 ] = -ENODEV ; ret =keembay_pcie_setup_msi_irq (pcie);if (ret)
drivers/pci/controller/dwc/pcie-spear13xx.c +1 -1
@@ -172,7 +172,7 @@ static int spear13xx_add_pcie_port(struct spear13xx_pcie *spear13xx_pcie, } pp->ops = &spear13xx_pcie_host_ops; - pp->msi_irq = -ENODEV ; + pp->msi_irq[0 ] = -ENODEV ; ret =dw_pcie_host_init (pp);if (ret) {
drivers/pci/controller/dwc/pcie-tegra194.c +1 -1
@@ -2263,7 +2263,7 @@ static void tegra194_pcie_shutdown(struct platform_device *pdev)disable_irq (pcie->pci.pp.irq);if (IS_ENABLED (CONFIG_PCI_MSI )) -disable_irq (pcie->pci.pp.msi_irq); +disable_irq (pcie->pci.pp.msi_irq[0 ]);tegra194_pcie_pme_turnoff (pcie);tegra_pcie_unconfig_controller (pcie);
Signature · 1 line
2.35.1
PATCH v17 3/6 PCI: dwc: split MSI IRQ parsing/allocation to a separate function
In reply to Dmitry BaryshkovSplit handling of MSI host IRQs to a separate dw_pcie_msi_host_init() function. The code is complex enough to warrant a separate function.
--- .../pci/controller/dwc/pcie-designware-host.c | 103 ++++++++++-------- 1 file changed, 59 insertions(+), 44 deletions(-)
drivers/pci/controller/dwc/pcie-designware-host.c +59 -44
@@ -290,6 +290,63 @@ static void dw_pcie_msi_init(struct dw_pcie_rp *pp)dw_pcie_writel_dbi (pci,PCIE_MSI_ADDR_HI ,upper_32_bits (msi_target)); } +static int dw_pcie_msi_host_init (struct dw_pcie_rp *pp) +{ +struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +struct device *dev = pci->dev; +struct platform_device *pdev =to_platform_device (dev); +int ret; +u32 ctrl, num_ctrls; + + num_ctrls = pp->num_vectors /MAX_MSI_IRQS_PER_CTRL ; +for (ctrl =0 ; ctrl < num_ctrls; ctrl++) + pp->irq_mask[ctrl] = ~0 ; + +if (!pp->msi_irq[0 ]) { +int irq =platform_get_irq_byname_optional (pdev,"msi" ); + +if (irq <0 ) { + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) +return irq; + } + pp->msi_irq[0 ] = irq; + } + + pp->msi_irq_chip = &dw_pci_msi_bottom_irq_chip; + + ret =dw_pcie_allocate_domains (pp); +if (ret) +return ret; + +for (ctrl =0 ; ctrl < num_ctrls; ctrl++) { +if (pp->msi_irq[ctrl] >0 ) +irq_set_chained_handler_and_data (pp->msi_irq[ctrl], + dw_chained_msi_isr, + pp); + } + + ret =dma_set_mask (dev,DMA_BIT_MASK (32 )); +if (ret) +dev_warn (dev,"Failed to set DMA mask to 32-bit. Devices with only 32-bit MSI support may not work properly\n" ); + + pp->msi_page =alloc_page (GFP_DMA32 ); + pp->msi_data =dma_map_page (dev, pp->msi_page,0 , +PAGE_SIZE ,DMA_FROM_DEVICE ); + ret =dma_mapping_error (dev, pp->msi_data); +if (ret) { +dev_err (pci->dev,"Failed to map MSI data\n" ); +__free_page (pp->msi_page); + pp->msi_page =NULL ; + pp->msi_data =0 ; +dw_pcie_free_msi (pp); + +return ret; + } + +return 0 ; +} +int dw_pcie_host_init (struct dw_pcie_rp *pp) {struct dw_pcie *pci =to_dw_pcie_from_pp (pp);
@@ -367,51 +424,9 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)if (ret <0 )return ret; }else if (pp->has_msi_ctrl) { -u32 ctrl, num_ctrls; - - num_ctrls = pp->num_vectors /MAX_MSI_IRQS_PER_CTRL ; -for (ctrl =0 ; ctrl < num_ctrls; ctrl++) - pp->irq_mask[ctrl] = ~0 ; - -if (!pp->msi_irq[0 ]) { -int irq =platform_get_irq_byname_optional (pdev,"msi" ); - -if (irq <0 ) { - irq =platform_get_irq (pdev,0 ); -if (irq <0 ) -return irq; - } - pp->msi_irq[0 ] = irq; - } - - pp->msi_irq_chip = &dw_pci_msi_bottom_irq_chip; - - ret =dw_pcie_allocate_domains (pp); -if (ret) + ret =dw_pcie_msi_host_init (pp); +if (ret <0 )return ret; - -for (ctrl =0 ; ctrl < num_ctrls; ctrl++) { -if (pp->msi_irq[ctrl] >0 ) -irq_set_chained_handler_and_data (pp->msi_irq[ctrl], - dw_chained_msi_isr, - pp); - } - - ret =dma_set_mask (dev,DMA_BIT_MASK (32 )); -if (ret) -dev_warn (dev,"Failed to set DMA mask to 32-bit. Devices with only 32-bit MSI support may not work properly\n" ); - - pp->msi_page =alloc_page (GFP_DMA32 ); - pp->msi_data =dma_map_page (dev, pp->msi_page,0 , -PAGE_SIZE ,DMA_FROM_DEVICE ); - ret =dma_mapping_error (dev, pp->msi_data); -if (ret) { -dev_err (pci->dev,"Failed to map MSI data\n" ); -__free_page (pp->msi_page); - pp->msi_page =NULL ; - pp->msi_data =0 ; - goto err_free_msi; - } } }
Signature · 1 line
2.35.1
PATCH v17 4/6 PCI: dwc: Handle MSIs routed to multiple GIC interrupts
In reply to Dmitry BaryshkovOn some of Qualcomm platforms each group of 32 MSI vectors is routed to the separate GIC interrupt. Implement support for such configurations by parsing "msi0" ... "msiN" interrupts and attaching them to the chained handler.
Note, that if DT doesn't list an array of MSI interrupts and uses single "msi" IRQ, the driver will limit the amount of supported MSI vectors accordingly (to 32).
--- .../pci/controller/dwc/pcie-designware-host.c | 63 +++++++++++++++++-- 1 file changed, 59 insertions(+), 4 deletions(-)
drivers/pci/controller/dwc/pcie-designware-host.c +59 -4
@@ -290,6 +290,46 @@ static void dw_pcie_msi_init(struct dw_pcie_rp *pp)dw_pcie_writel_dbi (pci,PCIE_MSI_ADDR_HI ,upper_32_bits (msi_target)); } +static int dw_pcie_parse_split_msi_irq (struct dw_pcie_rp *pp) +{ +struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +struct device *dev = pci->dev; +struct platform_device *pdev =to_platform_device (dev); +int irq; +u32 ctrl, max_vectors; + +/* Parse as many IRQs as described in the devicetree. */ +for (ctrl =0 ; ctrl <MAX_MSI_CTRLS ; ctrl++) { +char msi_name[] ="msiX" ; + + msi_name[3 ] ='0' + ctrl; + irq =platform_get_irq_byname_optional (pdev, msi_name); +if (irq == -ENXIO ) +break ; +if (irq <0 ) +return dev_err_probe (dev, irq, +"Failed to parse MSI IRQ '%s'\n" , + msi_name); + + pp->msi_irq[ctrl] = irq; + } + +/* If there were no "msiN" IRQs at all, fallback to the standard "msi" IRQ. */ +if (ctrl ==0 ) +return -ENXIO ; + + max_vectors = ctrl *MAX_MSI_IRQS_PER_CTRL ; +if (pp->num_vectors > max_vectors) { +dev_warn (dev,"Exceeding number of MSI vectors, limiting to %u\n" , + max_vectors); + pp->num_vectors = max_vectors; + } +if (!pp->num_vectors) + pp->num_vectors = max_vectors; + +return 0 ; +} +static int dw_pcie_msi_host_init (struct dw_pcie_rp *pp) {struct dw_pcie *pci =to_dw_pcie_from_pp (pp);
@@ -298,21 +338,32 @@ static int dw_pcie_msi_host_init(struct dw_pcie_rp *pp)int ret;u32 ctrl, num_ctrls; - num_ctrls = pp->num_vectors /MAX_MSI_IRQS_PER_CTRL ; -for (ctrl =0 ; ctrl < num_ctrls; ctrl++) +for (ctrl =0 ; ctrl <MAX_MSI_CTRLS ; ctrl++) pp->irq_mask[ctrl] = ~0 ; +if (!pp->msi_irq[0 ]) { + ret =dw_pcie_parse_split_msi_irq (pp); +if (ret <0 && ret != -ENXIO ) +return ret; + } + +if (!pp->num_vectors) + pp->num_vectors =MSI_DEF_NUM_VECTORS ; + num_ctrls = pp->num_vectors /MAX_MSI_IRQS_PER_CTRL ; +if (!pp->msi_irq[0 ]) {int irq =platform_get_irq_byname_optional (pdev,"msi" );if (irq <0 ) { irq =platform_get_irq (pdev,0 );if (irq <0 ) -return irq; +return dev_err_probe (dev, irq,"Failed to parse MSI irq\n" ); } pp->msi_irq[0 ] = irq; } +dev_dbg (dev,"Using %d MSI vectors\n" , pp->num_vectors); + pp->msi_irq_chip = &dw_pci_msi_bottom_irq_chip; ret =dw_pcie_allocate_domains (pp);
@@ -412,7 +463,11 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)of_property_read_bool (np,"msi-parent" ) || of_property_read_bool(np, "msi-map")); -if (!pp->num_vectors) { +/* +* For the has_msi_ctrl case the default assignment is handled +* in the dw_pcie_msi_host_init(). +*/ +if (!pp->has_msi_ctrl && !pp->num_vectors) { pp->num_vectors =MSI_DEF_NUM_VECTORS ; }else if (pp->num_vectors >MAX_MSI_IRQS ) {dev_err (dev,"Invalid number of vectors\n" );
Signature · 1 line
2.35.1
PATCH v17 5/6 dt-bindings: PCI: qcom: Support additional MSI interrupts
In reply to Dmitry BaryshkovOn Qualcomm platforms each group of 32 MSI vectors is routed to the separate GIC interrupt. Document mapping of additional interrupts.
--- .../devicetree/bindings/pci/qcom,pcie.yaml | 51 +++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pci/qcom,pcie.yaml +48 -3
@@ -43,11 +43,12 @@ properties: maxItems: 5 interrupts: - maxItems: 1 + minItems: 1 + maxItems: 8 interrupt-names: - items: - - const: msi + minItems: 1 + maxItems: 8 # Common definitions for clocks, clock-names and reset. # Platform constraints are described later.
@@ -623,6 +624,50 @@ allOf: - resets - reset-names + # On newer chipsets support either 1 or 8 msi interrupts + # On older chipsets it's always 1 msi interrupt + - if: + properties: + compatible: + contains: + enum: + - qcom,pcie-msm8996 + - qcom,pcie-sc7280 + - qcom,pcie-sc8180x + - qcom,pcie-sdm845 + - qcom,pcie-sm8150 + - qcom,pcie-sm8250 + - qcom,pcie-sm8450-pcie0 + - qcom,pcie-sm8450-pcie1 + then: + oneOf: + - properties: + interrupts: + maxItems: 1 + interrupt-names: + items: + - const: msi + - properties: + interrupts: + minItems: 8 + interrupt-names: + items: + - const: msi0 + - const: msi1 + - const: msi2 + - const: msi3 + - const: msi4 + - const: msi5 + - const: msi6 + - const: msi7 + else: + properties: + interrupts: + maxItems: 1 + interrupt-names: + items: + - const: msi + unevaluatedProperties: false examples:
Signature · 1 line
2.35.1
Re: [PATCH v17 5/6] dt-bindings: PCI: qcom: Support additional MSI interrupts
Quoted 6 lines · Dmitry Baryshkov
On Qualcomm platforms each group of 32 MSI vectors is routed to the separate GIC interrupt. Document mapping of additional interrupts.
Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Rob Herring <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>
Re: [PATCH v17 5/6] dt-bindings: PCI: qcom: Support additional MSI interrupts
In reply to Dmitry BaryshkovQuoted 9 lines · Dmitry Baryshkov
On Qualcomm platforms each group of 32 MSI vectors is routed to the separate GIC interrupt. Document mapping of additional interrupts.
Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Rob Herring <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- .../devicetree/bindings/pci/qcom,pcie.yaml | 51 +++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions
Signature · 2 lines
regards, Stan
PATCH v17 6/6 arm64: dts: qcom: sm8250: provide additional MSI interrupts
In reply to Dmitry BaryshkovOn SM8250 each group of MSI interrupts is mapped to the separate host interrupt. Describe each of interrupts in the device tree for PCIe0 host.
Tested on Qualcomm RB5 platform with first group of MSI interrupts being used by the PME and attached ath11k WiFi chip using second group of MSI interrupts.
--- arch/arm64/boot/dts/qcom/sm8250.dtsi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm8250.dtsi +10 -2
@@ -1810,8 +1810,16 @@ pcie0: pci@1c00000 { ranges = <0x01000000 0x0 0x60200000 0 0x60200000 0x0 0x100000>, <0x02000000 0x0 0x60300000 0 0x60300000 0x0 0x3d00000>; - interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "msi"; + interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "msi0", "msi1", "msi2", "msi3", + "msi4", "msi5", "msi6", "msi7"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0x7>; interrupt-map = <0 0 0 1 &intc 0 149 IRQ_TYPE_LEVEL_HIGH>, /* int_a */
Signature · 1 line
2.35.1
Quoted 11 lines · Dmitry Baryshkov
I have replied with my Tested-by to the patch at [2], which has landed in the linux-next as the commit
20f1bfb8dd62("PCI: qcom:
Add support for handling MSIs from 8 endpoints"). However lately I noticed that during the tests I still had 'pcie_pme=nomsi', so the device was not forced to use higher MSI vectors.After removing this option I noticed that hight MSI vectors are not delivered on tested platforms. After additional research I stumbled upon a patch in msm-4.14 ([1]), which describes that each group of MSI vectors is mapped to the separate interrupt. Implement corresponding mapping.
[skipped]
Gracious ping. Does this series stand a chance of getting into 5.20?
Quoted 19 lines
Dmitry Baryshkov (6):
PCI: dwc: Correctmsi_irqcondition indw_pcie_free_msi()
PCI: dwc: Convertmsi_irqto the array
PCI: dwc: split MSI IRQ parsing/allocation to a separate function
PCI: dwc: Handle MSIs routed to multiple GIC interrupts
dt-bindings: PCI: qcom: Support additional MSI interrupts
arm64: dts: qcom: sm8250: provide additional MSI interrupts.../devicetree/bindings/pci/qcom,pcie.yaml | 51 +++++- arch/arm64/boot/dts/qcom/sm8250.dtsi | 12 +- drivers/pci/controller/dwc/pci-dra7xx.c | 2 +- drivers/pci/controller/dwc/pci-exynos.c | 2 +- .../pci/controller/dwc/pcie-designware-host.c | 164 +++++++++++++----- drivers/pci/controller/dwc/pcie-designware.h | 2 +- drivers/pci/controller/dwc/pcie-keembay.c | 2 +- drivers/pci/controller/dwc/pcie-spear13xx.c | 2 +- drivers/pci/controller/dwc/pcie-tegra194.c | 2 +- 9 files changed, 185 insertions(+), 54 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Quoted 13 lines · Dmitry Baryshkov
Quoted 11 lines · Dmitry Baryshkov
I have replied with my Tested-by to the patch at [2], which has landed in the linux-next as the commit
20f1bfb8dd62("PCI: qcom:
Add support for handling MSIs from 8 endpoints"). However lately I noticed that during the tests I still had 'pcie_pme=nomsi', so the device was not forced to use higher MSI vectors.After removing this option I noticed that hight MSI vectors are not delivered on tested platforms. After additional research I stumbled upon a patch in msm-4.14 ([1]), which describes that each group of MSI vectors is mapped to the separate interrupt. Implement corresponding mapping.
Quoted 3 lines
[skipped]
Gracious ping. Does this series stand a chance of getting into 5.20?
Bjorn, please excuse my insistence. Given that it's not merged (yet), probably it will not make it into 5.20. Is there anything preventing it from being accepted for 5.21?
dwc patches were reviewed by Rob, Mani and Johan. Stanimir has acked the bindings patch.
The dts patch should probably go via the arm-soc tree (together with additional patches adding multiple MSI IRQs to other Qualcomm SoCs).
Quoted 22 lines
Quoted 20 lines
Dmitry Baryshkov (6):
PCI: dwc: Correctmsi_irqcondition indw_pcie_free_msi()
PCI: dwc: Convertmsi_irqto the array
PCI: dwc: split MSI IRQ parsing/allocation to a separate function
PCI: dwc: Handle MSIs routed to multiple GIC interrupts
dt-bindings: PCI: qcom: Support additional MSI interrupts
arm64: dts: qcom: sm8250: provide additional MSI interrupts.../devicetree/bindings/pci/qcom,pcie.yaml | 51 +++++- arch/arm64/boot/dts/qcom/sm8250.dtsi | 12 +- drivers/pci/controller/dwc/pci-dra7xx.c | 2 +- drivers/pci/controller/dwc/pci-exynos.c | 2 +-
.../pci/controller/dwc/pcie-designware-host.c| 164 +++++++++++++----- drivers/pci/controller/dwc/pcie-designware.h | 2 +- drivers/pci/controller/dwc/pcie-keembay.c | 2 +- drivers/pci/controller/dwc/pcie-spear13xx.c | 2 +- drivers/pci/controller/dwc/pcie-tegra194.c | 2 +-9 files changed, 185 insertions(+), 54 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Bjorn Helgaas
AppliedQuoted 98 lines · Dmitry Baryshkov
I have replied with my Tested-by to the patch at [2], which has landed in the linux-next as the commit
20f1bfb8dd62("PCI: qcom:
Add support for handling MSIs from 8 endpoints"). However lately I noticed that during the tests I still had 'pcie_pme=nomsi', so the device was not forced to use higher MSI vectors.After removing this option I noticed that hight MSI vectors are not delivered on tested platforms. After additional research I stumbled upon a patch in msm-4.14 ([1]), which describes that each group of MSI vectors is mapped to the separate interrupt. Implement corresponding mapping.
Changes since v16:
- Fix a typo in the dt schema (noticed and fixed by Johan).Changes since v15:
- Rebased on top of linux-next to take care of the conflict with the comit27235cd867cf("PCI: dwc: Fix MSImsi_msgDMA mapping").Changes since v14:
- Fixed the dtschema warnings in qcom,pcie.yaml (reported by Rob Herring)Changes since v13:
- Changed msiX from pointer to the char array (reported by Johan).Changes since v12:
- Droppedsplit_msi_namesarray in favour of generating themsi_nameon the fly (Rob),
- Dropped separate split MSI ISR as requested by Rob,
- Many small syntax & spelling changes as suggested by Johan and Rob,
- Moved a revert to be a last patch, as it is now a reminder to Lorenzo,
- Renamed series to name dwc rather than qcom, as the are no more actual changes to the qcom PCIe driver (Johan thanks for all suggestions for making the code to work as is).Changes since v11 (suggested by Johan):
- Added back reporting errors for the "msi0" interrupt,
- Stopped overridingnum_vectorsfield if it is less than the amount of MSI vectors deduced from interrupt list,
- Added a warning (and an override) if the host specifies more MSI vectors than available,
- Movedhas_split_msi_irqvariable to the patch where it is used.Changes since v10:
- Removehas_split_msi_irqsflag. Trust DT and use split MSI IRQs if they are described in the DT. This removes the need for thepcie-qcom.cchanges (everything is handled by the core (suggested by Johan).
- Rebased on top of Lorenzo's DWC branchChanges since v9:
- Relax requirements and stop validating the DT. If thehas_split_msiwas specified, parse as many msiN irqs as specified in DT. If there are none, fallback to the single "msi" IRQ.Changes since v8:
- Fix typos noted by Bjorn Helgaas
- Add missing links to the patch 1 (revert)
- Fix sm8250 interrupt-names (Johan)
- Specifynum_vectorsin qcom configuration data (Johan)
- Rework parsing of MSI IRQs (Johan)Changes since v7:
- Move code back to the dwc core driver (as required by Rob),
- Change dt schema to require either a single "msi" interrupt or an array of "msi0", "msi1", ... "msi7" IRQs. Disallow specifying a part of the array (the DT should specify the exact amount of MSI IRQs allowing fallback to a single "msi" IRQ),
- Fix in the DWC init code for thedma_mapping_error()return value.Changes since v6:
- Fix indentation of the arguments as requested by StanimirChanges since v5:
- Fixed commit subject and in-comment code according to Bjorn's suggestion,
- Changed variable idx to i to followdw_handle_msi_irq()style.Changes since v4:
- Fix the minItems/maxItems properties in the YAML schema.Changes since v3:
- Reimplement MSI handling scheme in the Qualcomm host controller driver.Changes since v2:
- Fix and rephrase commit message for patch 2.Changes since v1:
- Split a huge patch into three patches as suggested by Bjorn Helgaas
- snps,dw-pcie removal is now part of [3][1] https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/commit/671a3d5f129f4bfe477152292ada2194c8440d22
[2] https://lore.kernel.org/linux-arm-msm/[email protected]/
Quoted 6 lines
Dmitry Baryshkov (6):
PCI: dwc: Correctmsi_irqcondition indw_pcie_free_msi()
PCI: dwc: Convertmsi_irqto the array
PCI: dwc: split MSI IRQ parsing/allocation to a separate function
PCI: dwc: Handle MSIs routed to multiple GIC interrupts
dt-bindings: PCI: qcom: Support additional MSI interrupts
I applied the above to pci/ctrl/dwc for v5.20, thanks!
I reordered "split MSI stuff to separate function" before "convert to array" to reduce the complexity first before adding more.
I also dropped the "irq" temporary in "Convert msi_irq to the array", not because I necessary object to it, but because it's not strictly related to converting to an array. Previously we might have left pp->msi_irq containing an error code (< 0), but the same situation after the patch would leave pp->msi_irq[0] == 0.
I left the arch/arm64/boot/dts/qcom/sm8250.dtsi change below out on the assumption it will go via arm-soc.
Quoted 16 lines
arm64: dts: qcom: sm8250: provide additional MSI interrupts
.../devicetree/bindings/pci/qcom,pcie.yaml | 51 +++++- arch/arm64/boot/dts/qcom/sm8250.dtsi | 12 +- drivers/pci/controller/dwc/pci-dra7xx.c | 2 +- drivers/pci/controller/dwc/pci-exynos.c | 2 +- .../pci/controller/dwc/pcie-designware-host.c | 164 +++++++++++++----- drivers/pci/controller/dwc/pcie-designware.h | 2 +- drivers/pci/controller/dwc/pcie-keembay.c | 2 +- drivers/pci/controller/dwc/pcie-spear13xx.c | 2 +- drivers/pci/controller/dwc/pcie-tegra194.c | 2 +- 9 files changed, 185 insertions(+), 54 deletions(-)Signature · 1 line
2.35.1
Quoted 109 lines · Bjorn Helgaas
Quoted 98 lines · Dmitry Baryshkov
I have replied with my Tested-by to the patch at [2], which has landed in the linux-next as the commit
20f1bfb8dd62("PCI: qcom:
Add support for handling MSIs from 8 endpoints"). However lately I noticed that during the tests I still had 'pcie_pme=nomsi', so the device was not forced to use higher MSI vectors.After removing this option I noticed that hight MSI vectors are not delivered on tested platforms. After additional research I stumbled upon a patch in msm-4.14 ([1]), which describes that each group of MSI vectors is mapped to the separate interrupt. Implement corresponding mapping.
Changes since v16:
- Fix a typo in the dt schema (noticed and fixed by Johan).Changes since v15:
- Rebased on top of linux-next to take care of the conflict with the comit27235cd867cf("PCI: dwc: Fix MSImsi_msgDMA mapping").Changes since v14:
- Fixed the dtschema warnings in qcom,pcie.yaml (reported by Rob Herring)Changes since v13:
- Changed msiX from pointer to the char array (reported by Johan).Changes since v12:
- Droppedsplit_msi_namesarray in favour of generating themsi_nameon the fly (Rob),
- Dropped separate split MSI ISR as requested by Rob,
- Many small syntax & spelling changes as suggested by Johan and Rob,
- Moved a revert to be a last patch, as it is now a reminder to Lorenzo,
- Renamed series to name dwc rather than qcom, as the are no more actual changes to the qcom PCIe driver (Johan thanks for all suggestions for making the code to work as is).Changes since v11 (suggested by Johan):
- Added back reporting errors for the "msi0" interrupt,
- Stopped overridingnum_vectorsfield if it is less than the amount of MSI vectors deduced from interrupt list,
- Added a warning (and an override) if the host specifies more MSI vectors than available,
- Movedhas_split_msi_irqvariable to the patch where it is used.Changes since v10:
- Removehas_split_msi_irqsflag. Trust DT and use split MSI IRQs if they are described in the DT. This removes the need for thepcie-qcom.cchanges (everything is handled by the core (suggested by Johan).
- Rebased on top of Lorenzo's DWC branchChanges since v9:
- Relax requirements and stop validating the DT. If thehas_split_msiwas specified, parse as many msiN irqs as specified in DT. If there are none, fallback to the single "msi" IRQ.Changes since v8:
- Fix typos noted by Bjorn Helgaas
- Add missing links to the patch 1 (revert)
- Fix sm8250 interrupt-names (Johan)
- Specifynum_vectorsin qcom configuration data (Johan)
- Rework parsing of MSI IRQs (Johan)Changes since v7:
- Move code back to the dwc core driver (as required by Rob),
- Change dt schema to require either a single "msi" interrupt or an array of "msi0", "msi1", ... "msi7" IRQs. Disallow specifying a part of the array (the DT should specify the exact amount of MSI IRQs allowing fallback to a single "msi" IRQ),
- Fix in the DWC init code for thedma_mapping_error()return value.Changes since v6:
- Fix indentation of the arguments as requested by StanimirChanges since v5:
- Fixed commit subject and in-comment code according to Bjorn's suggestion,
- Changed variable idx to i to followdw_handle_msi_irq()style.Changes since v4:
- Fix the minItems/maxItems properties in the YAML schema.Changes since v3:
- Reimplement MSI handling scheme in the Qualcomm host controller driver.Changes since v2:
- Fix and rephrase commit message for patch 2.Changes since v1:
- Split a huge patch into three patches as suggested by Bjorn Helgaas
- snps,dw-pcie removal is now part of [3][1] https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/commit/671a3d5f129f4bfe477152292ada2194c8440d22
[2] https://lore.kernel.org/linux-arm-msm/[email protected]/Quoted 6 lines
Dmitry Baryshkov (6):
PCI: dwc: Correctmsi_irqcondition indw_pcie_free_msi()
PCI: dwc: Convertmsi_irqto the array
PCI: dwc: split MSI IRQ parsing/allocation to a separate function
PCI: dwc: Handle MSIs routed to multiple GIC interrupts
dt-bindings: PCI: qcom: Support additional MSI interruptsI applied the above to pci/ctrl/dwc for v5.20, thanks!
Quoted 8 lines
I reordered "split MSI stuff to separate function" before "convert to array" to reduce the complexity first before adding more.
I also dropped the "irq" temporary in "Convert
msi_irqto the array", not because I necessary object to it, but because it's not strictly related to converting to an array. Previously we might have leftpp->msi_irqcontaining an error code (< 0), but the same situation after the patch would leave pp->msi_irq[0] == 0.
Ack, thank you. I do not have strong preference, so let it be so.
Quoted 3 lines
I left the
arch/arm64/boot/dts/qcom/sm8250.dtsichange below out on the assumption it will go via arm-soc.
Yes. Thanks a lot!
Quoted 17 lines
Quoted 17 lines
arm64: dts: qcom: sm8250: provide additional MSI interrupts
.../devicetree/bindings/pci/qcom,pcie.yaml | 51 +++++- arch/arm64/boot/dts/qcom/sm8250.dtsi | 12 +- drivers/pci/controller/dwc/pci-dra7xx.c | 2 +- drivers/pci/controller/dwc/pci-exynos.c | 2 +- .../pci/controller/dwc/pcie-designware-host.c | 164 +++++++++++++----- drivers/pci/controller/dwc/pcie-designware.h | 2 +- drivers/pci/controller/dwc/pcie-keembay.c | 2 +- drivers/pci/controller/dwc/pcie-spear13xx.c | 2 +- drivers/pci/controller/dwc/pcie-tegra194.c | 2 +- 9 files changed, 185 insertions(+), 54 deletions(-)--
2.35.1
Signature · 2 lines
With best wishes Dmitry
Re: (subset) [PATCH v17 0/6] PCI: dwc: Fix higher MSI vectors handling
In reply to Dmitry BaryshkovQuoted 6 lines · Dmitry Baryshkov
I have replied with my Tested-by to the patch at [2], which has landed in the linux-next as the commit
20f1bfb8dd62("PCI: qcom:
Add support for handling MSIs from 8 endpoints"). However lately I noticed that during the tests I still had 'pcie_pme=nomsi', so the device was not forced to use higher MSI vectors.
Quoted 7 lines
After removing this option I noticed that hight MSI vectors are not delivered on tested platforms. After additional research I stumbled upon a patch in msm-4.14 ([1]), which describes that each group of MSI vectors is mapped to the separate interrupt. Implement corresponding mapping.
[...]
Applied, thanks!
[6/6] arm64: dts: qcom: sm8250: provide additional MSI interrupts
commit: f2819650aab5b037e5e730c88abcd971e96a1637
Best regards,
Signature · 1 line
Bjorn Andersson <[email protected]>