Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1850866rdb; Wed, 31 Jan 2024 10:58:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/afnzk9Hmzduugo40bonkqyfLH4F8iC2+Gc1rNNcwpffO00MDZfEJjjTugpw4kH4cDZoT X-Received: by 2002:a05:6a20:3194:b0:19b:42ea:314f with SMTP id x20-20020a056a20319400b0019b42ea314fmr2601611pza.16.1706727499789; Wed, 31 Jan 2024 10:58:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706727499; cv=pass; d=google.com; s=arc-20160816; b=I08kaal0w/Cx9v2MySQY0RTFbDS41z+iqkNE0MwuCZQaocJFRwQnlAQs10ZDgr5hFm GmmUnHoueeEg9F+jnHZSoz5hmqt1ZEimLKBg0O4AgWKg+8dgzYyVbn9dy5C3N3d38uiO RLlC5YETIWRy5GqWMpsoUYW7i/qymSo4MrbSV9HEEc2/flHYI+UB1zzFNTcXq8oAKz4/ QpPM0u96acyl22+kxQvJNScoOTqECgPZcTUbcexYJJ/E+tD7Qx7F1vHnM9TJy4tZwoc1 haJNRrc7Lnbup0JEM3xVXqzxyzojDf1zlOMxkD//5ruwDfE/MZvPF04gGTv0D/TT8MLf B2Kw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=viHzef10mQ/Ow5P/nhdwkaiORLJDs/5vxR6NgT9S6MQ=; fh=ZkWKplWOHyCp4bHh/oSKqDd2AgjoUdM8OlKM/NpdMiE=; b=guN6ccG9iX/5kEJf9PFP3y4RH/qg1rf2a0aOvVo72t08kF9n00E1QsGBjECUsFK47P 2chn0rOJMa0fdcY7NKoNQjstuJS5j08HZN6kZ0UQavEtM+orUuGvh4O2PNnGdm/jdkaJ Et7fC+oLeueja7lP3GKu9ZzNB5s1ZYHIzmujiEMCLcQWa9k34Fc0HKoSnJiRef3YIx+G AY3l0ilFMC7/K0eQcUk2JZDLPJrYxgi6SIocJFK8af74BR1Lv2dDlq6d6jFp1pnbGpIx E44gWz48424m65Gk+zA+umD7lpY9Ti2LzdrBCD4besdG9llatTjpT8+eW1v+eS+stjIg wyGA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=WRCR0Nvr; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-46966-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46966-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=1; AJvYcCX5eJEXnvRueqedMM50LIivYDB3q/5sJIfusBJBAoYroVBKYe7E4Gp7eHNlRK4UfgYWTbHClrAwSSXCKHNsT/L/cqm9AExcA6n1dnYgNg== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t14-20020a62d14e000000b006dbe1b70210si10125220pfl.176.2024.01.31.10.58.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 10:58:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46966-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=WRCR0Nvr; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-46966-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46966-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 A5305B2930C for ; Wed, 31 Jan 2024 18:23:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A02213342C; Wed, 31 Jan 2024 18:23:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="WRCR0Nvr" Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 6E0F412DD88 for ; Wed, 31 Jan 2024 18:23:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706725428; cv=none; b=eXF4QBurO198wvEGOZ/PZtXXRN0TF/+x5SKBPxDCGbhS35oPP9l+Xdv65aQGbalKG1N9T97XbhHzebDXB3J67JHriE7YKCvICTNqeZMEh4xRJ+VHQcQ9ywCuJwxLqZe9WqI0XkKWJzbWfxiQRbkc3RMNidPxiaSfxe8KPa+NaeI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706725428; c=relaxed/simple; bh=4HCr47Vl9ejjJTGVqxYRuHlMCbACMsJs01W7MS7B4yE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=o4VG2X9dfSGvVX5GrXJkGKt7K2E1FJviPrKVVJt6BvUyIfT0NFwYzwkR2P9CHcd6w4GM/hgfWBrnwPYlrglooOE9NzeqkAWirOXzUzN1s4LifFotArVwrHrZOEdH/9p/5dNNjmYbWaDr/A0+JeibkdLyG0yDumRya34jSuGjCS0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=WRCR0Nvr; arc=none smtp.client-ip=209.85.208.54 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=google.com Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-55f5d62d024so430a12.1 for ; Wed, 31 Jan 2024 10:23:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706725424; x=1707330224; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=viHzef10mQ/Ow5P/nhdwkaiORLJDs/5vxR6NgT9S6MQ=; b=WRCR0Nvr4E4SFem8QNCrcx00+V9bOor0i69r/PruSbY0rt2Nt80CVas+q5pc77uUPX ttGuKn6VbgR4iLUpDR5DbZJmHHR+9myJ+WMvIbDZnFk7GRJzbLV5dXrzzjX9pHBMaabr gykprDCMHpxFsHpv9md5ca2IVvaDwrmwmj63zKN1HkhF2TD4L+GA9h91uTenlraQUku7 57MLY1IgvfEJLoucdqlxA/M1fNqYPuZLc2CPg02yOFVlIS00sbO+J9f+3GbFBMf382td 3g0io/0WkhwESio+oqPjBJkWDhSDhXXmv25DFzM+pnK6sJefXxbQ/lR8LPlm4ZssCo3A 9tpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706725424; x=1707330224; h=content-transfer-encoding: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=viHzef10mQ/Ow5P/nhdwkaiORLJDs/5vxR6NgT9S6MQ=; b=LMOe808SdyfBvtWyf1MPy09cUEwpyVURUBXXYi0ICH2iPOnc5meeCVhc9Rv2UVH9Ly YeAAsyNskl2h9wKOZ53nBJR8ezsL5sVO08vBefvIfiKlu94vM0aKbhpubsyeS7ooW8pU WaQgc14YJ0mRqWkp5Pve4hkw2TLL3dtN0Nvl7iPqa0QiJpZ+S92GTnsdHYtbM/aARSMf /21Te7tC8EkmSlh57z7D4w4HhyA75GdNCkTLEM/Y01kkVqGxwSmtZ7+RGRkNC6yR5Ego kN12VZPcAskGupbHTLWOQAor0Hx31zZZSApP4coZ8+IPZ5viobfMI7KoKCg8EiLFFiNS jRdQ== X-Gm-Message-State: AOJu0YwMYN2JSPO6tpN+jDsEnxkQWGrI1nPrarDskDd5sa9Y/8PNurQi 3G/ydzKyj0dTp8/EgW21odUPRrZWhRMph6TGpgzvbkMYLZkSWjfqXsfVKSFQe3fVDtiokyMeMsP kwSyC3lZqBQ5vPidTowVKWQB8AufNgNZ9IIJE X-Received: by 2002:a50:9998:0:b0:55f:9918:dadd with SMTP id m24-20020a509998000000b0055f9918daddmr19957edb.2.1706725423409; Wed, 31 Jan 2024 10:23:43 -0800 (PST) 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> <20240127004321.1902477-2-davidai@google.com> <20240131170608.GA1441369-robh@kernel.org> In-Reply-To: <20240131170608.GA1441369-robh@kernel.org> From: Saravana Kannan Date: Wed, 31 Jan 2024 10:23:03 -0800 Message-ID: Subject: Re: [PATCH v5 1/2] dt-bindings: cpufreq: add virtual cpufreq device To: Rob Herring Cc: David Dai , "Rafael J. Wysocki" , Viresh Kumar , Krzysztof Kozlowski , Conor Dooley , Sudeep Holla , 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" Content-Transfer-Encoding: quoted-printable On Wed, Jan 31, 2024 at 9:06=E2=80=AFAM Rob Herring wrote= : > > On Fri, Jan 26, 2024 at 04:43:15PM -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. 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 ++++++++++++++++++ > > > + const: qemu,virtual-cpufreq > > Well, the filename almost matches the compatible. > > > + > > + reg: > > + maxItems: 1 > > + description: > > + Address and size of region containing frequency controls for eac= h 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 proporti= onal to > > + total number of frequency domains. This device also needs the CP= Us 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. T= he rest > > + of the frequencies of all the vCPUs should be normalized based o= n their > > + performance relative to that 1024 KHz OPP. This makes it much ea= sier to > > + migrate the VM across systems which might have different physica= l CPU > > + OPPs. > > + > > +required: > > + - compatible > > + - reg > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > + // This example shows a two CPU configuration with a frequency dom= ain > > + // for each CPU showing normalized performance points. > > + cpus { > > + #address-cells =3D <1>; > > + #size-cells =3D <0>; > > + > > + cpu@0 { > > + compatible =3D "arm,armv8"; > > + device_type =3D "cpu"; > > + reg =3D <0x0>; > > + operating-points-v2 =3D <&opp_table0>; > > + }; > > + > > + cpu@1 { > > + compatible =3D "arm,armv8"; > > + device_type =3D "cpu"; > > + reg =3D <0x0>; > > + operating-points-v2 =3D <&opp_table1>; > > + }; > > + }; > > + > > + opp_table0: opp-table-0 { > > + compatible =3D "operating-points-v2"; > > + > > + opp64000 { opp-hz =3D /bits/ 64 <64000>; }; > > opp-64000 is the preferred form. > > > + opp128000 { opp-hz =3D /bits/ 64 <128000>; }; > > + opp192000 { opp-hz =3D /bits/ 64 <192000>; }; > > + opp256000 { opp-hz =3D /bits/ 64 <256000>; }; > > + opp320000 { opp-hz =3D /bits/ 64 <320000>; }; > > + opp384000 { opp-hz =3D /bits/ 64 <384000>; }; > > + opp425000 { opp-hz =3D /bits/ 64 <425000>; }; > > + }; > > + > > + opp_table1: opp-table-1 { > > + compatible =3D "operating-points-v2"; > > + > > + opp64000 { opp-hz =3D /bits/ 64 <64000>; }; > > + opp128000 { opp-hz =3D /bits/ 64 <128000>; }; > > + opp192000 { opp-hz =3D /bits/ 64 <192000>; }; > > + opp256000 { opp-hz =3D /bits/ 64 <256000>; }; > > + opp320000 { opp-hz =3D /bits/ 64 <320000>; }; > > + opp384000 { opp-hz =3D /bits/ 64 <384000>; }; > > + opp448000 { opp-hz =3D /bits/ 64 <448000>; }; > > + opp512000 { opp-hz =3D /bits/ 64 <512000>; }; > > + opp576000 { opp-hz =3D /bits/ 64 <576000>; }; > > + opp640000 { opp-hz =3D /bits/ 64 <640000>; }; > > + opp704000 { opp-hz =3D /bits/ 64 <704000>; }; > > + opp768000 { opp-hz =3D /bits/ 64 <768000>; }; > > + opp832000 { opp-hz =3D /bits/ 64 <832000>; }; > > + opp896000 { opp-hz =3D /bits/ 64 <896000>; }; > > + opp960000 { opp-hz =3D /bits/ 64 <960000>; }; > > + opp1024000 { opp-hz =3D /bits/ 64 <1024000>; }; > > + > > + }; > > I don't recall your prior versions having an OPP table. Maybe it was > incomplete. You are designing the "h/w" interface. Why don't you make it > discoverable or implicit (fixed for the h/w)? We also need the OPP tables to indicate which CPUs are part of the same cluster, etc. Don't want to invent a new "protocol" and just use existing DT bindings. > Do you really need it if the frequency is normalized? Yeah, we can have little and big CPUs and want to emulate different performance levels. So while the Fmax on big is 1024, we still want to be able to say little is 425. So we definitely need frequency tables. > Also, we have "opp-level" for opaque values that aren't Hz. Still want to keep it Hz to be compatible with arch_freq_scale and when virtualized CPU perf counters are available. -Saravana