devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: David Dai <davidai@google.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Saravana Kannan <saravanak@google.com>
Cc: Quentin Perret <qperret@google.com>,
	Masami Hiramatsu <mhiramat@google.com>,
	Will Deacon <will@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Marc Zyngier <maz@kernel.org>,
	Oliver Upton <oliver.upton@linux.dev>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Pavan Kondeti <quic_pkondeti@quicinc.com>,
	Gupta Pankaj <pankaj.gupta@amd.com>, Mel Gorman <mgorman@suse.de>,
	kernel-team@android.com, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] dt-bindings: cpufreq: add bindings for virtual cpufreq
Date: Sat, 5 Aug 2023 21:38:34 +0200	[thread overview]
Message-ID: <ceddbbfb-a178-2b7e-ea17-0a37f33224ab@linaro.org> (raw)
In-Reply-To: <20230731174613.4133167-2-davidai@google.com>

On 31/07/2023 19:46, David Dai wrote:
> Adding bindings to represent a virtual cpufreq device.
> 
> Virtual machines may expose MMIO regions for a virtual cpufreq device for
> guests to read frequency information or to request frequency selection. The
> virtual cpufreq device has an individual controller for each CPU.

A nit, subject: drop second/last, redundant "bindings for". The
"dt-bindings" prefix is already stating that these are bindings.

> 
> Co-developed-by: Saravana Kannan <saravanak@google.com>
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> Signed-off-by: David Dai <davidai@google.com>
> ---
>  .../bindings/cpufreq/cpufreq-virtual.yaml     | 89 +++++++++++++++++++
>  1 file changed, 89 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/cpufreq/cpufreq-virtual.yaml
> 
> diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-virtual.yaml b/Documentation/devicetree/bindings/cpufreq/cpufreq-virtual.yaml
> new file mode 100644
> index 000000000000..f377cfc972ca
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-virtual.yaml
> @@ -0,0 +1,89 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/cpufreq/cpufreq-virtual.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yamll#
> +
> +title: Virtual CPUFreq
> +
> +maintainers:
> +  - David Dai <davidai@google.com>
> +  - Saravana Kannan <saravanak@google.com>
> +
> +description:
> +  Virtual CPUFreq is a virtualized driver in guest kernels that sends frequency
> +  selection of its vCPUs as a hint to the host through MMIO regions. The host
> +  uses the hint to schedule vCPU threads and select physical CPU frequency. It
> +  enables accurate Per-Entity Load Tracking for tasks running in the guest by
> +  querying host CPU frequency unless a virtualized FIE (ex. AMU) exists.

Why do you need DT for this? You control hypervisor, thus control the
interface to the guest. I think Rob made it pretty clear that
discoverable usecases (which is yours) are not for DT.

Incomplete style-review follows:

> +
> +properties:
> +  compatible:
> +    const: virtual,cpufreq

Missing blank line.

> +  reg:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    cpus {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      cpu@0 {
> +        compatible = "arm,arm-v8";
> +        device_type = "cpu";
> +        reg = <0x0>;
> +        operating-points-v2 = <&opp_table0>;
> +      };
> +
> +      cpu@1 {
> +        compatible = "arm,arm-v8";
> +        device_type = "cpu";
> +        reg = <0x0>;
> +        operating-points-v2 = <&opp_table1>;
> +      };
> +    };
> +
> +    opp_table0: opp-table-0 {
> +      compatible = "operating-points-v2";
> +
> +      opp1098000000 {
> +        opp-hz = /bits/ 64 <1098000000>;
> +        opp-level = <1>;
> +      };
> +
> +      opp1197000000 {
> +        opp-hz = /bits/ 64 <1197000000>;
> +        opp-level = <2>;
> +      };
> +    };
> +
> +    opp_table1: opp-table-1 {
> +      compatible = "operating-points-v2";
> +
> +      opp1106000000 {
> +        opp-hz = /bits/ 64 <1106000000>;
> +        opp-level = <1>;
> +      };
> +
> +      opp1277000000 {
> +        opp-hz = /bits/ 64 <1277000000>;
> +        opp-level = <2>;
> +      };
> +    };
> +
> +    soc {
> +      #address-cells = <1>;
> +      #size-cells = <1>;
> +
> +      cpufreq {

Missing unit address

> +        reg = <0x1040000 0x10>;
> +        compatible = "virtual,cpufreq";

compatible is always the first property.

Also, you did not test it...


Best regards,
Krzysztof


  parent reply	other threads:[~2023-08-05 19:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31 17:46 [PATCH v3 0/2] Improve VM CPUfreq and task placement behavior David Dai
2023-07-31 17:46 ` [PATCH v3 1/2] dt-bindings: cpufreq: add bindings for virtual cpufreq David Dai
2023-07-31 18:12   ` Rob Herring
2023-08-05 19:38   ` Krzysztof Kozlowski [this message]
2023-08-08 23:31     ` Saravana Kannan
2023-08-09  6:28       ` Krzysztof Kozlowski
2023-07-31 17:46 ` [PATCH v3 2/2] cpufreq: add virtual-cpufreq driver David Dai
2023-07-31 22:02   ` Randy Dunlap
2023-07-31 23:46     ` David Dai
2023-08-01  9:36   ` Viresh Kumar
2023-08-02 22:16     ` Saravana Kannan
2023-08-03  5:51       ` Viresh Kumar
2023-08-04 22:24         ` Saravana Kannan
2023-08-03 16:50     ` David Dai
2023-08-04  4:42       ` Viresh Kumar
2023-08-01  9:45   ` Quentin Perret
2023-08-01  9:49     ` Quentin Perret
2023-08-04 22:23     ` Saravana Kannan
2023-08-03  4:18   ` Pavan Kondeti
2023-08-04 23:46     ` David Dai
2023-08-07  3:22       ` Pavan Kondeti
2023-08-24 23:55         ` David Dai
2023-08-12  2:55   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ceddbbfb-a178-2b7e-ea17-0a37f33224ab@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=davidai@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=kernel-team@android.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=mgorman@suse.de \
    --cc=mhiramat@google.com \
    --cc=oliver.upton@linux.dev \
    --cc=pankaj.gupta@amd.com \
    --cc=peterz@infradead.org \
    --cc=qperret@google.com \
    --cc=quic_pkondeti@quicinc.com \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=saravanak@google.com \
    --cc=sudeep.holla@arm.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).