From mboxrd@z Thu Jan 1 00:00:00 1970 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 7419132C942 for ; Fri, 3 Jul 2026 04:51:44 +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=1783054312; cv=none; b=IqZD4t6aK5+p1ikg5nZr90mkhdMnD7v8Wx8DEjMoYi0aGsaOGzM6ooY+W1scs1cK45J75IHNDaE/jH/QlJe9cv0oZIo+Tx9UtoBVqwEx3wK5y/RS6UZ1Rc+83NY0hoMm/xk6sbKCRymDO+CLreLAmnx/R+LPBROCgWERvue0DKw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783054312; c=relaxed/simple; bh=i9VfKxB6W7SE7/7UGu3+PX6t1sBCwGxQEschIHYCu4M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MsVSMkwKTwSsZk/JkrtPMHS+64WFS+Az9CrGuRdbVjvIqZmz4OajdVyaj1wPkGJVvjZa2VqqGpIU3ie2tZT+s7i81tPIVBFzvFURS0IuvYYnsJE8hHj0zBABEeU5dbFhhk3pzEoS9dSNF3KvcePB4qv/gL307F3bu1ncuGFR898= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=l5Qi/bD3; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=UZHqLuhC; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="l5Qi/bD3"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="UZHqLuhC" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66342YNc2819643 for ; Fri, 3 Jul 2026 04:51:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 4woTUuvmZDdwYb7vOc5MfIv0PJgvjUEe4j7hT1Oxb3Y=; b=l5Qi/bD3YIBVa2qu /fFhGumHdYQDXQpqtgn/JvqqXNF4wKC3zREQ/65b73aEt3OVmxI/vmYR5YJFaJK4 JTrZADpaN3GS7IExw0Ep5NiO1Q5WSeRrNjFnTuF74gGplIheVDvO4NlOE/v9MjST yZLRdankHJHc0fF+o4yxYs/4DVyG6/sNauqJFraW7I17ZDNctzYhJLu2asjHRNPv PsNums7Bm9nvXS6UW+b6NQ66zmBsT6uB1shIl8c2BXQrLKJWUvbzh2VEjYfsTH3A griXvcjTiRyuaFHBjcDkKRYnzksNyXIUChCM+w4IkdHuPPj7CYbZ0Vh9542YvVHe ILjM8A== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4f5qfc3qdv-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 03 Jul 2026 04:51:42 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2c9b71388fbso4192125ad.1 for ; Thu, 02 Jul 2026 21:51:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1783054302; x=1783659102; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4woTUuvmZDdwYb7vOc5MfIv0PJgvjUEe4j7hT1Oxb3Y=; b=UZHqLuhCrEu6uv8IOlZOtfhnde0fQ5khuCEv8br692kVla7u1lu2Zh1Vj62c8Alkh6 +Jj5mIox35re3b1igUBwhev/hAQLwYWvY57Kv0ClDCz6ktbALTgdbLGy4VAedDUQtOD3 81Hg6GglmveoqjeQYNMHTcnlAcF4jaOeuPOZnJH6qK5WbzaG50P6O+rfVoNOTi4Z4g0+ B6CPic5a3JrDcto3tT2PzXXmsrRBJpMSdwuGvM7ZDAz0gRc3mnOFphBhakgx3Kp851NY 9o2zchH35PgCgk7wQixhI+y+o55vLEyCbqj26dF2cNjLkPI1/WhyoGWr3OScy5s3f5Of xBWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783054302; x=1783659102; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4woTUuvmZDdwYb7vOc5MfIv0PJgvjUEe4j7hT1Oxb3Y=; b=IElbgC7VdHds1ZKvSnrfZChQSgvg+CXWGmkTRRkqiXmyBO41ARzlW1amqJrY1zCKCN emgz7rJiX19j0/S34D8pgTVhzF2EG0K6r/ax6N+MS/FNGZH2aYSXtIrSvBJWZkTemqnp 5j3MQqAusF7RKhwd+7VdwdsL3V1Q57eimDaq5NkU9eNflZq3bSrwXDdOjv82i3Vyak3C vpHbpr7PPcPG/1loeBrGjiZ+jsExrouwg/WjgcCCbm9QF+kQtqVNJQJiXL4D2YBHkBwo 1oEgfzyc0Jg565Upd53pXr27rkepU+WFnQcoa+qqgnxYKNRjy+ufEqCnY453nwrTj/UA EAxw== X-Forwarded-Encrypted: i=1; AHgh+RpabUpZ9wobrnH/++S0eqA1hyIhuQiLPGuKZ01VzdWv8hWuTk7O94Viu/K06SK2uVbYd4ex5V/hxGmdWHs=@vger.kernel.org X-Gm-Message-State: AOJu0YyUHdZUxTViBZcyxvlfQ+2m2eunftQflx+l7Hgq3g8u0mMBQ5cZ Qmxfl+3l5OUpYLyCf5IFktRQkZXg9MnaY1AWttt8+auXpf1VBNYtNbJeRB4VID9oV3ZrAmtmbRP R9Kcn39kZnwmAX7WxZaT/Yk3BSNhd0PdlYbanvt0Qn2q7u7lpiYJOoVltEuprfu/xI3Y= X-Gm-Gg: AfdE7ckj+7/G9drtuvK1YZNWn4VQ6M59f8HB3dIuaZgd7IXY2BCb+bK+edwBI7FiPIi 1LCZUk889Bg5hfbTLP6biaUgIP6QJcllz0FZYoWdIUwUfeTyY6zyuKULiz5Fv7B6iBaXyWjE5zI 8QaVuzL28OLxRr01ISX8kpgb14wjFj4dmBepn390WrGtS/txsB+iXFE83MjgTIihYHw674yd5xV Lc2i6AS0PKYtN5Zu8DUEUzp6Q2lY/6nwoeFZxQaOuEHJW2SD1yANx+zdr+djB8rxIi5hVeEf6xC NEXEExhZ2v660w4pOezYJ5Gh31I1JIA5e9JHusipbrPtOtsbC4/2t4+yRSnlRYjdiQzX4tB20VA U6HDwwAVfmdZYVS//WX7PLQgCZiXQ1wsNKhxtJm4GKQKH X-Received: by 2002:a17:902:db12:b0:2c6:9f66:d573 with SMTP id d9443c01a7336-2ca7e67eda5mr96601215ad.2.1783054301954; Thu, 02 Jul 2026 21:51:41 -0700 (PDT) X-Received: by 2002:a17:902:db12:b0:2c6:9f66:d573 with SMTP id d9443c01a7336-2ca7e67eda5mr96600935ad.2.1783054301351; Thu, 02 Jul 2026 21:51:41 -0700 (PDT) Received: from [10.217.218.209] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13b3c7fa33asm16106814c88.5.2026.07.02.21.51.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Jul 2026 21:51:40 -0700 (PDT) Message-ID: <3777cef8-c90a-4c7a-9b71-c563e8d56f2e@oss.qualcomm.com> Date: Fri, 3 Jul 2026 10:21:35 +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 v6] i2c: i2c-qcom-geni: serve transfers during early resume To: Mukesh Kumar Savaliya , andi.shyti@kernel.org, viken.dadhaniya@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorande@oss.qualcomm.com Cc: konrad.dybcio@oss.qualcomm.com References: <20260629134140.755193-1-mukesh.savaliya@oss.qualcomm.com> Content-Language: en-US From: Aniket RANDIVE In-Reply-To: <20260629134140.755193-1-mukesh.savaliya@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: mwHqlljqvEUIaAajOeHM6NgpAeUIOo0y X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzAzMDA0MiBTYWx0ZWRfXxCFRUgAcHnW9 DOiaepyVorxaI/x4j4G1gO3xa423+jV9hpyXD6edtfB2jY7QIHCEIvJBo/rxIu46zzh40VoS/r3 QZXldwtnTVUF9tL7HFX62Go2Vwk3P33hokej8x+xnvq4tKffcrXLt17TVYQOg1wJaU5oXqJzfG3 ljF6dI7gWFCGe6Ztmjy/WuvwMS1gB+EyDIqyYl6y8ZGUsAIX6wer5tKcKh513gZ+wHJBNgtUZME 9zJcGnrIE0IMY8b5DyV+JO8iUyQxcR3zD8aIMEzAA4gLPKGp28o9qmpaFMuG87d/Ua6dxfy77cQ NyzURyJ7xIQJfJLSayex+sWtvMnGrm1XT3cVdTGpvtqbZ+fGE740vSBH9Vjs7oQpyq/ryaqb9uA rqxaZQInHni7lBC9ZTd0ncM/j+3acO/NfTjxanLVCYpEXgfpyxSvW5UFU+f75pqRQEomlPlDhGr 4OUkBYcI5aUzuhRQjXQ== X-Authority-Analysis: v=2.4 cv=dvXrzVg4 c=1 sm=1 tr=0 ts=6a473fde cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=VwQbUJbxAAAA:8 a=COk6AnOGAAAA:8 a=QyXUC8HyAAAA:8 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=5gi8XA0zxOeqIYz4FXMA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 a=TjNXssC_j7lpFel5tvFf:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: mwHqlljqvEUIaAajOeHM6NgpAeUIOo0y X-Proofpoint-Spam-Info: AW1haW4tMjYwNzAzMDA0MiBTYWx0ZWRfXy3b+3zOl2d8w 3YMHCL3OFLlKFiU8+KyVCHXPRRwUNDxuR2Oifv1mKYLfNFIyWWKmBPZoXQwGhOk1tHvKh9h7Ob+ 4yWNpB0ivTubKocnwNNr6rRNOUkfIXU= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-07-03_01,2026-06-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 priorityscore=1501 adultscore=0 impostorscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607030042 On 6/29/2026 7:11 PM, Mukesh Kumar Savaliya wrote: > I2C transfers issued during the resume_noirq phase can fail on GENI I2C > controllers. > > Some devices require I2C communication before their resume sequence can > complete. One example is a USB Ethernet device attached through PCIe, > where device configuration must be restored over I2C before PCIe link > initialization can proceed. Since such accesses occur during > resume_noirq(), the underlying I2C controller must be able to service > transfers at that stage. > > However, GENI I2C transfers rely on interrupts for command completion, > while IRQ handling is still suspended during early resume. Additionally, > runtime PM may remain disabled until later in the resume sequence, causing > pm_runtime_get_sync() to return -EACCES and preventing controller > resources from being enabled. > > Allow the controller to operate during early resume by requesting the IRQ > with IRQF_NO_SUSPEND and IRQF_EARLY_RESUME so completion interrupts can be > delivered during the noirq phase. Also restore runtime PM from > resume_noirq() when it is disabled and tolerate transient -EACCES failures > from pm_runtime_get_sync() during the PM state transition. > > This enables GENI I2C transfers to complete successfully during the > resume_noirq phase and allows dependent devices to finish their resume > sequence. > > Co-developed-by: Viken Dadhaniya > Signed-off-by: Viken Dadhaniya > Signed-off-by: Mukesh Kumar Savaliya > --- > v5->v6 : > - Modified commit log to start with problem description as suggested by Bjorn. > - Moved to new implementation of the logic while earlier replied to comments on > older design and considers latest fix added recently. > - Made change generic to I2C including GPI mode transfer, this was not done earlier. > - Changed email address to oss.qualcomm.com domain. > Link to V5: https://lore.kernel.org/lkml/20241227130236.755794-1-quic_msavaliy@quicinc.com/ > > --- > v4->v5: > - Commit log enhanced considering Bjorn's comments by explaining PCIe usecase. > - Enhanced comment with reason when using pm_runtime_force_resume(). > - Corrected IS_ENABLED(CONFIG_PM) condition inside geni_i2c_xfer(). > - Improved debug log as per Bjorn's suggestions during suspend, resume. > - Reverted back comment before devm_request_irq(). > Link to V4: https://lore.kernel.org/lkml/bd699719-4958-445a-a685-4b5f6a8ad81f@quicinc.com/ > > --- > v3->v4 : > - Enhanced commit log by explaining client usecase scenario during early resume. > - Covered 'usage_count' of 'struct dev_pm_info' under CONFIG_PM to compile non PM CONFIG. > Link to V3: https://lore.kernel.org/all/20241119143031.3331753-1-quic_msavaliy@quicinc.com/T/ > > --- > v2 -> v3: > - Updated exact usecase and scenario in the commit log description. > - Removed bulleted points from technical description, added details in free flow. > - Used pm_runtime_force_resume/suspend() instead customized local implementation. > - Added debug log after pm_runtime_force_suspend(). > Link to V2: https://lore.kernel.org/lkml/202410132233.P25W2vKq-lkp@intel.com/T/ > > --- > v1 -> v2: > - Changed gi2c->se.dev to dev during dev_dbg() calls. > - Addressed review comments from Andi and Bjorn. > - Returned 0 instead garbage inside geni_i2c_force_resume(). > - Added comments explaining forced resume transfer when runtime PM > remains disabled. > Link to V1: https://patches.linaro.org/project/linux-i2c/patch/20240328123743.1713696-1-quic_msavaliy@quicinc.com/ > --- > --- > drivers/dma/qcom/gpi.c | 3 ++- > drivers/i2c/busses/i2c-qcom-geni.c | 12 +++++++++++- > 2 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c > index c9a6f610ffd9..332f3aa40628 100644 > --- a/drivers/dma/qcom/gpi.c > +++ b/drivers/dma/qcom/gpi.c > @@ -615,7 +615,8 @@ static int gpi_config_interrupts(struct gpii *gpii, enum gpii_irq_settings setti > > if (!gpii->configured_irq) { > ret = devm_request_irq(gpii->gpi_dev->dev, gpii->irq, > - gpi_handle_irq, IRQF_TRIGGER_HIGH, > + gpi_handle_irq, > + IRQF_TRIGGER_HIGH | IRQF_NO_SUSPEND | IRQF_EARLY_RESUME, > "gpi-dma", gpii); > if (ret < 0) { > dev_err(gpii->gpi_dev->dev, "error request irq:%d ret:%d\n", > diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c > index d2f5055b0b10..d56b36bd1d26 100644 > --- a/drivers/i2c/busses/i2c-qcom-geni.c > +++ b/drivers/i2c/busses/i2c-qcom-geni.c > @@ -913,6 +913,10 @@ static int geni_i2c_xfer(struct i2c_adapter *adap, > gi2c->err = 0; > reinit_completion(&gi2c->done); > ret = pm_runtime_get_sync(gi2c->se.dev); > + if (ret == -EACCES) { > + dev_warn(gi2c->se.dev, "Runtime PM is disabled:%d\n", ret); > + ret = 0; > + } Why we are checking specific error code here? Why can't we use the below error check directly? if get sync itself is failed with pm runtime disabled then why we are going ahead by making ret = 0 here? How you will make sure resources are enabled? > if (ret < 0) { > dev_err(gi2c->se.dev, "error turning SE resources:%d\n", ret); > pm_runtime_put_noidle(gi2c->se.dev); > @@ -1045,7 +1049,8 @@ static int geni_i2c_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, gi2c); > > /* Keep interrupts disabled initially to allow for low-power modes */ > - ret = devm_request_irq(dev, gi2c->irq, geni_i2c_irq, IRQF_NO_AUTOEN, > + ret = devm_request_irq(dev, gi2c->irq, geni_i2c_irq, > + IRQF_NO_AUTOEN | IRQF_NO_SUSPEND | IRQF_EARLY_RESUME, > dev_name(dev), gi2c); > if (ret) > return dev_err_probe(dev, ret, > @@ -1257,7 +1262,12 @@ static int __maybe_unused geni_i2c_resume_noirq(struct device *dev) > if (ret) > return ret; > > + /* Enforced disable_depth = 0 to actually enable runtime PM during noirq phase */ > + if (!pm_runtime_enabled(dev)) > + pm_runtime_enable(dev); Here we are enabling the pm runtime so where we are disabling it? > + > i2c_mark_adapter_resumed(&gi2c->adap); > + > return 0; > } >