Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5812063iob; Tue, 10 May 2022 04:24:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFF+/FtbNkLfjmp3pdb7Dfo7P2iCBbVgDnHHYyltw5mRGVAvZ8qtv8cPaJzib0jxPKyVeq X-Received: by 2002:a63:eb16:0:b0:3c6:77a1:5be with SMTP id t22-20020a63eb16000000b003c677a105bemr12630966pgh.127.1652181840498; Tue, 10 May 2022 04:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652181840; cv=none; d=google.com; s=arc-20160816; b=dYFWnreCg99+oa62PxSOgBMRHZ234rGgiAPrlV3gRLT+Slxwcdr/ufdv2ejaMIm7yu FOd9p8QwwrazZ6hve/91jhwXbdUydcKs9z0PafZsPveDKDM8wBg3Gp1rhTfZy4w0+f8a vxm4NPmIuQ0Dx5B9fuTAfsfDv5y+rgpO4gdGjh+qfaIM8AQs6vgo/MTdgIGqbBvN+tPz F0v7L9sbEZHtH5w+YZP8KgOrsor3/yv9GxKckOzRfTdjvEdlAdGukREBFlqa4+CLFBn2 k7aA360eVIJJqNTiRDIRDGWTUr6haO1DpO71uHDoWfSdcqtnnRzw1aKe3VKtxqCgttV7 Og2Q== 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=66sP44ABH8cW1KMcQ/acjMJ0/jSkvrRxLCtDRKD7gqo=; b=D4ZxmyapO0V7C2O7aZNpC8nZ3y26lFyyOSErH2ulMHA1Ck34LcVKbJ9OPXKX+vDIif V8FeZFRzLXMZGMSSdN7QBeZ84RkjHlCAnQua1nnpuWgEIYFq5OHcQ3uKMvjZoc+EqEEs j9huVU99doA56pvGejl181l4pZvOtQt+Rkw6F017twX+TMBKTJRtw7OeKgYHqzyiRm7R 4zRA9YgXnrl3ePSzsk3zIkZTUL3+h4JNEVj6/PmqfaDVX+6J33dyIds4QS3EwuAD0Xqh Mc3js2s+J71w8fLl5ZNb2erlD2XUpk9vUQIW6f23keEewXYZJBZwtvn16VEiauuo53k+ GRCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=gdoY93ko; 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 mq9-20020a17090b380900b001da35d6c55csi2991923pjb.175.2022.05.10.04.23.45; Tue, 10 May 2022 04:24:00 -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=gdoY93ko; 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 S236955AbiEJHxP (ORCPT + 99 others); Tue, 10 May 2022 03:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237449AbiEJHxG (ORCPT ); Tue, 10 May 2022 03:53:06 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D969A1900E1; Tue, 10 May 2022 00:48:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1652168912; x=1683704912; h=from:to:cc:subject:date:message-id:mime-version; bh=66sP44ABH8cW1KMcQ/acjMJ0/jSkvrRxLCtDRKD7gqo=; b=gdoY93kop7NLTmOqQ/FLMeiDBFyEd2gduQP8+1U/E3vNwX2atDtLGSqm 4RrBEhzHd2rXr+trjabvsElWVwxElm4XVPIQWjkni+u8Fxo8OZG92InA2 xERGaIBZk8hin9qdJpExpWwcmuxzmWccCWxBmbhnQ/xOGEEDJyT6QESGU w=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-01.qualcomm.com with ESMTP; 10 May 2022 00:48:32 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 00:48:32 -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 00:48:31 -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 00:48:28 -0700 From: Sibi Sankar To: , , CC: , , , Prasad Sodagudi , Sibi Sankar Subject: [PATCH] mailbox: qcom-ipcc: Log the pending interrupt during resume Date: Tue, 10 May 2022 13:18:13 +0530 Message-ID: <1652168893-11814-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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 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 Signed-off-by: Sibi Sankar --- 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