Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp52343lqs; Thu, 13 Jun 2024 03:42:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWE4DQlplXyxtpY6wkWGM6fjDOf+1+6UCTQ+Fu4NCNCuYi6M5JRmz6aq9dOShPEL75VdZhQV96bODj5R5LVNuJR/P8J+U85XxTzPhg1nQ== X-Google-Smtp-Source: AGHT+IEVgYOj1qUBxosmW+rlh/GHIuTSxICYGznvBMuBClR2isWKjzAq8sbdOgF5VXj9fgy7ZjHo X-Received: by 2002:a05:6a20:734a:b0:1b8:4216:14a2 with SMTP id adf61e73a8af0-1b8a9c67829mr4907091637.40.1718275324493; Thu, 13 Jun 2024 03:42:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718275324; cv=pass; d=google.com; s=arc-20160816; b=eFW1zpWFh7YiH1J8tBzvHBy30IQVSSADJVCvMFE9EGb6o7QcB+SZWRnJTh3fzIgG2m 0ffCPXQpUH+RRUUR2Ph0J+B2zMTL9ST7m4FR8dlgE9F95fKvBPre24hbhFe4hmu5kPfM inyEIrU/Kk2yE9RdtE6AjZSSkGo+KhIYEHdehfnCqBae7ItGW2JgI0MuuxqrytZi97wU n+oNimqwouRGa1leKGJbP9WPdoZo0Mx3JwZHER8qrV/rHxpCdtrBNn5NRr5xuNT1MLft /SXfEWcHTZTq5vwhKr+NWWWxNAiqcR6RLsQwqJUkA5Qs4DtXbvq4K0ZB2S8PrGQ07lwW fZKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=5XFOYjzhzVrVvkzd1b9OyHEmzOD4uZ1J77WF+qZAOHY=; fh=FVzlaAi7BkNiqA7W4pi67bXSCwctmkTT9S7X80Y6Fhs=; b=FsaJ39pa0Expo7UiO/NKybnwanv6U1Vyh7joojtykl8qSVM5mbQM6SyGqMY0CPEoNT tLGhYBeIhmJoTkeBmR0oe3viF5+vuWg1HuC9EOA3+a0QmC3lE3h0Fpkcjx94zP9IcjzJ hnQTr83J5xVWK9ZlGKJOK/ulAbykSyGPNBKftvC+L1aECyfyKXHim8nVwL6bOTpBBQjQ nGu5II6qklwRNBnnaEBVwbcHuf5+WMLenoAcelNDJQb47ip3NINqRX6+r045v9M9uZPo JO0aqeA/RgApnarqPPX3KWKnciHDubDmhF6MVMXFXn8XvTe0FcYPoxqG/kewV7RkmYsp e35g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=PRwBQ+Z7; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-213031-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213031-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f855ed4433si10541475ad.307.2024.06.13.03.42.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 03:42:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213031-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=PRwBQ+Z7; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-213031-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213031-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1794EB232C8 for ; Thu, 13 Jun 2024 10:35:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56A9514262B; Thu, 13 Jun 2024 10:35:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="PRwBQ+Z7" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAA5213D60A; Thu, 13 Jun 2024 10:35:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718274936; cv=none; b=p7dIKjrAMHOIsSxmElP6nV/Gq0lfknuUAkgARvGmSryTsKDsPtzk4WMoHYpvn8HgbetHSqaTHrNx2S5b5Cx5s4F6JdSIH7tWYxAEjOIGz2N5FQTJqev0Lqaxr9yVdpxEYNYddg3YIMDvxGdmuslSgxo09IOQDeUpzDMNpkT3/O0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718274936; c=relaxed/simple; bh=C+qf5rjgWLdEaQaJSm45myQqiK85mNlatx2p23x3Pu4=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=nxtdDLrR0b7jSn1oJI+WkcseWioL5CdBuT8YAKPa9kdp5NqCQb+FN2fE//YqQqs7LU7EzALKEoZCVnULG0FybzX/J+ffEvAGXbTt6DegVLoIRbNzmMxSrNrDYeYLafcrpbYbya07C3fR3+kqKAmcHzY+GYxJk0boiRWoLjfg9Hk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=PRwBQ+Z7; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45D8ckTZ023709; Thu, 13 Jun 2024 10:35:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 5XFOYjzhzVrVvkzd1b9OyHEmzOD4uZ1J77WF+qZAOHY=; b=PRwBQ+Z7R/ZUfuDX 1PWE7jO/VnAOVWugM2C1QfZbwZ9/79JK/k/bz/RceJEh+vdUcH56UF58bJuwJOoe edYMeRXtswRG8F5yg1gqUFUZ52g9pHyyqyYPR+7EKmVnDiuQH7Q57FOqxfpYbi0u kNp/qY7RT+BVTgniKbBH18gQbPg6w7hLCBBYGghB4t0QWtZhRNlkaNgVqazqtMSZ ABOndztMhiaoWRoJMw46egmuBwdovPPZ7qMzMr9/EPBs8C8dgMoxLZux1Mex2Rnx Mu7Ms7W2XNFV/8Org5J/ZpgaTB2A5cpU8rpSiEzV0sGUW75Au5kZP6SHO9Lq3Eps XNFv4Q== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yqcxtjr3u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 10:35:31 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45DAZUUv003871 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 10:35:30 GMT Received: from [10.217.239.82] (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.1544.9; Thu, 13 Jun 2024 03:35:27 -0700 Message-ID: <275417c5-223a-436b-8405-ba3571e19ced@quicinc.com> Date: Thu, 13 Jun 2024 16:05:17 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V1] rpmsg: glink: Make glink smem interrupt wakeup capable To: Caleb Connolly , , , , CC: , , , References: <20240603073648.3475123-1-quic_deesin@quicinc.com> <8d10fbbb-471e-4960-a52a-1658df9fbc0c@linaro.org> Content-Language: en-US From: Deepak Kumar Singh In-Reply-To: <8d10fbbb-471e-4960-a52a-1658df9fbc0c@linaro.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: RY5pgN22D8oJsnP-hz6NAxSB9YZ415N8 X-Proofpoint-GUID: RY5pgN22D8oJsnP-hz6NAxSB9YZ415N8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_02,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 phishscore=0 suspectscore=0 malwarescore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130076 On 6/3/2024 3:07 PM, Caleb Connolly wrote: > Hi Deepak, > > On 03/06/2024 09:36, Deepak Kumar Singh wrote: >> There are certain usecases which require glink interrupt to be >> wakeup capable. For example if handset is in sleep state and >> usb charger is plugged in, dsp wakes up and sends glink interrupt >> to host for glink pmic channel communication. Glink is suppose to >> wakeup host processor completely for further glink data handling. >> IRQF_NO_SUSPEND does not gurantee complete wakeup, system may again >> enter sleep after interrupt handling and glink data may not be >> handled by pmic client driver. >> >> To ensure data handling by client configure glink smem device as >> wakeup source and attach glink interrupt as wakeup irq. Remove >> IRQF_NO_SUSPEND flag as it is no longer required. > > I'm not sure I agree with this approach, glink is used for lots of > things -- like QRTR, where the sensor DSP and modem may also need to > wake the system up (e.g. for "wake on pickup" on mobile, or for incoming > calls/sms). > > Configuring this to always wake up the system fully will result in a lot > of spurious wakeups for arbitrary modem notifications (e.g. signal > strength changes) if userspace hasn't properly configured these > (something ModemManager currently lacks support for). In internal testing at least we don't see such issues, may be downstream modem manager is configuring things properly. Also with devices having proper auto suspend feature this change may not be affecting power numbers significantly. Additionally my understanding is by definition glink interrupt should be wakeup capable. May be Bjorn can comment more on this. Thanks, Deepak > > IRQF_NO_SUSPEND is presumably necessary to keep the DSPs happy? iirc > downstream Qualcomm kernels have historically taken this approach to > avoid spurious wakeups. > > I proposed an alternative approach some time back that would allow the > wakeup to be configured on a per-channel basis. > > https://lore.kernel.org/linux-arm-msm/20230117142414.983946-1-caleb.connolly@linaro.org/ > > Back then Bjorn proposed using some socket specific mechanism to handle > this for QRTR, but given this is now a common issue for multiple glink > channels, maybe it's something we could revisit. > > Requiring the wakeup be enabled by userspace clearly doesn't make sense > for your proposed usecase, perhaps there's a way to configure this on a > per-channel basis in-kernel (maybe as the rpmsg API?). > > Thanks and regards, >> >> Signed-off-by: Deepak Kumar Singh >> --- >>   drivers/rpmsg/qcom_glink_smem.c | 8 ++++++-- >>   1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/rpmsg/qcom_glink_smem.c >> b/drivers/rpmsg/qcom_glink_smem.c >> index 7a982c60a8dd..f1b553efab13 100644 >> --- a/drivers/rpmsg/qcom_glink_smem.c >> +++ b/drivers/rpmsg/qcom_glink_smem.c >> @@ -22,6 +22,7 @@ >>   #include >>   #include >>   #include >> +#include >>   #include >> @@ -306,8 +307,7 @@ struct qcom_glink_smem >> *qcom_glink_smem_register(struct device *parent, >>       smem->irq = of_irq_get(smem->dev.of_node, 0); >>       ret = devm_request_irq(&smem->dev, smem->irq, qcom_glink_smem_intr, >> -                   IRQF_NO_SUSPEND | IRQF_NO_AUTOEN, >> -                   "glink-smem", smem); >> +                   IRQF_NO_AUTOEN, "glink-smem", smem); >>       if (ret) { >>           dev_err(&smem->dev, "failed to request IRQ\n"); >>           goto err_put_dev; >> @@ -346,6 +346,8 @@ struct qcom_glink_smem >> *qcom_glink_smem_register(struct device *parent, >>       smem->glink = glink; >> +    device_init_wakeup(dev, true); >> +    dev_pm_set_wake_irq(dev, smem->irq); >>       enable_irq(smem->irq); >>       return smem; >> @@ -365,6 +367,8 @@ void qcom_glink_smem_unregister(struct >> qcom_glink_smem *smem) >>       struct qcom_glink *glink = smem->glink; >>       disable_irq(smem->irq); >> +    dev_pm_clear_wake_irq(&smem->dev); >> +    device_init_wakeup(&smem->dev, false); >>       qcom_glink_native_remove(glink); >