Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3788928iob; Tue, 17 May 2022 07:16:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEA14LNEopdKTuprZKZVXZgXvZ4NjbDfJZLD08ufGrJXEK9eE8GVUw5fO+S5/DlsTUktTG X-Received: by 2002:a65:578b:0:b0:3c6:12b2:f4c with SMTP id b11-20020a65578b000000b003c612b20f4cmr19709861pgr.244.1652797019257; Tue, 17 May 2022 07:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652797019; cv=none; d=google.com; s=arc-20160816; b=cRRGVivJTQPG3mdLMKxuwRF4Z2HkA0OnSmBpypzyy6Bjh2jBWfMS3SWMLIG7dXVZhH z6s/FXQryr7iJodFb47TguxFYbaoVBNqKs0GiLJjVX9kOaDW1/9hKWYttmz17+Mq8HGk vmrT0uwckI4Jse6nQlRHK1WsLG/evf1SMvQII4bsDeA2AMTj63r6IU3nr7QmeEYuldLK qTuCgcjQUShBRCf76Qj8l1XS1C7eU6z0byr51tAYfAP7DdlZoIYNNH46CsfxvCLhX3/P lD7pEWXtayQ+/CxVBOq2KyVnPJ3ylCaT3z2gYsqhitP7JQqxtVJZ0nmaa7tasBZhj5AS kq6g== 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=7p0dGKuqEbRbw64q/uX8k4TvVX18WXNffIzyoespWLo=; b=PaX0CNvr11yvVzIymsprl6ZjbtSIWiBHUnfto5I0JhlHJ5Caz7CnPLgXzlGRz6Y3Pt /xn8lhOqv8rjVeo72PnGBFCQvw19pG3SWihU0ZmGWoLJSsc8fg95PDSFUgGnuKLcK/tI TrNeI4xrWswM1G0jGPFfVBIJ87Ie/2uBuunykVx9VoYdtZv6qs5IDF9hxl41TEV403mh fu3uqoB0v8yf6emgGQpPeD+h+RV2WNrayDlJOuElVaFP1N0JVJqB3jCiEP7TK/jUYmtv aO4X2MbX66jocOaiNne4VXwCAWX+U2xO3pyyf98K4WLcYamK7jHdeIDpO1UMCBXWzEcM uKfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=ZBv1sodi; 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 b3-20020a170902650300b0015cf060b23bsi15462802plk.583.2022.05.17.07.16.46; Tue, 17 May 2022 07:16:59 -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=ZBv1sodi; 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 S235943AbiEQKn1 (ORCPT + 99 others); Tue, 17 May 2022 06:43:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbiEQKnS (ORCPT ); Tue, 17 May 2022 06:43:18 -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 0F09429CAD; Tue, 17 May 2022 03:43:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1652784195; x=1684320195; h=from:to:cc:subject:date:message-id:mime-version; bh=7p0dGKuqEbRbw64q/uX8k4TvVX18WXNffIzyoespWLo=; b=ZBv1sodi6Dkxi95/dTxAJWQiZopCesSk76THFzKgy4kEkhIj2NGtvR3P 2EEruRHt67a42rZTaTkUVBJNNnh4Tuz02lgfR1lQr0hFRdVpWhQoj9T1u IKItkcMezx/Bxhl33nSsiTsCc9jbRn/MOMmxnFiZXcj80V+0DK6AAqlMG g=; Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-02.qualcomm.com with ESMTP; 17 May 2022 03:43:15 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 03:43:15 -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, 17 May 2022 03:43:15 -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, 17 May 2022 03:43:11 -0700 From: Sibi Sankar To: , , CC: , , , Prasad Sodagudi , Sibi Sankar Subject: [PATCH v3] mailbox: qcom-ipcc: Log the pending interrupt during resume Date: Tue, 17 May 2022 16:13:00 +0530 Message-ID: <1652784180-10142-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 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 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 Signed-off-by: Prasad Sodagudi Signed-off-by: Sibi Sankar --- 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