Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2310143rdb; Fri, 8 Dec 2023 04:47:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMRh7HBtwBtYh9lXE+SsOqwI3hGpFim4rXNs7ztzBPPs+GZcEb7jSO5Z0VJmQ7WuQrYhCJ X-Received: by 2002:a05:6e02:1a6f:b0:35d:59a2:a328 with SMTP id w15-20020a056e021a6f00b0035d59a2a328mr85393ilv.42.1702039651758; Fri, 08 Dec 2023 04:47:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702039651; cv=none; d=google.com; s=arc-20160816; b=SfX4PqkOB/0WYpOS/HyBR9dWpsPBpPS8DaMIigEeSRsEA4FNXRfIeeadb03tpPJlX5 48LogAVW/OcsICqhlpSO38GXpVcy/wQMGj5UWC8DVM1cskKVkAeCuXupRuShnzqe+JPp N/P0ikIzd+QCB+9qNtQ+B3ygIElaFgIgT+hYY82ThYVJVBoUZx7VlKxFA0i1+oFdPVff QvvZsFNyINKVEgMe6YHNU6cTagZtF1s/RBUA1hojYysoE0R4BEkI1mqCKICurt76rnLk hK38NspWuJvWTk74X0uLyYeC5/3UCrYjbJ5W74kAxHW76dwSC7yuav5ynkEsRKnorQO/ u7Ow== 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; bh=m0owO3GEsLwrdaOlnbA8/FZssEh948yovigjZoBT5mA=; fh=r3V3AuEI5yvrt/TiNtgzkMQO6Ij1KaTdQPHCGypdBFw=; b=vYpdaeihGKNkSdkauwMNk1MPIrCNfGXa+8t6iLGQSTDFtOS6wMkvcIZSSt0l+DPbiy HYhRhVxLVPnDawrzhKc6e6FPHu5GAzFAs8uQyvShJS8sxj5Wl7+ZIfWKSyCNMzB+v/eN flHbi5yILBYlp7S1WsgVpS35g10oFwUa+tCX1I9mnkwAAge2n8OlJTbP3z1Haka98Ojf ub1q0OkAaOUkmbieAict/2YQHS6CJpjmc5cFP/r8VvBfJhiSqFQMk3e9GbnVHxFNVaA+ iunIR2QOliDl+YU+A0Uo++Hx0/5wVilgtjZ1hUa7hNeoqqjGYNRpj5Sh/n5/oDwGb2Yz 36VA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id a22-20020a656416000000b005b3d703ca05si1530616pgv.780.2023.12.08.04.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 04:47:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id EBCE780FCE52; Fri, 8 Dec 2023 04:47:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233460AbjLHMrG (ORCPT + 99 others); Fri, 8 Dec 2023 07:47:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233520AbjLHMrE (ORCPT ); Fri, 8 Dec 2023 07:47:04 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2B8BE1997; Fri, 8 Dec 2023 04:47:09 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5DE6D1063; Fri, 8 Dec 2023 04:47:54 -0800 (PST) Received: from bogus (unknown [10.57.42.162]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B4BCE3F762; Fri, 8 Dec 2023 04:47:04 -0800 (PST) Date: Fri, 8 Dec 2023 12:45:03 +0000 From: Sudeep Holla To: David Dai Cc: "Rafael J. Wysocki" , Sudeep Holla , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Saravana Kannan , Quentin Perret , Masami Hiramatsu , Will Deacon , Peter Zijlstra , Vincent Guittot , Marc Zyngier , Oliver Upton , Dietmar Eggemann , Pavan Kondeti , Gupta Pankaj , Mel Gorman , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 1/2] dt-bindings: cpufreq: add virtual cpufreq device Message-ID: <20231208124503.unhka7c6ihzrrwhu@bogus> References: <20231111014933.1934562-1-davidai@google.com> <20231111014933.1934562-2-davidai@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231111014933.1934562-2-davidai@google.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=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 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, 08 Dec 2023 04:47:29 -0800 (PST) On Fri, Nov 10, 2023 at 05:49:29PM -0800, 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 frequency domain. > > Co-developed-by: Saravana Kannan > Signed-off-by: Saravana Kannan > Signed-off-by: David Dai > --- > .../cpufreq/qemu,cpufreq-virtual.yaml | 99 +++++++++++++++++++ > 1 file changed, 99 insertions(+) > create mode 100644 Documentation/devicetree/bindings/cpufreq/qemu,cpufreq-virtual.yaml > > diff --git a/Documentation/devicetree/bindings/cpufreq/qemu,cpufreq-virtual.yaml b/Documentation/devicetree/bindings/cpufreq/qemu,cpufreq-virtual.yaml > new file mode 100644 > index 000000000000..16606cf1fd1a > --- /dev/null > +++ b/Documentation/devicetree/bindings/cpufreq/qemu,cpufreq-virtual.yaml > @@ -0,0 +1,99 @@ > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/cpufreq/qemu,cpufreq-virtual.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Virtual CPUFreq > + > +maintainers: > + - David Dai > + - Saravana Kannan > + > +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. Each vCPU > + is associated with a frequency domain which can be shared with other vCPUs. > + Each frequency domain has its own set of registers for frequency controls. > + Are these register controls described somewhere ? The reason I ask is we should be able to have single implementation of this virtual cpufreq irrespective of the firmware used(DT vs ACPI) IMO. > +properties: > + compatible: > + const: qemu,virtual-cpufreq > + > + reg: > + maxItems: 1 > + description: > + Address and size of region containing frequency controls for each of the > + frequency domains. Regions for each frequency domain is placed > + contiugously and contain registers for controlling DVFS(Dynamic Frequency > + and Voltage) characteristics. The size of the region is proportional to > + total number of frequency domains. > + > +required: > + - compatible > + - reg > + > +additionalProperties: false > + > +examples: > + - | > + // This example shows a two CPU configuration with a frequency domain > + // for each CPU. > + cpus { > + #address-cells = <1>; > + #size-cells = <0>; > + > + cpu@0 { > + compatible = "arm,armv8"; > + device_type = "cpu"; > + reg = <0x0>; > + operating-points-v2 = <&opp_table0>; > + }; > + > + cpu@1 { > + compatible = "arm,armv8"; > + device_type = "cpu"; > + reg = <0x0>; > + operating-points-v2 = <&opp_table1>; > + }; > + }; > + > + opp_table0: opp-table-0 { > + compatible = "operating-points-v2"; > + opp-shared; > + > + 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"; > + opp-shared; > + > + opp1106000000 { > + opp-hz = /bits/ 64 <1106000000>; > + opp-level = <1>; > + }; > + > + opp1277000000 { > + opp-hz = /bits/ 64 <1277000000>; > + opp-level = <2>; > + }; > + }; > I think using OPP with absolute frequencies seems not appropriate here. Why can't these fetched from the registers and have some abstract values instead ? > + soc { > + #address-cells = <1>; > + #size-cells = <1>; > + > + cpufreq@1040000 { > + compatible = "qemu,virtual-cpufreq"; > + reg = <0x1040000 0x10>; So just 16bytes for 2 CPU system ? How does the register layout look like ? I assume just 4 x 32bit registers: 2 for reading and 2 for setting the frequencies ? -- Regards, Sudeep