Skip to content

Commit db38834

Browse files
lumagbjorn-helgaas
authored andcommitted
PCI: dwc: Convert struct pcie_port.msi_irq to an array
The Qualcomm DWC PCIe controller supports more than 32 MSI interrupts, but they are routed to separate interrupts in groups of 32 vectors. To support this configuration, change the msi_irq field to an array. Let the DWC core handle all interrupts that were set in this array. [bhelgaas: reorder, drop "irq" temporary to make patch cleaner] Link: https://lore.kernel.org/r/20220707134733.2436629-3-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Rob Herring <robh@kernel.org> Reviewed-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
1 parent 226ec08 commit db38834

7 files changed

Lines changed: 24 additions & 17 deletions

File tree

drivers/pci/controller/dwc/pci-dra7xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ static int dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,
483483
return pp->irq;
484484

485485
/* MSI IRQ is muxed */
486-
pp->msi_irq = -ENODEV;
486+
pp->msi_irq[0] = -ENODEV;
487487

488488
ret = dra7xx_pcie_init_irq_domain(pp);
489489
if (ret < 0)

drivers/pci/controller/dwc/pci-exynos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ static int exynos_add_pcie_port(struct exynos_pcie *ep,
292292
}
293293

294294
pp->ops = &exynos_pcie_host_ops;
295-
pp->msi_irq = -ENODEV;
295+
pp->msi_irq[0] = -ENODEV;
296296

297297
ret = dw_pcie_host_init(pp);
298298
if (ret) {

drivers/pci/controller/dwc/pcie-designware-host.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,13 @@ int dw_pcie_allocate_domains(struct dw_pcie_rp *pp)
257257

258258
static void dw_pcie_free_msi(struct dw_pcie_rp *pp)
259259
{
260-
if (pp->msi_irq > 0)
261-
irq_set_chained_handler_and_data(pp->msi_irq, NULL, NULL);
260+
u32 ctrl;
261+
262+
for (ctrl = 0; ctrl < MAX_MSI_CTRLS; ctrl++) {
263+
if (pp->msi_irq[ctrl] > 0)
264+
irq_set_chained_handler_and_data(pp->msi_irq[ctrl],
265+
NULL, NULL);
266+
}
262267

263268
irq_domain_remove(pp->msi_domain);
264269
irq_domain_remove(pp->irq_domain);
@@ -298,12 +303,12 @@ static int dw_pcie_msi_host_init(struct dw_pcie_rp *pp)
298303
for (ctrl = 0; ctrl < num_ctrls; ctrl++)
299304
pp->irq_mask[ctrl] = ~0;
300305

301-
if (!pp->msi_irq) {
302-
pp->msi_irq = platform_get_irq_byname_optional(pdev, "msi");
303-
if (pp->msi_irq < 0) {
304-
pp->msi_irq = platform_get_irq(pdev, 0);
305-
if (pp->msi_irq < 0)
306-
return pp->msi_irq;
306+
if (!pp->msi_irq[0]) {
307+
pp->msi_irq[0] = platform_get_irq_byname_optional(pdev, "msi");
308+
if (pp->msi_irq[0] < 0) {
309+
pp->msi_irq[0] = platform_get_irq(pdev, 0);
310+
if (pp->msi_irq[0] < 0)
311+
return pp->msi_irq[0];
307312
}
308313
}
309314

@@ -313,9 +318,11 @@ static int dw_pcie_msi_host_init(struct dw_pcie_rp *pp)
313318
if (ret)
314319
return ret;
315320

316-
if (pp->msi_irq > 0)
317-
irq_set_chained_handler_and_data(pp->msi_irq,
318-
dw_chained_msi_isr, pp);
321+
for (ctrl = 0; ctrl < num_ctrls; ctrl++) {
322+
if (pp->msi_irq[ctrl] > 0)
323+
irq_set_chained_handler_and_data(pp->msi_irq[ctrl],
324+
dw_chained_msi_isr, pp);
325+
}
319326

320327
ret = dma_set_mask(dev, DMA_BIT_MASK(32));
321328
if (ret)

drivers/pci/controller/dwc/pcie-designware.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ struct dw_pcie_rp {
200200
u32 io_size;
201201
int irq;
202202
const struct dw_pcie_host_ops *ops;
203-
int msi_irq;
203+
int msi_irq[MAX_MSI_CTRLS];
204204
struct irq_domain *irq_domain;
205205
struct irq_domain *msi_domain;
206206
dma_addr_t msi_data;

drivers/pci/controller/dwc/pcie-keembay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ static int keembay_pcie_add_pcie_port(struct keembay_pcie *pcie,
338338
int ret;
339339

340340
pp->ops = &keembay_pcie_host_ops;
341-
pp->msi_irq = -ENODEV;
341+
pp->msi_irq[0] = -ENODEV;
342342

343343
ret = keembay_pcie_setup_msi_irq(pcie);
344344
if (ret)

drivers/pci/controller/dwc/pcie-spear13xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static int spear13xx_add_pcie_port(struct spear13xx_pcie *spear13xx_pcie,
172172
}
173173

174174
pp->ops = &spear13xx_pcie_host_ops;
175-
pp->msi_irq = -ENODEV;
175+
pp->msi_irq[0] = -ENODEV;
176176

177177
ret = dw_pcie_host_init(pp);
178178
if (ret) {

drivers/pci/controller/dwc/pcie-tegra194.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,7 @@ static void tegra194_pcie_shutdown(struct platform_device *pdev)
22612261

22622262
disable_irq(pcie->pci.pp.irq);
22632263
if (IS_ENABLED(CONFIG_PCI_MSI))
2264-
disable_irq(pcie->pci.pp.msi_irq);
2264+
disable_irq(pcie->pci.pp.msi_irq[0]);
22652265

22662266
tegra194_pcie_pme_turnoff(pcie);
22672267
tegra_pcie_unconfig_controller(pcie);

0 commit comments

Comments
 (0)