Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp906644rdb; Fri, 20 Oct 2023 03:03:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIT54FDbBPCkg0kdPM7cxA3KM3ZCj2eAJubvpy+6InSTlNl7WpUTqZZ1UF29UyY8pHbdj9 X-Received: by 2002:a05:6a21:7182:b0:174:af85:91fc with SMTP id wq2-20020a056a21718200b00174af8591fcmr1300948pzb.48.1697796186210; Fri, 20 Oct 2023 03:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697796186; cv=none; d=google.com; s=arc-20160816; b=q1PygGusdFzkbN3nUfZsIrp5Zzf895iWr3bJjP044jCGnT6vxsCOxl3aDIKhLIzXlP GkhKwFrOOe51r/8HQitTP4x40my0VaWJXmUgdgR3K2wnE4ZMdKOAxWuJlnsJQc8+y7cF vnuxJwFJm0ncNE/9NO9+/fSotWO4XAbQisnwsJ39+bJaTHBL3wsB8aatmj48R/sBGxyI eqHKgzvulJ0ar35cbySMxNkpQc/per8bMZgCurPj+/teFGZl7erzmmRJB3Kfc74aZENG YUkor8W5amVQUpaK75oEYL6/+TSTG4cmHqjhAzmlhFzcFLzsb+Ym3KXk7Fp7TWUnO9Oc f+eA== 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=+mL5MxDvI3oBEsamV1IpDNv4PqsfIio+p7+hVRLdZkE=; fh=zJJRk5+BZN/TWwsTxHGhtfo1q7KKcftHMHW7XAPRPOQ=; b=O0kfIElV8PJAybpcsDda1+0niY0qimWzk2AbGPzj1uWA44SjdvXyyM/fH+lZQcbPG3 rRygDWG8HZWhaKea9ZAvXm2+fsvLa+jpFH5/n2+e9lGLiFqtqZMsxIPoT+ksOcxQ/TZP aFs5+9r05dipkZQwc1dOYEQeGx8L93PeTvVBdK2U9BHe3P6ieKqnVNrZu+vMjTRPUusi DMT6n52WuifEgXmdJrlbT7gB5NGmC4dV5D66VO/BghMICrl431eQWxXsY7Ai6tFFnsM+ 8sXPZ0F8pwhM2dY5xdwCbGnuAmTqLq/bVazuRMxbI2CgmPXULeq+N4HjLYQBlqpcMGa0 IjYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UYOoQ476; 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 cm5-20020a17090afa0500b002792c288cb7si4126460pjb.131.2023.10.20.03.03.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 03:03:06 -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=UYOoQ476; 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 9C24182ABABC; Fri, 20 Oct 2023 03:03:02 -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 S1376826AbjJTKCt (ORCPT + 99 others); Fri, 20 Oct 2023 06:02:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376648AbjJTKCs (ORCPT ); Fri, 20 Oct 2023 06:02:48 -0400 Received: from mail-yw1-x1135.google.com (mail-yw1-x1135.google.com [IPv6:2607:f8b0:4864:20::1135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C0F4D5F for ; Fri, 20 Oct 2023 03:02:46 -0700 (PDT) Received: by mail-yw1-x1135.google.com with SMTP id 00721157ae682-5a7b3d33663so6795847b3.3 for ; Fri, 20 Oct 2023 03:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697796165; x=1698400965; 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=+mL5MxDvI3oBEsamV1IpDNv4PqsfIio+p7+hVRLdZkE=; b=UYOoQ476ce/PtnDV75b1LiSRuur+1fpqjQceUCtjSOlMkzFBsjK31/Wm68h1KQX9Vt TAyQMJ5CbB7jFqIt3HwaoKGtdSYdMBvMDLENKXYJMnhiCCiCF8BnMFerKesrhgEfXAXL jAs7uTrjAka2vz4YSB1NqZOtnNJxVinhZeNax1L+nnuzsHSTnaUaS96q2ZGXlqbY3VnT HRFdswTGQBhpqJVAB3ACJKSD+iBYYVh7SFCYzveBTNyaSYj4kVhv7VtcXEjG9bMlAfSv 54JLpBzA1DePGSffUGUQosx/6ytmOdtd29KJhGBA2GeQgkpTe6pcQbUt52bk7S4GMrSS 6eFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697796165; x=1698400965; 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=+mL5MxDvI3oBEsamV1IpDNv4PqsfIio+p7+hVRLdZkE=; b=IIHxV/M7AjiN+m9xSpg54T5J4dLDqlIpurTXQZJ6vSOFGInsfEi7uF1usGF0ZnADuQ 6ov9NthS1cbgngxrEuyNf6hDUp4jopYZ1ryUCFHJuO/AKK+8Te3g4ZTZX7AW9dW3iSMp 6hScK8SfdI/ShNjQ0NzDswHR4PFTTJ6JkGbGAH0ucPb4LrjOFXikqY5nv6teLQxuk/0k K7kmYwpjJTGRGqzZMseJT0xRjiZdM4yosmWnG8ZYB6T/nZmYtJalXkwDmpcSsgqs8UJY uVc1nVyYr61CKS8qoWFzEl1OD71UXHK8Z+TK5mJniey/O2udktFXxr3l50KA1vo7/Rtq Xxtg== X-Gm-Message-State: AOJu0YycqLMRJYe37Xn6ZfpV6ZZewVMfcr8V9kZmQt2kv24N7MfNWJwt poOdNksxsFcYBOljW7x6J4Ucw21jfjMZEIQdvEYWHg== X-Received: by 2002:a5b:608:0:b0:d9a:e947:447b with SMTP id d8-20020a5b0608000000b00d9ae947447bmr1325314ybq.14.1697796165580; Fri, 20 Oct 2023 03:02:45 -0700 (PDT) MIME-Version: 1.0 References: <20231020034547.suggwoefx5kauek4@vireshk-i7> In-Reply-To: <20231020034547.suggwoefx5kauek4@vireshk-i7> From: Ulf Hansson Date: Fri, 20 Oct 2023 12:02:08 +0200 Message-ID: Subject: Re: [PATCH 1/2] OPP: Use _set_opp_level() for single genpd case To: Viresh Kumar 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 Content-Type: text/plain; charset="UTF-8" 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]); Fri, 20 Oct 2023 03:03:02 -0700 (PDT) On Fri, 20 Oct 2023 at 05:45, Viresh Kumar wrote: > > On 19-10-23, 13:16, Ulf Hansson wrote: > > On Thu, 19 Oct 2023 at 12:22, Viresh Kumar wrote: > > > + /* > > > + * 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? > > Such platforms need to call dev_pm_opp_set_config() with genpd names > and it should all work just fine. The point is that we can't use the > same `dev` pointer with another OPP table, i.e. device's dev pointer > for the genpd's table here. For the single PM domain case, consumer drivers are often not able to use dev_pm_opp_set_config(). That's because the PM domain has already been attached from some of the generic buses, through dev_pm_domain_attach(). In this case, as dev_pm_opp_set_config() ends up trying to attach again, via dev_pm_domain_attach_by_name() it would receive "ERR_PTR(-EEXIST)". Or maybe I didn't quite understand your point? Kind regards Uffe