All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mailbox: qcom-ipcc: Log the pending interrupt during resume
@ 2022-05-10  7:48 Sibi Sankar
  2022-05-10 16:06 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Sibi Sankar @ 2022-05-10  7:48 UTC (permalink / raw)
  To: bjorn.andersson, mani, jassisinghbrar
  Cc: linux-kernel, linux-arm-msm, agross, Prasad Sodagudi, Sibi Sankar

From: Prasad Sodagudi <quic_psodagud@quicinc.com>

Enable logging of the pending interrupt that triggered device wakeup. This
logging information helps to debug IRQs that cause periodic device wakeups
and prints the detailed information of pending IPCC interrupts instead of
the generic "Resume caused by IRQ 17, ipcc".

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

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

Signed-off-by: Prasad Sodagudi <quic_psodagud@quicinc.com>
Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
---
 drivers/mailbox/qcom-ipcc.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
index c5d963222014..5be3a2809d09 100644
--- a/drivers/mailbox/qcom-ipcc.c
+++ b/drivers/mailbox/qcom-ipcc.c
@@ -254,6 +254,35 @@ static int qcom_ipcc_setup_mbox(struct qcom_ipcc *ipcc,
 	return devm_mbox_controller_register(dev, mbox);
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int qcom_ipcc_pm_resume(struct device *dev)
+{
+	struct qcom_ipcc *ipcc = dev_get_drvdata(dev);
+	const char *name = "null";
+	struct irq_desc *desc;
+	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);
+	desc = irq_to_desc(virq);
+	if (!desc)
+		name = "stray irq";
+	else if (desc->action && desc->action->name)
+		name = desc->action->name;
+
+	dev_info(dev, "virq: %d triggered %s client-id: %ld; signal-id: %ld\n", virq, name,
+		 FIELD_GET(IPCC_CLIENT_ID_MASK, hwirq), FIELD_GET(IPCC_SIGNAL_ID_MASK, hwirq));
+
+	return 0;
+}
+#else
+#define qcom_ipcc_pm_resume NULL
+#endif
+
 static int qcom_ipcc_probe(struct platform_device *pdev)
 {
 	struct qcom_ipcc *ipcc;
@@ -324,6 +353,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 +364,7 @@ static struct platform_driver qcom_ipcc_driver = {
 		.name = "qcom-ipcc",
 		.of_match_table = qcom_ipcc_of_match,
 		.suppress_bind_attrs = true,
+		.pm = &qcom_ipcc_dev_pm_ops,
 	},
 };
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mailbox: qcom-ipcc: Log the pending interrupt during resume
  2022-05-10  7:48 [PATCH] mailbox: qcom-ipcc: Log the pending interrupt during resume Sibi Sankar
@ 2022-05-10 16:06 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-05-10 16:06 UTC (permalink / raw)
  To: Sibi Sankar, bjorn.andersson, mani, jassisinghbrar
  Cc: llvm, kbuild-all, linux-kernel, linux-arm-msm, agross,
	Prasad Sodagudi, Sibi Sankar

Hi Sibi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.18-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Sibi-Sankar/mailbox-qcom-ipcc-Log-the-pending-interrupt-during-resume/20220510-155032
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 9be9ed2612b5aedb52a2c240edb1630b6b743cb6
config: arm-randconfig-r015-20220509 (https://download.01.org/0day-ci/archive/20220510/202205102334.mtvIIqAz-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 18dd123c56754edf62c7042dcf23185c3727610f)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/5389a3f93e441ca9fed19981d15d5e74708aaa4f
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Sibi-Sankar/mailbox-qcom-ipcc-Log-the-pending-interrupt-during-resume/20220510-155032
        git checkout 5389a3f93e441ca9fed19981d15d5e74708aaa4f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "irq_to_desc" [drivers/mailbox/qcom-ipcc.ko] undefined!

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-10 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10  7:48 [PATCH] mailbox: qcom-ipcc: Log the pending interrupt during resume Sibi Sankar
2022-05-10 16:06 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.