Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp1130346rdf; Wed, 22 Nov 2023 06:27:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEhZHBCXYg5Y3kSz+7Aj2xLPmro3vhw9rGNhnZZjxyvu9cRqN7j/DdQ/oAY8lsJPcVbJjWL X-Received: by 2002:a17:902:9f97:b0:1cc:6ec2:d24e with SMTP id g23-20020a1709029f9700b001cc6ec2d24emr2675474plq.53.1700663248866; Wed, 22 Nov 2023 06:27:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700663248; cv=none; d=google.com; s=arc-20160816; b=LLFq+0sezkS2HGLCyde/wrLly/huEw6+4vF7Q5EuXF5Te7s+qOoMREamBfYnZc90yL QvapI752DeZxNA0C+GqeQ7d9TH5V3MBJLqUL8t/52dFuKcfEGVpQmOavdUKgnOY2cYkj 73FXIHRr4HiZrjlq4xyWGJ2jD8FenIsgYcztT2vrNr/V1T0SxAyXbPwugJa0YKDsXdeU pCtdPFrNrstDZTRRl61XyUj94rXqqUoJqj8GgM0yzQcDEkIjb56WfhOA8IVqkXMku1eD MNmthY+7Bm3O2VIsmVBJuDj2Thc7JMZNOYUjdXuKdp8BI9AmdWIp5M1D1MBx3zUhBHez vo9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=vEGlLD2Ow2lZAT02DeB30p2mlAQUUZVJgtqFw5LKgjM=; fh=Thsm/YsGQ8BRwpVPNCZ0GpvJ5RjMueymR7Lb1vW50B0=; b=MYPpXWbOC37wo0CuN60j2vz3UuM0nIh5DzZuxS086HVBsJWpa1fgv3DApk94MXlsXg F0hBFwpR2WR/X1UND4GklZgXPwVDTaRPgvo+VOXWoYAXNWXMKkn/ui8VW1HQqIUHiIJp XUQ1kwVOv+cBRpzo6rcxBSQkaqTXV70VO3WZ8rrnsAlVgp4M+uB/h9dYTy6PG/rTyeZX /QZpp/DzeONwWsb0+1D2DWhU70SgXfgBYgWWQwOh+6tzaATMjSfVkBySK22KlYCUUL5k RPcz5Z8Uk814WqTvEJrXTtke/Y4A7Ya7+3Ic+Ay8dOG9diDMoKkGdrfSA83XevFD1N3Y rZeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=waQsfoa3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id t7-20020a170902bc4700b001c76b4c349esi12297369plz.218.2023.11.22.06.27.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 06:27:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=waQsfoa3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 52156807F499; Wed, 22 Nov 2023 06:27:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231648AbjKVO1Q (ORCPT + 99 others); Wed, 22 Nov 2023 09:27:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231437AbjKVO1P (ORCPT ); Wed, 22 Nov 2023 09:27:15 -0500 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51F8718E for ; Wed, 22 Nov 2023 06:27:11 -0800 (PST) Received: by mail-yb1-xb2c.google.com with SMTP id 3f1490d57ef6-d9c66e70ebdso6275175276.2 for ; Wed, 22 Nov 2023 06:27:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700663230; x=1701268030; darn=vger.kernel.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=vEGlLD2Ow2lZAT02DeB30p2mlAQUUZVJgtqFw5LKgjM=; b=waQsfoa3gBnm8gcsRXLPVTjEGIoddM/SN4mFDkTksRedKjNR0YxDOxfEx0535gkuA0 eYqrxwD6LJ22JtYKxM2ZH6AoZj0tHAmbFllE+sFXcQy2sc0g+Nz9IWMWOIWbkW5tVisM E6Zrhwe+YokXqYngXYw6FqvnDztXb6IjWqMuGjEGndF3cn3iE1kFZgmlWrBSScE3ay4T OKeXW3/mWK3zbffuCQoRBdh9UYdTQW7AGU9/a2214zCep95U0gPI/9s03rmXhTOJGhiB qiQ54BLn6R66XJ9+vKqS7g/7wgkZvAI8rhfkti3At1nW/izoMdqidkEyrl8Qf+DpuJU/ bK8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700663230; x=1701268030; 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=vEGlLD2Ow2lZAT02DeB30p2mlAQUUZVJgtqFw5LKgjM=; b=Kg9PpqM2bm2RqGqCvise2UNyS1VmFPoANggGZzIPg8wLJvnN4FD7YQVlXZl8bbarln xYl0S8ECZKF2gb8IU1E+8zoFlofnkSodC+iyhOrdIMgKS26oz1rB719c4/rfki0neT8R N4zz3i67o6VXR6RsC3/p+vcp9uLP29EMlHzVg8SgRMdnPJJH4MTx9wazQwGf1L1OOvin QezAkQE3cE6gAqR4hRpGJIftU8rMDEBX3CaYbShjWze11Qw6zKl2iuIBK0QOE+VL5PGG vrkxwgkBL3Y+oqRCCEUXcXpwO70k1wqLWu9AFBN29F/YKlC6U86tMcnNzqxviUQNInnu hhXg== X-Gm-Message-State: AOJu0YzHjR1TAZXTneGJ3ncpkaz0Xp9KqeqF78+WoKr8kr76lHDXJQ8m AK1OyVfC6bUoip+p26FevUM3nL57kViMVLmaBn+VfA== X-Received: by 2002:a25:e20b:0:b0:d9a:51d7:2d1c with SMTP id h11-20020a25e20b000000b00d9a51d72d1cmr1990489ybe.45.1700663230453; Wed, 22 Nov 2023 06:27:10 -0800 (PST) MIME-Version: 1.0 References: <084b6088106da837abc43526c11d7d8bec850c5c.1700131353.git.viresh.kumar@linaro.org> In-Reply-To: <084b6088106da837abc43526c11d7d8bec850c5c.1700131353.git.viresh.kumar@linaro.org> From: Ulf Hansson Date: Wed, 22 Nov 2023 15:26:34 +0100 Message-ID: Subject: Re: [PATCH V3 3/3] OPP: Don't set OPP recursively for a parent genpd To: Viresh Kumar Cc: Stephan Gerhold , Viresh Kumar , Nishanth Menon , Stephen Boyd , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Konrad Dybcio , Manivannan Sadhasivam , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 22 Nov 2023 06:27:26 -0800 (PST) On Thu, 16 Nov 2023 at 11:43, Viresh Kumar wrote: > > Like other frameworks (clk, regulator, etc.) genpd core too takes care > of propagation to performance state to parent genpds. The OPP core > shouldn't attempt the same, or it may result in undefined behavior. > > Add checks at various places to take care of the same. > > Signed-off-by: Viresh Kumar I think this looks good to me, even if I think it's a bit tricky to consider the various scenarios. :-) Feel free to add: Reviewed-by: Ulf Hansson Kind regards Uffe > --- > drivers/opp/core.c | 16 +++++++++++++++- > drivers/opp/of.c | 7 +++++-- > 2 files changed, 20 insertions(+), 3 deletions(-) > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > index e08375ed50aa..4f1ca84d9ed0 100644 > --- a/drivers/opp/core.c > +++ b/drivers/opp/core.c > @@ -2392,6 +2392,12 @@ static int _opp_attach_genpd(struct opp_table *opp_table, struct device *dev, > return -EINVAL; > } > > + /* Genpd core takes care of propagation to parent genpd */ > + if (opp_table->is_genpd) { > + dev_err(dev, "%s: Operation not supported for genpds\n", __func__); > + return -EOPNOTSUPP; > + } > + > /* Checking only the first one is enough ? */ > if (opp_table->required_devs[0]) > return 0; > @@ -2453,8 +2459,16 @@ static int _opp_set_required_devs(struct opp_table *opp_table, > if (opp_table->required_devs[0]) > return 0; > > - for (i = 0; i < opp_table->required_opp_count; i++) > + for (i = 0; i < opp_table->required_opp_count; i++) { > + /* Genpd core takes care of propagation to parent genpd */ > + if (required_devs[i] && opp_table->is_genpd && > + opp_table->required_opp_tables[i]->is_genpd) { > + dev_err(dev, "%s: Operation not supported for genpds\n", __func__); > + return -EOPNOTSUPP; > + } > + > opp_table->required_devs[i] = required_devs[i]; > + } > > return 0; > } > diff --git a/drivers/opp/of.c b/drivers/opp/of.c > index 5a7e294e56b7..f9f0b22bccbb 100644 > --- a/drivers/opp/of.c > +++ b/drivers/opp/of.c > @@ -339,8 +339,11 @@ static int _link_required_opps(struct dev_pm_opp *opp, struct opp_table *opp_tab > */ > if (required_table->is_genpd && opp_table->required_opp_count == 1 && > !opp_table->required_devs[0]) { > - if (!WARN_ON(opp->level != OPP_LEVEL_UNSET)) > - opp->level = opp->required_opps[0]->level; > + /* Genpd core takes care of propagation to parent genpd */ > + if (!opp_table->is_genpd) { > + if (!WARN_ON(opp->level != OPP_LEVEL_UNSET)) > + opp->level = opp->required_opps[0]->level; > + } > } > > return 0; > -- > 2.31.1.272.g89b43f80a514 >