* [PATCH stable 5.15.y] PCI: dwc: Restore MSI Receiver mask during resume
@ 2024-08-03 11:28 Jisheng Zhang
2024-08-13 10:46 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Jisheng Zhang @ 2024-08-03 11:28 UTC (permalink / raw)
To: stable, Jingoo Han, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas,
Greg Kroah-Hartman
Cc: linux-pci, Richard Zhu, Lorenzo Pieralisi
commit 815953dc2011ad7a34de355dfa703dcef1085219 upstream
If a host that uses the IP's integrated MSI Receiver lost power
during suspend, we call dw_pcie_setup_rc() to reinit the RC. But
dw_pcie_setup_rc() always sets pp->irq_mask[ctrl] to ~0, so the mask
register is always set as 0xffffffff incorrectly, thus the MSI can't
work after resume.
Fix this issue by moving pp->irq_mask[ctrl] initialization to
dw_pcie_host_init() so we can correctly set the mask reg during both
boot and resume.
Tested-by: Richard Zhu <hongxing.zhu@nxp.com>
Link: https://lore.kernel.org/r/20211226074019.2556-1-jszhang@kernel.org
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index f561e87cd5f6..962e700f90f5 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -352,6 +352,12 @@ int dw_pcie_host_init(struct pcie_port *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) {
pp->msi_irq = platform_get_irq_byname_optional(pdev, "msi");
if (pp->msi_irq < 0) {
@@ -550,7 +556,6 @@ void dw_pcie_setup_rc(struct pcie_port *pp)
/* Initialize IRQ Status array */
for (ctrl = 0; ctrl < num_ctrls; ctrl++) {
- pp->irq_mask[ctrl] = ~0;
dw_pcie_writel_dbi(pci, PCIE_MSI_INTR0_MASK +
(ctrl * MSI_REG_CTRL_BLOCK_SIZE),
pp->irq_mask[ctrl]);
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH stable 5.15.y] PCI: dwc: Restore MSI Receiver mask during resume
2024-08-03 11:28 [PATCH stable 5.15.y] PCI: dwc: Restore MSI Receiver mask during resume Jisheng Zhang
@ 2024-08-13 10:46 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2024-08-13 10:46 UTC (permalink / raw)
To: Jisheng Zhang
Cc: stable, Jingoo Han, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, linux-pci,
Richard Zhu, Lorenzo Pieralisi
On Sat, Aug 03, 2024 at 07:28:52PM +0800, Jisheng Zhang wrote:
> commit 815953dc2011ad7a34de355dfa703dcef1085219 upstream
>
> If a host that uses the IP's integrated MSI Receiver lost power
> during suspend, we call dw_pcie_setup_rc() to reinit the RC. But
> dw_pcie_setup_rc() always sets pp->irq_mask[ctrl] to ~0, so the mask
> register is always set as 0xffffffff incorrectly, thus the MSI can't
> work after resume.
>
> Fix this issue by moving pp->irq_mask[ctrl] initialization to
> dw_pcie_host_init() so we can correctly set the mask reg during both
> boot and resume.
>
> Tested-by: Richard Zhu <hongxing.zhu@nxp.com>
> Link: https://lore.kernel.org/r/20211226074019.2556-1-jszhang@kernel.org
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-13 10:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-03 11:28 [PATCH stable 5.15.y] PCI: dwc: Restore MSI Receiver mask during resume Jisheng Zhang
2024-08-13 10:46 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox