Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6759334iob; Wed, 11 May 2022 04:56:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsfRLYZ+B0Tf9tw24u5xiTr7SfQEKUpRWtYjcmg6oPIPWXXalM4uQCuX6CU8YNsP0tdmmI X-Received: by 2002:a05:6402:e85:b0:41d:121b:f436 with SMTP id h5-20020a0564020e8500b0041d121bf436mr28569561eda.121.1652270162244; Wed, 11 May 2022 04:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652270162; cv=none; d=google.com; s=arc-20160816; b=lHrANK2mYVwi7QBur8FWOmVDAdh743Y8dn9TUhyi0FgglM2mcAQ/SJ6lDGhyR/9aMm r2BRbcoNg4kmOn0onKZDZvATw3ZpnkugtFrm3mcNd6GwV+CROFUlKQqgTlbuxFajxtQ+ d1689j0fuXoAMIxX7Lh2TTXJAe4FXQJOmR8nrH72HWipMfLounRhzq/GZt1uw9f9ATKO 4TjF62LsGRpayji3RcCKqMzfdMO0911JHgBrBWycCJrBn0sKIE+MECCCKHBCtV2uO4u1 1aSJGXyl06SNfqBWHj1XIQT3NaWn4YW3WlJCfz6Ct+Ky6SDY4JZTwx/obHSwoqbtyssx oB7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=PTO+On8Bs9vt5yZvZ1hxSaNlJGopfMF1D5C9kQY7ebs=; b=F8DAWXbxN8t4mImOk/I5/HwxESS9wcmGhrbXpV+XcFsXYGnHOMGrQGA8IGmEaUgw2h OCYM4DWgZcMWRKuyaANZVO4Uhj9ljCuQMp3GP08L85ZerKJi5+9CcQ9sF3kKainZzGdP hAtv845voXjfPgD4MCRrWXqrvfIAsJb0dzuH6+9bt2e61fVbTK5T5iU+jIT/7PlGUtXj bN60S/8ckqgCUkOuk6ukBi+0lZtAQhHE+DOyksw6/RH1YjwA7Og/+ryqaMSUBWVATJ9H XMydtyzpwMAEi+qJg0QdCfh4crbBADBVADa7G/nMSg2n7tq74fQr4Fk8qCG4EzlxThUP j1vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=s1Rq46lV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd12-20020a170907628c00b006f3a2a53c3asi2406378ejc.172.2022.05.11.04.55.36; Wed, 11 May 2022 04:56:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=s1Rq46lV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242229AbiEKGnq (ORCPT + 99 others); Wed, 11 May 2022 02:43:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230070AbiEKGno (ORCPT ); Wed, 11 May 2022 02:43:44 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9F08B1D4; Tue, 10 May 2022 23:43:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1652251423; x=1683787423; h=from:to:cc:subject:date:message-id:mime-version; bh=PTO+On8Bs9vt5yZvZ1hxSaNlJGopfMF1D5C9kQY7ebs=; b=s1Rq46lVeG0L3uCi9uTO0VYBweE9Di51XzSFM2ZbFrGC7gsx3Umtt7yz nGixCQbFIj0bmM0R6cINn3Q5fD8bYK5IR/lrcpeT7jM3Mbo0s2EmSYLFc +3qy0D5w/4wdyySxkh3s0xcoAyvXW8iUszdHS9fjZgpbqxWSsL3Kd1xsH A=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 10 May 2022 23:43:41 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 23:43:41 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 10 May 2022 23:43:41 -0700 Received: from blr-ubuntu-87.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 10 May 2022 23:43:38 -0700 From: Sibi Sankar To: , , CC: , , , Prasad Sodagudi , Sibi Sankar Subject: [PATCH v2] mailbox: qcom-ipcc: Log the pending interrupt during resume Date: Wed, 11 May 2022 12:13:24 +0530 Message-ID: <1652251404-30562-1-git-send-email-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Prasad Sodagudi 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 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 Signed-off-by: Sibi Sankar --- V2: * Fix build error when ipcc is a module [Kernel Test Bot] drivers/mailbox/qcom-ipcc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c index c5d963222014..21c071ec119c 100644 --- a/drivers/mailbox/qcom-ipcc.c +++ b/drivers/mailbox/qcom-ipcc.c @@ -254,6 +254,28 @@ 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); + 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_info(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; +} +#else +#define qcom_ipcc_pm_resume NULL +#endif + static int qcom_ipcc_probe(struct platform_device *pdev) { struct qcom_ipcc *ipcc; @@ -324,6 +346,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 +357,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