From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04871E75455 for ; Tue, 3 Oct 2023 12:37:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wJaETN3jXZ5E0F3h/TTt4/3uOOYChbm5u6dtD8ThD64=; b=1iA5kpmV9+EcOL YFmo5woW84QLN8SIfyPVQ+wVmDdD7LmuQD5mTHoY5Q0B1ntxsGz2MomWwBcd97/Pr1xVXHSHdf69p CFfvz1h0T5Ns106Yxtoyf6zJ0rugdgRY8xXO5rU9u0NNL+esrCvrEPkVzQGOMjUbNQ4cC+aPJ7x6z 4jHCONEqHpaFrBIPv2V53lPUQ3uoS4T/6cM86Y9C3+6WaPJLf37xIVLnKkIaKB/IWC63AD77xIj8r J3QKFwu9yWilP3COsz7gJ1FeESIATU7AAj1wqby42La5b/hksQbnoKkEM/EbohdPDsbY1fXjdcY4d 4ya3xh5/q09iL2I+oIMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnee4-00Ecre-0q; Tue, 03 Oct 2023 12:37:00 +0000 Received: from mail-yb1-xb32.google.com ([2607:f8b0:4864:20::b32]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnee1-00Ecqv-1i for linux-arm-kernel@lists.infradead.org; Tue, 03 Oct 2023 12:36:59 +0000 Received: by mail-yb1-xb32.google.com with SMTP id 3f1490d57ef6-d81f35511e6so758870276.0 for ; Tue, 03 Oct 2023 05:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696336613; x=1696941413; darn=lists.infradead.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BBX7WALro7ZMkb002Ch3k9j1xjJ9wEjQFSfSLSNKyVA=; b=HrDnqs9V1L8NqvQy9TXTNnuKt8oCFQDvqzTsc99Itm/CTfYjy9bGYwtn6NNW28evIz wxbwJd9XXfQ90ZEwj2N+jwV8XqLByE2dYI6LAreaEQT+J81apXJcM14aXeeKaHawcSV/ BJMt9M6IdTz6+IZWQqhiFADIuUOLToyjiQI4siXe03ICd0c8GsOQJXw041NqKWYuWI42 pOZut0de1Nv97fZeHlxaypFkei/ShPyPkIOiWBKYY6UmqWIGppUSM/YUpDpl0Ywq9niL gb63NAjdJZ5wq9hQ0fbOP/p7x40sziR74vjxv+yhyHR+yHz1vXHLwx175Mj1dL20Mbtt ZoWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696336613; x=1696941413; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BBX7WALro7ZMkb002Ch3k9j1xjJ9wEjQFSfSLSNKyVA=; b=EITmXA7UI8BR5yDWeoKd4JgEBERKBh7aGigxGOCFNUM+kHmvqNid0Bx91Z7//K2y8D pZOOE83pjcP54ffGB4+7jXiO61QQOcMzd9HfUmDJdSYfeXss3ronB/XEPYMKsCu5oZ06 2dPIoShNyO9BAer+pBvtCBeLaIn0Q4dmL49yU3qtMuUFg8j9CEMO0z1wTGBWGMWMz1Fb yA+Mu54u/v0io+kpc41Hj2yhFEeMqGZW0nnf7fB/fe0B/FD/9UM+DJLO8c2tS6WUpk3+ 9ALfKNMxU3BqhUwtS2ZQ99fiYxy78No/LynyUuD3Y3uNvr3XiYNf0PG/L/qPJWEhqFhk rAYw== X-Gm-Message-State: AOJu0YyEwULao6LSqsXcHhXk8GIsuDMe20SBZyfwFME+RvvZdbftqTjI 69QHLeMTuDNdP7mcdMNfETUn4+uArn4rQwgalgMWIg== X-Google-Smtp-Source: AGHT+IGdl+vhW0m01pb/+ML+OMGARTp9lewRZVPBj7PzhWM7waqR82ShESUiVLf8ufb7gdbuRoiu4yVr0cW53ETCZw0= X-Received: by 2002:a25:8b09:0:b0:d81:b5e2:b1cc with SMTP id i9-20020a258b09000000b00d81b5e2b1ccmr1931296ybl.5.1696336613296; Tue, 03 Oct 2023 05:36:53 -0700 (PDT) MIME-Version: 1.0 References: <20230925131715.138411-1-ulf.hansson@linaro.org> <20230925131715.138411-7-ulf.hansson@linaro.org> <20231003082322.cmok766jxzftsgrg@vireshk-i7> In-Reply-To: <20231003082322.cmok766jxzftsgrg@vireshk-i7> From: Ulf Hansson Date: Tue, 3 Oct 2023 14:36:17 +0200 Message-ID: Subject: Re: [PATCH 6/9] OPP: Extend support for the opp-level beyond required-opps To: Viresh Kumar Cc: Sudeep Holla , Cristian Marussi , Viresh Kumar , "Rafael J . Wysocki" , Nishanth Menon , Stephen Boyd , Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231003_053657_592989_761B257E X-CRM114-Status: GOOD ( 37.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 3 Oct 2023 at 10:23, Viresh Kumar wrote: > > On 25-09-23, 15:33, Ulf Hansson wrote: > > On Mon, 25 Sept 2023 at 15:18, Ulf Hansson wrote: > > > > > > At this point the level (performance state) for an OPP is currently limited > > > to be requested for a device that is attached to a PM domain. Moreover, > > > the device needs to have the so called required-opps assigned to it, which > > > are based upon OPP tables being described in DT. > > > > > > To extend the support beyond required-opps and DT, let's enable the level > > > to be set for all OPPs. More precisely, if the requested OPP has a valid > > > level let's try to request it through the device's optional PM domain, via > > > calling dev_pm_domain_set_performance_state(). > > > > > > Signed-off-by: Ulf Hansson > > > --- > > > drivers/opp/core.c | 29 +++++++++++++++++++++++++++++ > > > 1 file changed, 29 insertions(+) > > > > > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > > > index 60dca60ac4af..afb73978cdcb 100644 > > > --- a/drivers/opp/core.c > > > +++ b/drivers/opp/core.c > > > @@ -1107,6 +1107,22 @@ void _update_set_required_opps(struct opp_table *opp_table) > > > opp_table->set_required_opps = _opp_set_required_opps_generic; > > > } > > > > > > +static int _set_opp_level(struct device *dev, struct opp_table *opp_table, > > > + struct dev_pm_opp *opp) > > > +{ > > > + int ret = 0; > > > + > > > + /* Request a new performance state through the device's PM domain. */ > > > + if (opp && opp->level) { > > > + ret = dev_pm_domain_set_performance_state(dev, opp->level); > > > + if (ret) > > > + dev_err(dev, "Failed to set performance state %u (%d)\n", > > > + opp->level, ret); > > > + } > > > > Okay, so reviewing my own code found a problem here. We need an "else" > > here, that should request the performance state to be set to 0. > > > > I am not sending a new version at this point, but awaiting more feedback first. > > I am looking to add below to this patch, is that okay with you ? > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > index 7b505316bb1c..a113e9caaa5a 100644 > --- a/drivers/opp/core.c > +++ b/drivers/opp/core.c > @@ -1135,16 +1135,22 @@ void _update_set_required_opps(struct opp_table *opp_table) > static int _set_opp_level(struct device *dev, struct opp_table *opp_table, > struct dev_pm_opp *opp) > { > + unsigned int level = 0; > int ret = 0; > > - /* Request a new performance state through the device's PM domain. */ > - if (opp && opp->level) { > - ret = dev_pm_domain_set_performance_state(dev, opp->level); > - if (ret) > - dev_err(dev, "Failed to set performance state %u (%d)\n", > - opp->level, ret); > + if (opp) { > + if (!opp->level) > + return 0; > + > + level = opp->level; > } > > + /* Request a new performance state through the device's PM domain. */ > + ret = dev_pm_genpd_set_performance_state(dev, level); > + if (ret) > + dev_err(dev, "Failed to set performance state %u (%d)\n", level, > + ret); > + > return ret; > } > > I am switching back to dev_pm_genpd_set_performance_state() as I won't be > applying the power domain changes. Can you please explain further on this. Rafael has acked those patches, so it should be perfectly fine for you to pick them via your tree too. There is no need to defer them. > I will then push out a branch and you can > rebase your patches on top of it ? And then probably Sudeep or someone else can > apply everything ? Or are you suggesting to just take one of the patches from my series, and then I will re-base everything on top? Just trying to understand the way forward. :-) Kind regards Uffe _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel