2022-05-17 14:16:59

by Sibi Sankar

[permalink] [raw]
Subject: [PATCH v3] mailbox: qcom-ipcc: Log the pending interrupt during resume

From: Prasad Sodagudi <[email protected]>

Enable logging of the pending interrupt that triggered device wakeup. This
logging information helps to debug IRQs that cause periodic device wakeups
by printing the detailed information of pending IPCC interrupts.

Scenario: Device wakeup caused by Modem crash
Logs:
qcom-ipcc mailbox: virq: 182 triggered client-id: 2; signal-id: 2

From the IPCC bindings it can further be understood that the client here is
IPCC_CLIENT_MPSS and the signal was IPCC_MPROC_SIGNAL_SMP2P.

Reviewed-by: Manivannan Sadhasivam <[email protected]>
Signed-off-by: Prasad Sodagudi <[email protected]>
Signed-off-by: Sibi Sankar <[email protected]>
---

V3:
* Use pm_sleep_ptr and convert info to dbg [Mani]
* Fixup commit message

V2:
* Fix build error when ipcc is a module [Kernel Test Bot]

drivers/mailbox/qcom-ipcc.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
index c5d963222014..5a42bc2a1083 100644
--- a/drivers/mailbox/qcom-ipcc.c
+++ b/drivers/mailbox/qcom-ipcc.c
@@ -254,6 +254,24 @@ static int qcom_ipcc_setup_mbox(struct qcom_ipcc *ipcc,
return devm_mbox_controller_register(dev, mbox);
}

+static int qcom_ipcc_pm_resume(struct device *dev)
+{
+ struct qcom_ipcc *ipcc = dev_get_drvdata(dev);
+ u32 hwirq;
+ int virq;
+
+ hwirq = readl(ipcc->base + IPCC_REG_RECV_ID);
+ if (hwirq == IPCC_NO_PENDING_IRQ)
+ return 0;
+
+ virq = irq_find_mapping(ipcc->irq_domain, hwirq);
+
+ dev_dbg(dev, "virq: %d triggered client-id: %ld; signal-id: %ld\n", virq,
+ FIELD_GET(IPCC_CLIENT_ID_MASK, hwirq), FIELD_GET(IPCC_SIGNAL_ID_MASK, hwirq));
+
+ return 0;
+}
+
static int qcom_ipcc_probe(struct platform_device *pdev)
{
struct qcom_ipcc *ipcc;
@@ -324,6 +342,10 @@ static const struct of_device_id qcom_ipcc_of_match[] = {
};
MODULE_DEVICE_TABLE(of, qcom_ipcc_of_match);

+static const struct dev_pm_ops qcom_ipcc_dev_pm_ops = {
+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, qcom_ipcc_pm_resume)
+};
+
static struct platform_driver qcom_ipcc_driver = {
.probe = qcom_ipcc_probe,
.remove = qcom_ipcc_remove,
@@ -331,6 +353,7 @@ static struct platform_driver qcom_ipcc_driver = {
.name = "qcom-ipcc",
.of_match_table = qcom_ipcc_of_match,
.suppress_bind_attrs = true,
+ .pm = pm_sleep_ptr(&qcom_ipcc_dev_pm_ops),
},
};

--
2.7.4



2022-05-25 09:04:44

by Manivannan Sadhasivam

[permalink] [raw]
Subject: Re: [PATCH v3] mailbox: qcom-ipcc: Log the pending interrupt during resume

On Tue, May 24, 2022 at 06:48:25AM -0700, Guenter Roeck wrote:
> On Tue, May 17, 2022 at 04:13:00PM +0530, Sibi Sankar wrote:
> > From: Prasad Sodagudi <[email protected]>
> >
> > Enable logging of the pending interrupt that triggered device wakeup. This
> > logging information helps to debug IRQs that cause periodic device wakeups
> > by printing the detailed information of pending IPCC interrupts.
> >
> > Scenario: Device wakeup caused by Modem crash
> > Logs:
> > qcom-ipcc mailbox: virq: 182 triggered client-id: 2; signal-id: 2
> >
> > >From the IPCC bindings it can further be understood that the client here is
> > IPCC_CLIENT_MPSS and the signal was IPCC_MPROC_SIGNAL_SMP2P.
> >
> > Reviewed-by: Manivannan Sadhasivam <[email protected]>
> > Signed-off-by: Prasad Sodagudi <[email protected]>
> > Signed-off-by: Sibi Sankar <[email protected]>
> > ---
> >
> > V3:
> > * Use pm_sleep_ptr and convert info to dbg [Mani]
>
> Unfortunately, this results in
>
> drivers/mailbox/qcom-ipcc.c:258:12: error: 'qcom_ipcc_pm_resume' defined but not used
>
> on builds with PM disabled, as seen in next-20220524.
>

Yep, I missed it during review :(

But the fix has been submitted:
https://patchwork.kernel.org/project/linux-arm-msm/patch/[email protected]/

Thanks,
Mani

> Guenter
>
> > * Fixup commit message
> >
> > V2:
> > * Fix build error when ipcc is a module [Kernel Test Bot]
> >
> > drivers/mailbox/qcom-ipcc.c | 23 +++++++++++++++++++++++
> > 1 file changed, 23 insertions(+)
> >
> > diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
> > index c5d963222014..5a42bc2a1083 100644
> > --- a/drivers/mailbox/qcom-ipcc.c
> > +++ b/drivers/mailbox/qcom-ipcc.c
> > @@ -254,6 +254,24 @@ static int qcom_ipcc_setup_mbox(struct qcom_ipcc *ipcc,
> > return devm_mbox_controller_register(dev, mbox);
> > }
> >
> > +static int qcom_ipcc_pm_resume(struct device *dev)
> > +{
> > + struct qcom_ipcc *ipcc = dev_get_drvdata(dev);
> > + u32 hwirq;
> > + int virq;
> > +
> > + hwirq = readl(ipcc->base + IPCC_REG_RECV_ID);
> > + if (hwirq == IPCC_NO_PENDING_IRQ)
> > + return 0;
> > +
> > + virq = irq_find_mapping(ipcc->irq_domain, hwirq);
> > +
> > + dev_dbg(dev, "virq: %d triggered client-id: %ld; signal-id: %ld\n", virq,
> > + FIELD_GET(IPCC_CLIENT_ID_MASK, hwirq), FIELD_GET(IPCC_SIGNAL_ID_MASK, hwirq));
> > +
> > + return 0;
> > +}
> > +
> > static int qcom_ipcc_probe(struct platform_device *pdev)
> > {
> > struct qcom_ipcc *ipcc;
> > @@ -324,6 +342,10 @@ static const struct of_device_id qcom_ipcc_of_match[] = {
> > };
> > MODULE_DEVICE_TABLE(of, qcom_ipcc_of_match);
> >
> > +static const struct dev_pm_ops qcom_ipcc_dev_pm_ops = {
> > + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, qcom_ipcc_pm_resume)
> > +};
> > +
> > static struct platform_driver qcom_ipcc_driver = {
> > .probe = qcom_ipcc_probe,
> > .remove = qcom_ipcc_remove,
> > @@ -331,6 +353,7 @@ static struct platform_driver qcom_ipcc_driver = {
> > .name = "qcom-ipcc",
> > .of_match_table = qcom_ipcc_of_match,
> > .suppress_bind_attrs = true,
> > + .pm = pm_sleep_ptr(&qcom_ipcc_dev_pm_ops),
> > },
> > };
> >
> > --
> > 2.7.4
> >

--
மணிவண்ணன் சதாசிவம்

2022-05-25 14:28:32

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v3] mailbox: qcom-ipcc: Log the pending interrupt during resume

On Tue, May 17, 2022 at 04:13:00PM +0530, Sibi Sankar wrote:
> From: Prasad Sodagudi <[email protected]>
>
> Enable logging of the pending interrupt that triggered device wakeup. This
> logging information helps to debug IRQs that cause periodic device wakeups
> by printing the detailed information of pending IPCC interrupts.
>
> Scenario: Device wakeup caused by Modem crash
> Logs:
> qcom-ipcc mailbox: virq: 182 triggered client-id: 2; signal-id: 2
>
> >From the IPCC bindings it can further be understood that the client here is
> IPCC_CLIENT_MPSS and the signal was IPCC_MPROC_SIGNAL_SMP2P.
>
> Reviewed-by: Manivannan Sadhasivam <[email protected]>
> Signed-off-by: Prasad Sodagudi <[email protected]>
> Signed-off-by: Sibi Sankar <[email protected]>
> ---
>
> V3:
> * Use pm_sleep_ptr and convert info to dbg [Mani]

Unfortunately, this results in

drivers/mailbox/qcom-ipcc.c:258:12: error: 'qcom_ipcc_pm_resume' defined but not used

on builds with PM disabled, as seen in next-20220524.

Guenter

> * Fixup commit message
>
> V2:
> * Fix build error when ipcc is a module [Kernel Test Bot]
>
> drivers/mailbox/qcom-ipcc.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
> index c5d963222014..5a42bc2a1083 100644
> --- a/drivers/mailbox/qcom-ipcc.c
> +++ b/drivers/mailbox/qcom-ipcc.c
> @@ -254,6 +254,24 @@ static int qcom_ipcc_setup_mbox(struct qcom_ipcc *ipcc,
> return devm_mbox_controller_register(dev, mbox);
> }
>
> +static int qcom_ipcc_pm_resume(struct device *dev)
> +{
> + struct qcom_ipcc *ipcc = dev_get_drvdata(dev);
> + u32 hwirq;
> + int virq;
> +
> + hwirq = readl(ipcc->base + IPCC_REG_RECV_ID);
> + if (hwirq == IPCC_NO_PENDING_IRQ)
> + return 0;
> +
> + virq = irq_find_mapping(ipcc->irq_domain, hwirq);
> +
> + dev_dbg(dev, "virq: %d triggered client-id: %ld; signal-id: %ld\n", virq,
> + FIELD_GET(IPCC_CLIENT_ID_MASK, hwirq), FIELD_GET(IPCC_SIGNAL_ID_MASK, hwirq));
> +
> + return 0;
> +}
> +
> static int qcom_ipcc_probe(struct platform_device *pdev)
> {
> struct qcom_ipcc *ipcc;
> @@ -324,6 +342,10 @@ static const struct of_device_id qcom_ipcc_of_match[] = {
> };
> MODULE_DEVICE_TABLE(of, qcom_ipcc_of_match);
>
> +static const struct dev_pm_ops qcom_ipcc_dev_pm_ops = {
> + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, qcom_ipcc_pm_resume)
> +};
> +
> static struct platform_driver qcom_ipcc_driver = {
> .probe = qcom_ipcc_probe,
> .remove = qcom_ipcc_remove,
> @@ -331,6 +353,7 @@ static struct platform_driver qcom_ipcc_driver = {
> .name = "qcom-ipcc",
> .of_match_table = qcom_ipcc_of_match,
> .suppress_bind_attrs = true,
> + .pm = pm_sleep_ptr(&qcom_ipcc_dev_pm_ops),
> },
> };
>
> --
> 2.7.4
>