* [PATCH] PCI: tegra194: Fix broken tegra_pcie_ep_raise_msi_irq()
@ 2025-09-19 15:23 Niklas Cassel
2025-09-20 15:38 ` Manivannan Sadhasivam
0 siblings, 1 reply; 2+ messages in thread
From: Niklas Cassel @ 2025-09-19 15:23 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Thierry Reding,
Jonathan Hunter
Cc: Vidya Sagar, Shin'ichiro Kawasaki, Niklas Cassel, linux-pci,
linux-tegra
The pci_epc_raise_irq() supplies a MSI or MSI-X interrupt number in range
(1-N), see kdoc for pci_epc_raise_irq().
Thus, for MSI pci_epc_raise_irq() will supply interrupt number 1-32.
Convert the interrupt number to an MSI vector.
With this, the PCI endpoint kselftest test case MSI_TEST passes.
Also, set msi_capable to true, as the driver obviously supports MSI.
This helps pci_endpoint_test to use the optimal IRQ type when using
PCITEST_IRQ_TYPE_AUTO.
Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
Note to PCI maintainers: this patch is made on top of
27fce9e8c6f0 ("PCI: endpoint: Drop superfluous pci_epc_features initialization")
which is currently queued on branch pci/endpoint.
drivers/pci/controller/dwc/pcie-tegra194.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index 0e413857649fd..fe418b9bfbb4b 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -1955,10 +1955,10 @@ static int tegra_pcie_ep_raise_intx_irq(struct tegra_pcie_dw *pcie, u16 irq)
static int tegra_pcie_ep_raise_msi_irq(struct tegra_pcie_dw *pcie, u16 irq)
{
- if (unlikely(irq > 31))
+ if (unlikely(irq > 32))
return -EINVAL;
- appl_writel(pcie, BIT(irq), APPL_MSI_CTRL_1);
+ appl_writel(pcie, BIT(irq - 1), APPL_MSI_CTRL_1);
return 0;
}
@@ -1998,6 +1998,7 @@ static int tegra_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
static const struct pci_epc_features tegra_pcie_epc_features = {
.linkup_notifier = true,
+ .msi_capable = true,
.bar[BAR_0] = { .type = BAR_FIXED, .fixed_size = SZ_1M,
.only_64bit = true, },
.bar[BAR_1] = { .type = BAR_RESERVED, },
--
2.51.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] PCI: tegra194: Fix broken tegra_pcie_ep_raise_msi_irq()
2025-09-19 15:23 [PATCH] PCI: tegra194: Fix broken tegra_pcie_ep_raise_msi_irq() Niklas Cassel
@ 2025-09-20 15:38 ` Manivannan Sadhasivam
0 siblings, 0 replies; 2+ messages in thread
From: Manivannan Sadhasivam @ 2025-09-20 15:38 UTC (permalink / raw)
To: Niklas Cassel
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Thierry Reding, Jonathan Hunter, Vidya Sagar,
Shin'ichiro Kawasaki, linux-pci, linux-tegra
On Fri, Sep 19, 2025 at 05:23:30PM +0200, Niklas Cassel wrote:
> The pci_epc_raise_irq() supplies a MSI or MSI-X interrupt number in range
> (1-N), see kdoc for pci_epc_raise_irq().
>
> Thus, for MSI pci_epc_raise_irq() will supply interrupt number 1-32.
>
> Convert the interrupt number to an MSI vector.
>
> With this, the PCI endpoint kselftest test case MSI_TEST passes.
>
> Also, set msi_capable to true, as the driver obviously supports MSI.
> This helps pci_endpoint_test to use the optimal IRQ type when using
> PCITEST_IRQ_TYPE_AUTO.
>
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
This is a bug fix. Hence, it deserves a Fixes tag and stable list should be
CCed for backporting.
- Mani
> ---
> Note to PCI maintainers: this patch is made on top of
> 27fce9e8c6f0 ("PCI: endpoint: Drop superfluous pci_epc_features initialization")
> which is currently queued on branch pci/endpoint.
>
> drivers/pci/controller/dwc/pcie-tegra194.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
> index 0e413857649fd..fe418b9bfbb4b 100644
> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> @@ -1955,10 +1955,10 @@ static int tegra_pcie_ep_raise_intx_irq(struct tegra_pcie_dw *pcie, u16 irq)
>
> static int tegra_pcie_ep_raise_msi_irq(struct tegra_pcie_dw *pcie, u16 irq)
> {
> - if (unlikely(irq > 31))
> + if (unlikely(irq > 32))
> return -EINVAL;
>
> - appl_writel(pcie, BIT(irq), APPL_MSI_CTRL_1);
> + appl_writel(pcie, BIT(irq - 1), APPL_MSI_CTRL_1);
>
> return 0;
> }
> @@ -1998,6 +1998,7 @@ static int tegra_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
>
> static const struct pci_epc_features tegra_pcie_epc_features = {
> .linkup_notifier = true,
> + .msi_capable = true,
> .bar[BAR_0] = { .type = BAR_FIXED, .fixed_size = SZ_1M,
> .only_64bit = true, },
> .bar[BAR_1] = { .type = BAR_RESERVED, },
> --
> 2.51.0
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-20 15:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-19 15:23 [PATCH] PCI: tegra194: Fix broken tegra_pcie_ep_raise_msi_irq() Niklas Cassel
2025-09-20 15:38 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox