From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D02EF3C6BA; Fri, 14 Mar 2025 12:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741953829; cv=none; b=dgbypyNmG8cOASnASNnnJHEsBvhQsmKDAzfX3qd2XNute2Kjjki14DwuwJyRvdz6xsQ9njuKlGZ89yOcW2ChuZYQsCLrHcdeU2qdkT93nG+Z/u3vdoHUUIm57jl46i+plTlHx7UEsVKygy+JiLl2GRunoUbGEBON6789+E+YZaU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741953829; c=relaxed/simple; bh=qikDiJMLCpRtaCKE/Y1FmzQczfwxIVA7dOqYr3ldh4M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ssZm4wSGahdzRYFc67sleM/FyZjoEk+/ewiUDragmy1ZE5SwCbGqX2zb0i/Szrs0ZnezWCD9VMTd7UNxL6d2HgSVnYyBALT2l9dNKn9RV8OZDvMt2R0BHDiLD4sKW4SIq7FxR899ZuCU0A+3bBBKy4LP6NALwK32ALY6225ZQsw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 39EDD1424; Fri, 14 Mar 2025 05:03:57 -0700 (PDT) Received: from pluto (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 28E3F3F5A1; Fri, 14 Mar 2025 05:03:46 -0700 (PDT) Date: Fri, 14 Mar 2025 12:03:38 +0000 From: Cristian Marussi To: Sudeep Holla Cc: linux-pm@vger.kernel.org, arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan , Ulf Hansson , Cristian Marussi , Ranjani Vaidyanathan Subject: Re: [PATCH] pmdomain: arm: scmi_pm_domain: Remove redundant state verification Message-ID: References: <20250314095851.443979-1-sudeep.holla@arm.com> Precedence: bulk X-Mailing-List: linux-pm@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: <20250314095851.443979-1-sudeep.holla@arm.com> On Fri, Mar 14, 2025 at 09:58:51AM +0000, Sudeep Holla wrote: > Currently, scmi_pd_power() explicitly verifies whether the requested > power state was applied by calling state_get(). While this check could > detect failures where the state was not properly updated, ensuring > correctness is the responsibility of the SCMI firmware. > > Removing this redundant state_get() call eliminates an unnecessary > round-trip to the firmware, improving efficiency. Any mismatches > between the requested and actual states should be handled by the SCMI > firmware, which must return a failure if state_set() is unsuccessful. > > Additionally, in some cases, checking the state after powering off a > domain may be unreliable or unsafe, depending on the firmware > implementation. > > This patch removes the redundant verification, simplifying the function > without compromising correctness. > > Cc: Peng Fan > Cc: Ulf Hansson > Cc: Cristian Marussi > Reported-and-tested-by: Ranjani Vaidyanathan > Signed-off-by: Sudeep Holla > --- > drivers/pmdomain/arm/scmi_pm_domain.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) > > diff --git a/drivers/pmdomain/arm/scmi_pm_domain.c b/drivers/pmdomain/arm/scmi_pm_domain.c > index 86b531e15b85..2a213c218126 100644 > --- a/drivers/pmdomain/arm/scmi_pm_domain.c > +++ b/drivers/pmdomain/arm/scmi_pm_domain.c > @@ -24,8 +24,7 @@ struct scmi_pm_domain { > > static int scmi_pd_power(struct generic_pm_domain *domain, bool power_on) > { > - int ret; > - u32 state, ret_state; > + u32 state; > struct scmi_pm_domain *pd = to_scmi_pd(domain); > > if (power_on) > @@ -33,13 +32,7 @@ static int scmi_pd_power(struct generic_pm_domain *domain, bool power_on) > else > state = SCMI_POWER_STATE_GENERIC_OFF; > > - ret = power_ops->state_set(pd->ph, pd->domain, state); > - if (!ret) > - ret = power_ops->state_get(pd->ph, pd->domain, &ret_state); > - if (!ret && state != ret_state) > - return -EIO; > - > - return ret; > + return power_ops->state_set(pd->ph, pd->domain, state); > } ...not sure about the history of this but it would have also definitely failed consistently on any systen where the SCMI Server exposes resources physical states (an IMPDEF behaviour), so that after a successfull set_OFF on a shared resource a subsequent get() could return that the resource is still physically ON if it was still needed by the other agennts sharing it... LGTM. Reviewed-by: Cristian Marussi Thanks, Cristian