* [PATCH] PCI: qcom: Mask PARF_INT_ALL_3 events on Nord
@ 2026-11-14 8:47 Shawn Guo
2026-11-17 13:11 ` Manivannan Sadhasivam
0 siblings, 1 reply; 3+ messages in thread
From: Shawn Guo @ 2026-11-14 8:47 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Rob Herring, linux-pci, linux-arm-msm,
linux-kernel, Shawn Guo
On Nord, the PARF_INT_ALL_3 interrupt group is unmasked out of reset
(PARF_INT_ALL_3_MASK reads 0x43fff), and its events are routed to the
same 'global' IRQ as PARF_INT_ALL. The driver neither handles nor clears
any of them, and the global IRQ handler only looks at
PARF_INT_ALL_STATUS.
Some endpoints send a Device Readiness Status (DRS) message after link
up, e.g. the SK hynix HFS001TFM9X186N NVMe drive (1c5c:1069). This
latches DRS_MSG_RECEIVED (bit 12) in PARF_INT_ALL_3_STATUS and keeps
the level triggered global IRQ asserted. The threaded handler then runs
in a tight loop with PARF_INT_ALL_STATUS reading 0, starving other work
and stalling the boot (RCU/SRCU stall warnings).
Mask all PARF_INT_ALL_3 events and clear any latched status on Nord,
before the global IRQ is requested in probe and again in
qcom_pcie_reset_root_port(), since the register is reset together with
PARF_INT_ALL_MASK. To keep the two writes together, move the
PARF_INT_ALL_MASK programming in probe into the same helper, which now
runs right before devm_request_threaded_irq() instead of after it.
Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
---
drivers/pci/controller/dwc/pcie-qcom.c | 30 +++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index eba1b2cb30f0..03b2e61fc20f 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -73,6 +73,8 @@
#define PARF_DEVICE_TYPE 0x1000
#define PARF_BDF_TO_SID_TABLE_N 0x2000
#define PARF_BDF_TO_SID_CFG 0x2c00
+#define PARF_INT_ALL_3_MASK 0x2d8c
+#define PARF_INT_ALL_3_CLEAR 0x2d90
/*
* Outbound blocker range registers. The blocked range has a write pair
@@ -294,6 +296,8 @@ struct qcom_pcie_ops {
* @override_no_snoop: Override NO_SNOOP attribute in TLP to enable cache
* snooping
* @firmware_managed: Set if the Root Complex is firmware managed
+ * @mask_int_all_3: Mask PARF_INT_ALL_3 events, which are unmasked by default
+ * and would otherwise keep the 'global' IRQ asserted
*/
struct qcom_pcie_cfg {
const struct qcom_pcie_ops *ops;
@@ -301,6 +305,7 @@ struct qcom_pcie_cfg {
bool firmware_managed;
bool no_l0s;
bool disable_cgc;
+ bool mask_int_all_3;
};
struct qcom_pcie_perst {
@@ -1738,6 +1743,7 @@ static const struct qcom_pcie_cfg cfg_nord = {
.override_no_snoop = true,
.no_l0s = true,
.disable_cgc = true,
+ .mask_int_all_3 = true,
};
static const struct qcom_pcie_cfg cfg_sc8280xp = {
@@ -1871,6 +1877,22 @@ static int qcom_pcie_set_max_opp(struct device *dev)
return ret;
}
+static void qcom_pcie_enable_global_irq_events(struct qcom_pcie *pcie)
+{
+ /*
+ * The PARF_INT_ALL_3 events (e.g. DRS_MSG_RECEIVED) are unmasked by
+ * default, but not handled by the driver. Once latched, they keep the
+ * level triggered 'global' IRQ asserted, so mask and clear them.
+ */
+ if (pcie->cfg->mask_int_all_3) {
+ writel_relaxed(0, pcie->parf + PARF_INT_ALL_3_MASK);
+ writel_relaxed(~0U, pcie->parf + PARF_INT_ALL_3_CLEAR);
+ }
+
+ writel_relaxed(PARF_INT_ALL_LINK_DOWN | PARF_INT_MSI_DEV_0_7,
+ pcie->parf + PARF_INT_ALL_MASK);
+}
+
/*
* Qcom PCIe controllers only support one Root Port per controller instance. So
* this function ignores the 'pci_dev' associated with the Root Port and just
@@ -1928,8 +1950,7 @@ static int qcom_pcie_reset_root_port(struct pci_host_bridge *bridge,
* non-sticky.
*/
if (pcie->global_irq)
- writel_relaxed(PARF_INT_ALL_LINK_DOWN | PARF_INT_MSI_DEV_0_7,
- pcie->parf + PARF_INT_ALL_MASK);
+ qcom_pcie_enable_global_irq_events(pcie);
qcom_pcie_start_link(pci);
@@ -2429,6 +2450,8 @@ static int qcom_pcie_probe(struct platform_device *pdev)
goto err_host_deinit;
}
+ qcom_pcie_enable_global_irq_events(pcie);
+
ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
qcom_pcie_global_irq_thread,
IRQF_ONESHOT, name, pcie);
@@ -2438,9 +2461,6 @@ static int qcom_pcie_probe(struct platform_device *pdev)
goto err_host_deinit;
}
- writel_relaxed(PARF_INT_ALL_LINK_DOWN | PARF_INT_MSI_DEV_0_7,
- pcie->parf + PARF_INT_ALL_MASK);
-
pcie->global_irq = irq;
}
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: qcom: Mask PARF_INT_ALL_3 events on Nord
2026-11-14 8:47 [PATCH] PCI: qcom: Mask PARF_INT_ALL_3 events on Nord Shawn Guo
@ 2026-11-17 13:11 ` Manivannan Sadhasivam
2026-11-24 13:46 ` Shawn Guo
0 siblings, 1 reply; 3+ messages in thread
From: Manivannan Sadhasivam @ 2026-11-17 13:11 UTC (permalink / raw)
To: Shawn Guo
Cc: Bjorn Helgaas, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Rob Herring, linux-pci, linux-arm-msm,
linux-kernel
On 2026-11-14 16:47 +0800, Shawn Guo wrote:
> On Nord, the PARF_INT_ALL_3 interrupt group is unmasked out of reset
> (PARF_INT_ALL_3_MASK reads 0x43fff), and its events are routed to the
> same 'global' IRQ as PARF_INT_ALL. The driver neither handles nor clears
> any of them, and the global IRQ handler only looks at
> PARF_INT_ALL_STATUS.
>
> Some endpoints send a Device Readiness Status (DRS) message after link
> up, e.g. the SK hynix HFS001TFM9X186N NVMe drive (1c5c:1069). This
> latches DRS_MSG_RECEIVED (bit 12) in PARF_INT_ALL_3_STATUS and keeps
> the level triggered global IRQ asserted. The threaded handler then runs
> in a tight loop with PARF_INT_ALL_STATUS reading 0, starving other work
> and stalling the boot (RCU/SRCU stall warnings).
>
> Mask all PARF_INT_ALL_3 events and clear any latched status on Nord,
> before the global IRQ is requested in probe and again in
> qcom_pcie_reset_root_port(), since the register is reset together with
> PARF_INT_ALL_MASK. To keep the two writes together, move the
> PARF_INT_ALL_MASK programming in probe into the same helper, which now
> runs right before devm_request_threaded_irq() instead of after it.
>
> Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
Missing Fixes tag.
> ---
> drivers/pci/controller/dwc/pcie-qcom.c | 30 +++++++++++++++++++++-----
> 1 file changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index eba1b2cb30f0..03b2e61fc20f 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -73,6 +73,8 @@
> #define PARF_DEVICE_TYPE 0x1000
> #define PARF_BDF_TO_SID_TABLE_N 0x2000
> #define PARF_BDF_TO_SID_CFG 0x2c00
> +#define PARF_INT_ALL_3_MASK 0x2d8c
> +#define PARF_INT_ALL_3_CLEAR 0x2d90
>
> /*
> * Outbound blocker range registers. The blocked range has a write pair
> @@ -294,6 +296,8 @@ struct qcom_pcie_ops {
> * @override_no_snoop: Override NO_SNOOP attribute in TLP to enable cache
> * snooping
> * @firmware_managed: Set if the Root Complex is firmware managed
> + * @mask_int_all_3: Mask PARF_INT_ALL_3 events, which are unmasked by default
> + * and would otherwise keep the 'global' IRQ asserted
Reword the last line to 'and are not handled by the driver'.
> */
> struct qcom_pcie_cfg {
> const struct qcom_pcie_ops *ops;
> @@ -301,6 +305,7 @@ struct qcom_pcie_cfg {
> bool firmware_managed;
> bool no_l0s;
> bool disable_cgc;
> + bool mask_int_all_3;
> };
>
> struct qcom_pcie_perst {
> @@ -1738,6 +1743,7 @@ static const struct qcom_pcie_cfg cfg_nord = {
> .override_no_snoop = true,
> .no_l0s = true,
> .disable_cgc = true,
> + .mask_int_all_3 = true,
> };
>
> static const struct qcom_pcie_cfg cfg_sc8280xp = {
> @@ -1871,6 +1877,22 @@ static int qcom_pcie_set_max_opp(struct device *dev)
> return ret;
> }
>
> +static void qcom_pcie_enable_global_irq_events(struct qcom_pcie *pcie)
> +{
> + /*
> + * The PARF_INT_ALL_3 events (e.g. DRS_MSG_RECEIVED) are unmasked by
> + * default, but not handled by the driver. Once latched, they keep the
> + * level triggered 'global' IRQ asserted, so mask and clear them.
> + */
This comment can be dropped.
> + if (pcie->cfg->mask_int_all_3) {
> + writel_relaxed(0, pcie->parf + PARF_INT_ALL_3_MASK);
> + writel_relaxed(~0U, pcie->parf + PARF_INT_ALL_3_CLEAR);
> + }
> +
> + writel_relaxed(PARF_INT_ALL_LINK_DOWN | PARF_INT_MSI_DEV_0_7,
> + pcie->parf + PARF_INT_ALL_MASK);
> +}
> +
> /*
> * Qcom PCIe controllers only support one Root Port per controller instance. So
> * this function ignores the 'pci_dev' associated with the Root Port and just
> @@ -1928,8 +1950,7 @@ static int qcom_pcie_reset_root_port(struct pci_host_bridge *bridge,
> * non-sticky.
> */
> if (pcie->global_irq)
> - writel_relaxed(PARF_INT_ALL_LINK_DOWN | PARF_INT_MSI_DEV_0_7,
> - pcie->parf + PARF_INT_ALL_MASK);
> + qcom_pcie_enable_global_irq_events(pcie);
>
> qcom_pcie_start_link(pci);
>
> @@ -2429,6 +2450,8 @@ static int qcom_pcie_probe(struct platform_device *pdev)
> goto err_host_deinit;
> }
>
> + qcom_pcie_enable_global_irq_events(pcie);
You should not enable interrupts before registering handler. So you'd have to
mask and clear here and keep the enable where it was. This means, you don't need
a helper at all.
- Mani
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: qcom: Mask PARF_INT_ALL_3 events on Nord
2026-11-17 13:11 ` Manivannan Sadhasivam
@ 2026-11-24 13:46 ` Shawn Guo
0 siblings, 0 replies; 3+ messages in thread
From: Shawn Guo @ 2026-11-24 13:46 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Bjorn Helgaas, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Rob Herring, linux-pci, linux-arm-msm,
linux-kernel
On Tue, Nov 17, 2026 at 02:11:40PM +0100, Manivannan Sadhasivam wrote:
> On 2026-11-14 16:47 +0800, Shawn Guo wrote:
> > On Nord, the PARF_INT_ALL_3 interrupt group is unmasked out of reset
> > (PARF_INT_ALL_3_MASK reads 0x43fff), and its events are routed to the
> > same 'global' IRQ as PARF_INT_ALL. The driver neither handles nor clears
> > any of them, and the global IRQ handler only looks at
> > PARF_INT_ALL_STATUS.
> >
> > Some endpoints send a Device Readiness Status (DRS) message after link
> > up, e.g. the SK hynix HFS001TFM9X186N NVMe drive (1c5c:1069). This
> > latches DRS_MSG_RECEIVED (bit 12) in PARF_INT_ALL_3_STATUS and keeps
> > the level triggered global IRQ asserted. The threaded handler then runs
> > in a tight loop with PARF_INT_ALL_STATUS reading 0, starving other work
> > and stalling the boot (RCU/SRCU stall warnings).
> >
> > Mask all PARF_INT_ALL_3 events and clear any latched status on Nord,
> > before the global IRQ is requested in probe and again in
> > qcom_pcie_reset_root_port(), since the register is reset together with
> > PARF_INT_ALL_MASK. To keep the two writes together, move the
> > PARF_INT_ALL_MASK programming in probe into the same helper, which now
> > runs right before devm_request_threaded_irq() instead of after it.
> >
> > Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
>
> Missing Fixes tag.
Will add:
Fixes: f75d2d64fff1 ("PCI: qcom: Add Nord PCIe controller support")
>
> > ---
> > drivers/pci/controller/dwc/pcie-qcom.c | 30 +++++++++++++++++++++-----
> > 1 file changed, 25 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> > index eba1b2cb30f0..03b2e61fc20f 100644
> > --- a/drivers/pci/controller/dwc/pcie-qcom.c
> > +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> > @@ -73,6 +73,8 @@
> > #define PARF_DEVICE_TYPE 0x1000
> > #define PARF_BDF_TO_SID_TABLE_N 0x2000
> > #define PARF_BDF_TO_SID_CFG 0x2c00
> > +#define PARF_INT_ALL_3_MASK 0x2d8c
> > +#define PARF_INT_ALL_3_CLEAR 0x2d90
> >
> > /*
> > * Outbound blocker range registers. The blocked range has a write pair
> > @@ -294,6 +296,8 @@ struct qcom_pcie_ops {
> > * @override_no_snoop: Override NO_SNOOP attribute in TLP to enable cache
> > * snooping
> > * @firmware_managed: Set if the Root Complex is firmware managed
> > + * @mask_int_all_3: Mask PARF_INT_ALL_3 events, which are unmasked by default
> > + * and would otherwise keep the 'global' IRQ asserted
>
> Reword the last line to 'and are not handled by the driver'.
Ack.
>
> > */
> > struct qcom_pcie_cfg {
> > const struct qcom_pcie_ops *ops;
> > @@ -301,6 +305,7 @@ struct qcom_pcie_cfg {
> > bool firmware_managed;
> > bool no_l0s;
> > bool disable_cgc;
> > + bool mask_int_all_3;
> > };
> >
> > struct qcom_pcie_perst {
> > @@ -1738,6 +1743,7 @@ static const struct qcom_pcie_cfg cfg_nord = {
> > .override_no_snoop = true,
> > .no_l0s = true,
> > .disable_cgc = true,
> > + .mask_int_all_3 = true,
> > };
> >
> > static const struct qcom_pcie_cfg cfg_sc8280xp = {
> > @@ -1871,6 +1877,22 @@ static int qcom_pcie_set_max_opp(struct device *dev)
> > return ret;
> > }
> >
> > +static void qcom_pcie_enable_global_irq_events(struct qcom_pcie *pcie)
> > +{
> > + /*
> > + * The PARF_INT_ALL_3 events (e.g. DRS_MSG_RECEIVED) are unmasked by
> > + * default, but not handled by the driver. Once latched, they keep the
> > + * level triggered 'global' IRQ asserted, so mask and clear them.
> > + */
>
> This comment can be dropped.
>
> > + if (pcie->cfg->mask_int_all_3) {
> > + writel_relaxed(0, pcie->parf + PARF_INT_ALL_3_MASK);
> > + writel_relaxed(~0U, pcie->parf + PARF_INT_ALL_3_CLEAR);
> > + }
> > +
> > + writel_relaxed(PARF_INT_ALL_LINK_DOWN | PARF_INT_MSI_DEV_0_7,
> > + pcie->parf + PARF_INT_ALL_MASK);
> > +}
> > +
> > /*
> > * Qcom PCIe controllers only support one Root Port per controller instance. So
> > * this function ignores the 'pci_dev' associated with the Root Port and just
> > @@ -1928,8 +1950,7 @@ static int qcom_pcie_reset_root_port(struct pci_host_bridge *bridge,
> > * non-sticky.
> > */
> > if (pcie->global_irq)
> > - writel_relaxed(PARF_INT_ALL_LINK_DOWN | PARF_INT_MSI_DEV_0_7,
> > - pcie->parf + PARF_INT_ALL_MASK);
> > + qcom_pcie_enable_global_irq_events(pcie);
> >
> > qcom_pcie_start_link(pci);
> >
> > @@ -2429,6 +2450,8 @@ static int qcom_pcie_probe(struct platform_device *pdev)
> > goto err_host_deinit;
> > }
> >
> > + qcom_pcie_enable_global_irq_events(pcie);
>
> You should not enable interrupts before registering handler. So you'd have to
> mask and clear here and keep the enable where it was. This means, you don't need
> a helper at all.
Right, unmasking PARF_INT_ALL_MASK before devm_request_threaded_irq() is
wrong. Will drop the helper and leave both PARF_INT_ALL_MASK writes as
they are today.
Before I send v2, I'd like to check where the PARF_INT_ALL_3 masking
should go. Masking only in probe and qcom_pcie_reset_root_port() misses
system resume. When the controller is powered down in suspend,
qcom_pcie_resume_noirq() goes through dw_pcie_resume_noirq() ->
qcom_pcie_host_init(), which resets the core just as
qcom_pcie_reset_root_port() does. I checked this on Nord RRD:
PARF_INT_ALL_3_MASK reads 0 after probe, and reads 0x43fff (the reset
value) after an s2idle cycle in which the link went through L2 and was
re-trained. A DRS message after that would wedge the global IRQ again.
So I'd rather mask and clear PARF_INT_ALL_3 in qcom_pcie_host_init(),
right after ops->post_init():
if (pcie->cfg->mask_int_all_3) {
writel_relaxed(0, pcie->parf + PARF_INT_ALL_3_MASK);
writel_relaxed(~0U, pcie->parf + PARF_INT_ALL_3_CLEAR);
}
That one place covers probe (dw_pcie_host_init() runs before the global
IRQ is requested), qcom_pcie_reset_root_port() and resume. It also runs
before PERST# deassert, so the mask is in place before the endpoint can
send DRS, and no helper is needed.
Does that work for you?
Shawn
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-24 13:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-14 8:47 [PATCH] PCI: qcom: Mask PARF_INT_ALL_3 events on Nord Shawn Guo
2026-11-17 13:11 ` Manivannan Sadhasivam
2026-11-24 13:46 ` Shawn Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®