Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp22930rdb; Fri, 26 Jan 2024 17:03:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXFKOlgIyxlINCl/Fwi82rdcRmXQmIASR6DSC7neL+GBF90ZMTA+ZmtuWs71MgEdaSnH6d X-Received: by 2002:a17:90b:4b08:b0:294:634d:ab5f with SMTP id lx8-20020a17090b4b0800b00294634dab5fmr571891pjb.13.1706317397085; Fri, 26 Jan 2024 17:03:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706317397; cv=pass; d=google.com; s=arc-20160816; b=Ix8sguJUV33yU6sOTEf0oSEl00m9ev2q6pb7HRLY7A89Y596c7U0LpsFLAcaHKF9/2 2/ey5Z+7H5ytWD1pw7rywzICukURMTw2pSOScGe4CKUs4PSptvHCGLdMXCcAUoqoo0dU II8h0z2/7VIQ4Zbqw/piXQjWgtbk2imDvPeMb042prSAUOxkcPQHNdvt5O9HFzXALc2A dkCp79/CWxkhrCPxZxpn+RhBjjrtRWYSRS1UWgSrMlQksC//XhvO7EzLI9AF+3qh9lIb VqBOmqPir1nsnl2Ur+bBfea9r1xqMRxIm0dAJaO8iNj3VRD0n3WH3rD94hwzV/sfd8kc DbPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=vWcySjj6Okvs9yBn0W41qrIqSKP3wnCoOn0mL6uTY9k=; fh=bpLIxUkpBoF7SZXZxKxlTrr2TqlQoCRytV6+1J9pWkI=; b=uCf4WMjGzXqKMzwxg44wzNBgtZwM9g3INb6O/2ZSE7woNVeSW2ldgFtclPmHOiKisO doBAB3m3LlVB3ayV0+qXXkDiSAlCdvgLF6eLgQjV/MjibbtC6APgFdhienNCxAjMVBvL bK0FyNExqzryvK3zu/MhJ7jtduStp/iONQQAIkLO5lcug7gmT2Az8DXPuypk+Gdlx1xF QPuMvKE0S8r2AjG7ukjm+o+a/Xzk1abFZH7TEsBnJCQYty4EHmDzTiBQeBkjbTkFEh9k u+QBvsLVld41gSD5fg84qLMaCXmJLb+MhuIKVQ+Zs5lgnT3Q9+AmO+PQDR923VFAS3bM 6i1w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=g8rS4Tr6; arc=pass (i=1 spf=pass spfdomain=flex--davidai.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-40946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40946-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c8-20020a17090ad90800b0028e1791bcaasi1972740pjv.178.2024.01.26.17.03.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 17:03:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=g8rS4Tr6; arc=pass (i=1 spf=pass spfdomain=flex--davidai.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-40946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40946-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 85C5DB26741 for ; Sat, 27 Jan 2024 00:43:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC8145686; Sat, 27 Jan 2024 00:43:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="g8rS4Tr6" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31EE23C1C for ; Sat, 27 Jan 2024 00:43:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706316215; cv=none; b=Rl0iIQnM8mgY/Oj1SRilBmLvAipMqOKl3OJCcJiV9GTrnHFx0NeP3Pvc6MtGOXW5RAq1K5MQMFjHuCW6fEWm9UMOzviAeHqFzVnKvxcicP1SWe0jN7GcMD5G+US+aL6B5VqzroBQCuI8359yQin1wHQuDNnkRYAWYtUzEx9o1FY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706316215; c=relaxed/simple; bh=FLh37MtrGgxAZbOEtksVIMPeDxGh9lhShCJV0PP9zsA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=e7aIf/Y4IsjolX3GY6R2pPof3MhKIt0AaviBtbaqg7zjsho8kUJqIEXGhkRt3VQ2ZtbYeZ7iWSZC9yLebuufCq8dbNQ3CBl1E1KgsA+5nRpUCIsRCMbVU7bMqprR4TiPztuy70w7j3cBPw0rZUcvljd5lBKYXQ4+LpeRssEhpFo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--davidai.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=g8rS4Tr6; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--davidai.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-d9a541b720aso1713656276.0 for ; Fri, 26 Jan 2024 16:43:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706316213; x=1706921013; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=vWcySjj6Okvs9yBn0W41qrIqSKP3wnCoOn0mL6uTY9k=; b=g8rS4Tr6cxN0qQ6y2ez5wRpJwQe8CttNRVm8XTSa/Umc4aDOOTPUN7qfMQv6kGqeyF VcEK/H8W8zYzVMNsfCMOIwWgVA0mZrXu+hMIMYEuB2Ern+20nIfXgGBDtUCLCJJWkWMm 0RcnpUK/KTHP42JFjErPSzBILCte7CdafjxK+vZopc3e8HrWT/H/6bK6lTJ4QkXDffXh WD20W+vXe6KP0V8VhqiNlvEQgWxAsyZU/gesJvNKOXhOrtNJpzioM9vI1izRyZUlJgwM jX6hoANKrCMuaVTuCVy6xtWX70XBDOMdl5dKfi66YDcPTRU5NoPy2OwTXoQcxSEvzPkx J+eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706316213; x=1706921013; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vWcySjj6Okvs9yBn0W41qrIqSKP3wnCoOn0mL6uTY9k=; b=Hi46YwuTFcKEvDJwbV+G4rE889n9taBQIftspBO9++Rdu37DHItzuzCLjnP9HNd2b4 YEszhEdG2mF/IFKoSDtS0fseOtrypECWzUIGSNcdT96f5PAUUi6P/PwVQEZdbjpZE5is LgnU4gQX+IJEeN4Fhm+rOO+nCOlXYFBvRElcGyw6VyXBcTfRgS8cuofLOrdxrCXzuGxi x76cAlawBjurnycY/JH7xnH1X+f8RG2m3k+LGMPuYMBq8aaDFqgdccBzeav07j9uT8SS xzG97sfUsGuABnCXvBIuNZ/kICFmdo5aQ36Nlb58uyb83eFi06q9qXmqmh/o0k/3/+qN weLw== X-Gm-Message-State: AOJu0Yzg5k39TxrnSVvHfWa7w6Ny5ED2zSH7SRroC9KGY2tu6LwBhNMl zhI0HKqo1EkQr81lN5p3q9TU7biB+7wOn9dqC54/QdUe/rsgQGTc/bKybsMylABErNTZI4DIRdy FxflaHg== X-Received: from davidai2.mtv.corp.google.com ([2620:15c:211:201:d621:88fa:6f6:1b46]) (user=davidai job=sendgmr) by 2002:a05:6902:2489:b0:dc2:2d2c:962a with SMTP id ds9-20020a056902248900b00dc22d2c962amr348609ybb.8.1706316213251; Fri, 26 Jan 2024 16:43:33 -0800 (PST) Date: Fri, 26 Jan 2024 16:43:15 -0800 In-Reply-To: <20240127004321.1902477-1-davidai@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240127004321.1902477-1-davidai@google.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240127004321.1902477-2-davidai@google.com> Subject: [PATCH v5 1/2] dt-bindings: cpufreq: add virtual cpufreq device From: David Dai To: "Rafael J. Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sudeep Holla , David Dai , Saravana Kannan Cc: 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 Content-Type: text/plain; charset="UTF-8" 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. Performance points for a given domain can be normalized across all domains for ease of allowing for virtual machines to migrate between hosts. Co-developed-by: Saravana Kannan Signed-off-by: Saravana Kannan Signed-off-by: David Dai --- .../cpufreq/qemu,cpufreq-virtual.yaml | 110 ++++++++++++++++++ 1 file changed, 110 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..cd617baf75e7 --- /dev/null +++ b/Documentation/devicetree/bindings/cpufreq/qemu,cpufreq-virtual.yaml @@ -0,0 +1,110 @@ +# 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. + +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 + contiguously and contain registers for controlling DVFS(Dynamic Frequency + and Voltage) characteristics. The size of the region is proportional to + total number of frequency domains. This device also needs the CPUs to + list their OPPs using operating-points-v2 tables. The OPP tables for the + CPUs should use normalized "frequency" values where the OPP with the + highest performance among all the vCPUs is listed as 1024 KHz. The rest + of the frequencies of all the vCPUs should be normalized based on their + performance relative to that 1024 KHz OPP. This makes it much easier to + migrate the VM across systems which might have different physical CPU + OPPs. + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + // This example shows a two CPU configuration with a frequency domain + // for each CPU showing normalized performance points. + 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"; + + opp64000 { opp-hz = /bits/ 64 <64000>; }; + opp128000 { opp-hz = /bits/ 64 <128000>; }; + opp192000 { opp-hz = /bits/ 64 <192000>; }; + opp256000 { opp-hz = /bits/ 64 <256000>; }; + opp320000 { opp-hz = /bits/ 64 <320000>; }; + opp384000 { opp-hz = /bits/ 64 <384000>; }; + opp425000 { opp-hz = /bits/ 64 <425000>; }; + }; + + opp_table1: opp-table-1 { + compatible = "operating-points-v2"; + + opp64000 { opp-hz = /bits/ 64 <64000>; }; + opp128000 { opp-hz = /bits/ 64 <128000>; }; + opp192000 { opp-hz = /bits/ 64 <192000>; }; + opp256000 { opp-hz = /bits/ 64 <256000>; }; + opp320000 { opp-hz = /bits/ 64 <320000>; }; + opp384000 { opp-hz = /bits/ 64 <384000>; }; + opp448000 { opp-hz = /bits/ 64 <448000>; }; + opp512000 { opp-hz = /bits/ 64 <512000>; }; + opp576000 { opp-hz = /bits/ 64 <576000>; }; + opp640000 { opp-hz = /bits/ 64 <640000>; }; + opp704000 { opp-hz = /bits/ 64 <704000>; }; + opp768000 { opp-hz = /bits/ 64 <768000>; }; + opp832000 { opp-hz = /bits/ 64 <832000>; }; + opp896000 { opp-hz = /bits/ 64 <896000>; }; + opp960000 { opp-hz = /bits/ 64 <960000>; }; + opp1024000 { opp-hz = /bits/ 64 <1024000>; }; + + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + + cpufreq@1040000 { + compatible = "qemu,virtual-cpufreq"; + reg = <0x1040000 0x10>; + }; + }; -- 2.43.0.429.g432eaa2c6b-goog