Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2366147rda; Tue, 24 Oct 2023 23:56:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzYVOX3PiyWDnk1/vD6QTuYfkEdBkpeWBo85zAo/O8wZT5yxz30Lrwr5Z1Zg+K1ZP8BO9i X-Received: by 2002:a25:ae67:0:b0:d9a:c7af:bb4d with SMTP id g39-20020a25ae67000000b00d9ac7afbb4dmr13124847ybe.37.1698216961694; Tue, 24 Oct 2023 23:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698216961; cv=none; d=google.com; s=arc-20160816; b=HXLm7uIopkmjeSMnTg6DIllbqbM1K+n+coWhlm6ZtDloKip2ir1OCV21VnKHlohmeZ wCxSG6h5p12qdRWwbOGUgMuXjVuyxB2sjxDhcOEzgZIx1pz2wfSnnRwnya3pv6PATWHz TxexS6Rbpwaakx2sS8IRd/sO19q4s9UGG3xLzGYrtvAdJ9EovI7av0mtp4iN259+Daeu G+pP5ci9hczpl8zpPtLziiEdPteT1qKENohKu1kfng537+yqTRB8E00Qi2NfIc+UiHam NyZHq/66RFesXOGvaxhUDKeIz1ExNZ8he2MdCHbyvwy0Wb7S0mI+80J+nr3z2e5S3Nzr KkLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Y5dui3OIhxBVatDTTZ5Hf8HfCYDRD2Zxo6QlZVP8Vrc=; fh=5XTnUzlQXsGVkho5v3w8+4MESdUzxSMTWxIXgidQgXg=; b=ZE1AMkCQkGOjBtaEX3h9sno3cPLNCaYSBSp4wP7KzsTvYo/brfgry3b5sKJqPykhIG EJA8XMN2yV8GiI95PgdcVLtao2oedbo8yUqq4dNoieHTOURK9dV1EXG3KOleNRFxYNCw lgsEFNhdvBDdDUHYgzJwZ3vkxso6Ohw1akpbp7Ae2AH4go+Uh4nRF171tmRKnxsY+I8g /fS+q7Il1Wti8PpbJ+ek3h3elUmfEBY7B9t1yRT9ORbHoJzoiCjjUJhdnqga1vLG2n4c G7xfHUFgpB6WmNfXw3xdNOC+AA1O3hxaG5KTXud/brZDqhRpXgg6TQWSgGU9NcG9i2WM s5Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yEoBY53H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id x81-20020a25e054000000b00d4bd2351e00si10485391ybg.389.2023.10.24.23.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 23:56:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yEoBY53H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 4757C8076143; Tue, 24 Oct 2023 23:55:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbjJYGzF (ORCPT + 99 others); Wed, 25 Oct 2023 02:55:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230009AbjJYGzE (ORCPT ); Wed, 25 Oct 2023 02:55:04 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25288E5 for ; Tue, 24 Oct 2023 23:55:02 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6bee11456baso4394335b3a.1 for ; Tue, 24 Oct 2023 23:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698216901; x=1698821701; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Y5dui3OIhxBVatDTTZ5Hf8HfCYDRD2Zxo6QlZVP8Vrc=; b=yEoBY53H3+Qmi34C06XUKBnG3Ce6w3dfnKGolkF35zhFPnbtaszryWtfJFO7qHPwvT irOjyc98eskUXHpoCoNm2ot/8va0oeRdr0gP4mqkb/FTdL2BjfepjQ9RDp8Sz9Tqh7X+ l33eGhFTNlfA8YGxwRsn2FKySpRgTKIqfyAUarY8qUBg4B0AtvOgS7kvWV8VBP6an5iW rqGKpz9+ZvSyDxagdodptuTwhzwO2/Y1wz6kO0m60vqqgVElP2vlZWEmpPO8lp9yBOj3 I2zpBXr013xzha6XimQrN+WNLnH1y4iQvccevdaLHJE2/UCTDFX1YnVPtL+AIaCoIpPs drbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698216901; x=1698821701; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Y5dui3OIhxBVatDTTZ5Hf8HfCYDRD2Zxo6QlZVP8Vrc=; b=UqOPrlFBGUCUNRJVEqpKqTPGJPfg4RBwpxe56YTrG5Lr156HjUwMkhjXki8O0fKYko hk1AEY7NRjbhmQ+Prs5Mw8egblOHeMpZLZG3bOtMvq2yyxX08XkAJ75gz/r//kGrxyA1 LN0jiFJ1DgJhIzlGSa3wypATaGijDjnER0bNLF4uoG1+y6MsZJL6v5q47RT1IuCBr+IY Mbu6Mc2t60z3er27cPOain4u2YbVPkPfcE9zy8dzWnkpWDtw2HhlRkuebX0/RNX9INcX ypoSJfXTT64Yxx8eCPKU6zBoj4UJPhZPHZy6u5LQX0epd/Xn3nh25Jtb0dTSDYgnULix 4cqw== X-Gm-Message-State: AOJu0Yx37Zr8QEEEjgkqYVIHn9xK5TOLR5MllwBTE7TnjECnsTWJsRWy xNOJCGobnOQy+uilreNMIyXkUQ== X-Received: by 2002:a05:6a00:1389:b0:68f:d35d:217e with SMTP id t9-20020a056a00138900b0068fd35d217emr13140695pfg.2.1698216901494; Tue, 24 Oct 2023 23:55:01 -0700 (PDT) Received: from localhost ([122.172.80.14]) by smtp.gmail.com with ESMTPSA id o67-20020a634146000000b005742092c211sm8119201pga.64.2023.10.24.23.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 23:55:00 -0700 (PDT) Date: Wed, 25 Oct 2023 12:24:58 +0530 From: Viresh Kumar To: Ulf Hansson Cc: Viresh Kumar , Nishanth Menon , Stephen Boyd , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephan Gerhold , Konrad Dybcio , Manivannan Sadhasivam , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] OPP: Use _set_opp_level() for single genpd case Message-ID: <20231025065458.z3klmhahrcqh6qyw@vireshk-i7> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 24 Oct 2023 23:55:17 -0700 (PDT) On 19-10-23, 13:16, Ulf Hansson wrote: > On Thu, 19 Oct 2023 at 12:22, Viresh Kumar wrote: > > +static int _link_required_opps(struct dev_pm_opp *opp, struct opp_table *opp_table, > > struct opp_table *required_table, int index) > > { > > struct device_node *np; > > @@ -314,6 +314,25 @@ static int _link_required_opps(struct dev_pm_opp *opp, > > return -ENODEV; > > } > > > > + /* > > + * There are two genpd (as required-opp) cases that we need to handle, > > + * devices with a single genpd and ones with multiple genpds. > > + * > > + * The single genpd case requires special handling as we need to use the > > + * same `dev` structure (instead of a virtual one provided by genpd > > + * core) for setting the performance state. Lets treat this as a case > > + * where the OPP's level is directly available without required genpd > > + * link in the DT. > > + * > > + * Just update the `level` with the right value, which > > + * dev_pm_opp_set_opp() will take care of in the normal path itself. > > + */ > > + if (required_table->is_genpd && opp_table->required_opp_count == 1 && > > + !opp_table->genpd_virt_devs) { > > + if (!WARN_ON(opp->level)) > > Hmm. Doesn't this introduce an unnecessary limitation? > > An opp node that has a required-opps phande, may have "opp-hz", > "opp-microvolt", etc. Why would we not allow the "opp-level" to be > used too? Coming back to this, why would we ever want a device to have "opp-level" and "required-opp" (set to genpd's table) ? That would mean we will call: dev_pm_domain_set_performance_state() twice to set different level values. And so it should be safe to force that if required-opp table is set to a genpd, then opp-level shouldn't be set. Maybe we should fail in that case, which isn't happening currently. -- viresh