From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CA89D73463 for ; Mon, 30 Mar 2026 20:48:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774903689; cv=none; b=ukAHo11wepccLTIlJF2ma1NPMogg9i/EryZFtJGl5rEEL9BRidPgjIDPcjbXuTgunWEdZbZ3FKCO718iK01OjdviGQZ2d+Gv1zzVtoB7QbBjerr6lHv2xyoHrARd8JibF8H2/8BxrU+pEG6V449bRz7jpaJ1YW6mjQk6lRlAM7w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774903689; c=relaxed/simple; bh=UF5+1CS9/OmLVT8niGXdL6QbIFkz4gb4E991NRItcO8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=U6vRBfFfY70hUf1naH/srnLNw5nohr2OdqWasnZ95SCWyr5OBXD9c2feS8R8O8aH3CJqhGHcoei6mrCko7N+c1gXjveup1/BvAgmlIGykwdoxD//Oz7RfTotrUjHlRm5pLexfp8eyNGCuGnr46xrgi95kGgWz4zVAUdsRjwrmoY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IyM4LrE2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IyM4LrE2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F9E1C4CEF7; Mon, 30 Mar 2026 20:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774903689; bh=UF5+1CS9/OmLVT8niGXdL6QbIFkz4gb4E991NRItcO8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IyM4LrE2TfT20A2cV8Izb4j8izwVZ9aiu57KjlHnV9QtlWyBgwdMuHalgyQPfFxEu t2Es2u1w+xvSs7x3iHCTAqjmkZtFzgoILv2b80KsoH4sTFymROw/R+y2hX/cpv8fXB GVlKupbnabPkAyvbsuLFNtRuaJIbcDthYoqh6EHIAS1t2nTfXdm9KExHMThNzv/9/g TLrdRNQJusums8BQKLBgbRuItXa/WzUOgk5emAJsMvUeKJo2RY8vw7402iSo37LoXo 7mKM31ayBvVfQu3qpzFx/gxvygILpRRcS0FGvL28eYpiLJYQlv+Z/dRBUHbOT7FnDx KgTb9mBaUnq+Q== Date: Mon, 30 Mar 2026 15:48:05 -0500 From: Bjorn Andersson To: 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 Subject: Re: [PATCH] firmware: psci: Set pm_set_resume/suspend_via_firmware() for SYSTEM_SUSPEND Message-ID: References: <20251231162126.7728-1-manivannan.sadhasivam@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251231162126.7728-1-manivannan.sadhasivam@oss.qualcomm.com> 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. 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 >