From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 429E7372ED0 for ; Thu, 2 Apr 2026 07:15:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775114115; cv=none; b=i3nRiSEDo0DJnKimrr8RUanl9ip86XZNQfz2Ql+MATqLe6PGOss+InaPOIjXY0mnbwFdZ7KQ5BV7KDntivg8AdStry3dZ+4XguWHR3qxHAGZc879Ao7HPjNLZVHhPpFrGOYYtYJdGFko1PEsOMESV6fznWMeDoe2luIMDHj3REI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775114115; c=relaxed/simple; bh=MVq8DhWMoK6RvFUDjljEbOIvSXLNjTRMDjhVlbIQDXo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=myggWnaW9PISy/6cYBuj3HfGuZmvhmRHSKxlDiuSJeWbU5x3b5XmCs5a7reu2g6gEsAD2tunpHNwZZY1tZzN2Zz01BmEl+83PuZTjNMMSXnyV7ZPXylrbxJkCw7Sx6ohOFgu1hG3IvS210bCuWV3vjgzFTuXRERH8l8PfGuB3uk= 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=Z0qwkRGP; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=PEeg5u3E; arc=none smtp.client-ip=205.220.180.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="Z0qwkRGP"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="PEeg5u3E" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6326knG72798829 for ; Thu, 2 Apr 2026 07:15:13 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= uHZnz1JLD7KjnjrT/icnsUWOTAJhf1tI9TDRmLu+vaM=; b=Z0qwkRGPV5Pa3anG LSYxGqESmPkCyAtnYDmY5WRjqGdFCWUMEFdW2uMlPAWFjuq+m6bne7nQMdT/cdbN kXmUC4zM8cEAegY9lGekAmpSMFpP0aS8WZzm6i85rpjfUgkKpmlCvRra9OhYzBBr l9C5K6twqpbvfYkT0VDcBNOwtRzTEaVTVe5OTCYw46UQToUi5kmSOAn7Y34qpRX2 5x283TF1G1raaCYsmIFJ29IRAgk9TjE6sLOQrw+nZWdfCExdSwNmYihr3JSeehdZ BjG0WBQWQKSgW9mvN5iwyEdjDyHtmQ7wyLdB0taDoNd5EYaDYNMYj2VwfCTl3Izg iqEpLg== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d96hk2u3a-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 02 Apr 2026 07:15:12 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-35c12a3bbb9so485000a91.3 for ; Thu, 02 Apr 2026 00:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775114112; x=1775718912; 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=uHZnz1JLD7KjnjrT/icnsUWOTAJhf1tI9TDRmLu+vaM=; b=PEeg5u3EHO+ca2/IZ3qjcxOZDLbfvIVbF6+5s4BUf55uQbH4vf3wCw7q6yeKCUWJYv QG/L69uHyhXPKrzL6nLlTbA8eTRB9gqiAh11UD5zpu2cDkuJcUDu1/lqwroNNjlFoJen +VVU4+PQj1r2gWmlrlv1urrez1FAUjFosW/bpc0UxUimcxIBm+aUe0/1rWz3i0lm/3wR AxM4I07401gE6z0Tdkh1h6Mn7MRnWpcTn9GL6K3DloCY+s8xZc8Bsa0i/Xue690oiFiI +PjnA1kV0EyCxJLckaxvP8qxPRurbvDZWrhtMNsLyuZxixsMvEBXd6P8eQwKaTWyUy1p sFiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775114112; x=1775718912; 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=uHZnz1JLD7KjnjrT/icnsUWOTAJhf1tI9TDRmLu+vaM=; b=fvQXfXMZ8R15JXLO5GByEpke2bDo8b8b4hWjV3ckXpMEYoPVccHbrOpG803wXekETQ EsQ4kUW1b6xYcmBuuq/q8xjcOasIqqP2BJOuCs4Wm71hyZnwB98aNr+z9jwotL4k9JRw Tc/BZwxpuECPEqUE1kV7duM67bFUB/hEJnRrzYg3lyIHEwMtxnVc8RBMP7l/EI5lu3gn hhAxPUdDWmxlQKJl79olvPKyZnsSVM+npMYRPVplaLvzLgLxnJRJKsWv8Zi8t7HJvewf 0gEN5wQlzlAZI7R59XVGo2/EFt1YQg40rd5FEkk8haNCzvRWCsWn2Ic3NVN7L/TY8yD8 ITtw== X-Forwarded-Encrypted: i=1; AJvYcCUugmlzCg3SqQGpj+NFhwTa/4Re3WMK5jTzYPf26Qc7YbrF1GCuY7639v6r/XhINxrrejaYssLs5DF/fI0=@vger.kernel.org X-Gm-Message-State: AOJu0YxAQoo12S4L1Np+RLsgmEa/FN6mnfTQ5sFxFVI5s94gvkWAORFr gz2au88RNGVCkb7EVn9oDRk2viTvI7gygRzvH71ZimIyc5L+0+PARt1qjnwc/rwnuszDrHTT+LJ RTp7POPElHNr4gAoqQJc7nuIyTvvoCAnS/9DkWlqV0IWF6u2fSxUANMuW9BDsIZc9ViA= X-Gm-Gg: AeBDietJ2Q6wF4np+Gt46xDXFNxnm2hBiWmIlDUK1/2M0S1jqoVN6oYzPP8QmiW2hI9 SO5Jjjden8bwyffju//x5G51tqF5Un/AGrTwVrF+X1YZAN+R+R0nQ937J7KnV1SKF0W/e/wAw37 S1IVH1EccE6TDBFINiRGQ1lIbYwkCvR4j0h3pe3yj5YcwEncZfijH30nAtt/K3vHwWr5Amojhfm JCHgjmu/ohJMmr0vTUjTYXPIrcT0m+/tcttCu7CKzUQDkl+nfPI971gWyxRQQoR1dKDUmoKR7NU ZwyCVSHMnOILTwxW3ct2E2dlklWvcLq3anoRPB3m7x/OvJs8oQv935q4u6jxqSyMKovFyATq8XO 3M6sEQz6pdyVNLR5wRY5q1vzAnkNgitOrbbcZSN0wzeeHeozTPwKX X-Received: by 2002:a17:90b:3e4e:b0:35d:8fdb:4f26 with SMTP id 98e67ed59e1d1-35dc6e2d0camr5522369a91.1.1775114111498; Thu, 02 Apr 2026 00:15:11 -0700 (PDT) X-Received: by 2002:a17:90b:3e4e:b0:35d:8fdb:4f26 with SMTP id 98e67ed59e1d1-35dc6e2d0camr5522327a91.1.1775114110887; Thu, 02 Apr 2026 00:15:10 -0700 (PDT) Received: from [192.168.29.179] ([49.43.224.151]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c76c6491157sm1629948a12.9.2026.04.02.00.15.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Apr 2026 00:15:10 -0700 (PDT) Message-ID: <78c3e17a-9e67-4de1-9137-5fb617ff2e32@oss.qualcomm.com> Date: Thu, 2 Apr 2026 12:45:04 +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] firmware: psci: Set pm_set_resume/suspend_via_firmware() for SYSTEM_SUSPEND To: Bjorn Andersson , Manivannan Sadhasivam Cc: mark.rutland@arm.com, lpieralisi@kernel.org, bjorn.andersson@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, mani@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Konrad Dybcio , Konrad Dybcio , Sudeep Holla , linux-arm-msm References: <20251231162126.7728-1-manivannan.sadhasivam@oss.qualcomm.com> Content-Language: en-US From: "Maulik Shah (mkshah)" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDAyMDA2MiBTYWx0ZWRfX/5MSu0FnKRZT LzI1HzTZkvVJZCsJ4HH6Zria6JW+BnBXNBv2j8OCSki8jNXHGgSuNNXWXe/u6YUV8VhvmxdPpLf urDTj479USklWz4szpGScGWfvBMZ8bkPG5SupCrJVRP3Qy0aXQ/aBXwaAJK2SiDtHGo7CXAcQdX n2BmnRoMkkx16O0asz+3WWxbiFuYqdoeZVMN6kX11X4aSVm8KfgIGla68muXzKmp9gn7NMFuvSz GX8i+JDm01GCynyIxEHXzr3pmwN7axo9zoYuhyTtwETxdgGGawIaw5pqcRF+oCfshIT1qMJddIq y3+USc9FHlbVZAbPJVqEeAhnD/d3WK2it/KAB24NHJ+g55OO5BMQUa5sIY20ySXpShOpMOxAuAB pBpX/BeM72f0SHenGLH9UFwqZDjhMP46TzThns+r4nyyhJHfwc3YG1EzaVyGpHEGiXbvw6KD256 hrxkjBi28WLHU79AaEw== X-Proofpoint-GUID: H109zkGGJxOXmkFQpdAT2Lw7yyFaK0r0 X-Proofpoint-ORIG-GUID: H109zkGGJxOXmkFQpdAT2Lw7yyFaK0r0 X-Authority-Analysis: v=2.4 cv=e9ULiKp/ c=1 sm=1 tr=0 ts=69ce1780 cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=j/PqwQOCDgRQPIT2BnD5zw==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=7CQSdrXTAAAA:8 a=DkhKwNFMYnxxsx_nhJ0A:9 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 a=cvBusfyB2V15izCimMoJ:22 a=a-qgeE7W1pNrGK8U0ZQC:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-02_01,2026-04-01_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 phishscore=0 bulkscore=0 malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2604020062 On 3/31/2026 2:18 AM, Bjorn Andersson wrote: > On Wed, Dec 31, 2025 at 09:51:26PM +0530, Manivannan Sadhasivam wrote: >> From: Konrad Dybcio >> >> PSCI specification defines the SYSTEM_SUSPEND feature which enables the >> firmware to implement the suspend to RAM (S2RAM) functionality by >> transitioning the system to a deeper low power state. When the system >> enters such state, the power to the peripheral devices might be removed. > > What is the actual extent of "peripheral devices" in this definition? > >> So >> the respective device drivers must prepare for the possible removal of the >> power by performing actions such as shutting down or resetting the device >> in their system suspend callbacks. >> > > Our typical interpretation of this state is that IP-blocks might be > non-functional during this time, but typically some state is retained. > > Will the acceptance of this patch result in that we in the Qualcomm case > should start accepting/writing patches that implement save/restore of > state that is generally retained throughout the drivers - in the name of > "power might be removed"? > >> The Linux PM framework allows the platform drivers to convey this info to >> device drivers by calling the pm_set_suspend_via_firmware() and >> pm_set_resume_via_firmware() APIs. >> >> Hence, if the PSCI firmware supports SYSTEM_SUSPEND feature, call the above >> mentioned APIs in the psci_system_suspend_begin() and >> psci_system_suspend_enter() callbacks. >> > > With the right interpretation of what this means for us, I think this > patch looks good - but as we've discussed, I'm a bit worried about how > to deal with the alternative interpretations. > > Specifically, if we fully adopt "power might be removed", we should to > take actions which will prevent a typical Qualcomm system from waking up > from sleep again. The "power might be removed" not necessarily indicate that devices/ peripherals should remove the wake up capability of interrupts in order to prevent waking up from sleep. The hibernation + suspend-to-ram is one such example, where "power might be removed" but devices may still leave the wake up interrupts enabled. Pasting from commit 62c552ccc3ed ("PM / Hibernate: Enable suspend to both for in-kernel hibernation.") | It is often useful to suspend to memory after hibernation image has been | written to disk. If the battery runs out or power is otherwise lost, the | computer will resume from the hibernated image. If not, it will resume | from memory Which can be interpreted as wake up interrupt should be able to wake from suspend-to-ram state "to the point until the power is cut off or battery runs out". And in order to do so, wake up capable interrupts should be left enabled in HW, for interrupt controllers like GIC (and PDC in Qualcomm SoC cases) to support wake up. Adding Cc: linux-arm-msm for better visibility. Thanks, Maulik > > Regards, > Bjorn > >> Signed-off-by: Konrad Dybcio >> Reviewed-by: Sudeep Holla >> [mani: reworded the description to be more elaborative] >> Signed-off-by: Manivannan Sadhasivam >> --- >> >> This patch was part of an old series that didn't make it to mainline due to >> objections in the binding and exposing CPU_SUSPEND as S2RAM patches: >> https://lore.kernel.org/all/20241028-topic-cpu_suspend_s2ram-v1-0-9fdd9a04b75c@oss.qualcomm.com/ >> >> But this patch on its own is useful for platforms implementing the S2RAM >> feature in PSCI firmware. So I picked it up, tested on Qcom X1E T14s and >> resending it. >> >> drivers/firmware/psci/psci.c | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c >> index 38ca190d4a22..e73bae6cb23a 100644 >> --- a/drivers/firmware/psci/psci.c >> +++ b/drivers/firmware/psci/psci.c >> @@ -539,12 +539,22 @@ static int psci_system_suspend(unsigned long unused) >> >> static int psci_system_suspend_enter(suspend_state_t state) >> { >> + pm_set_resume_via_firmware(); >> + >> return cpu_suspend(0, psci_system_suspend); >> } >> >> +static int psci_system_suspend_begin(suspend_state_t state) >> +{ >> + pm_set_suspend_via_firmware(); >> + >> + return 0; >> +} >> + >> static const struct platform_suspend_ops psci_suspend_ops = { >> .valid = suspend_valid_only_mem, >> .enter = psci_system_suspend_enter, >> + .begin = psci_system_suspend_begin, >> }; >> >> static void __init psci_init_system_reset2(void) >> -- >> 2.48.1 >> >