Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp1280271rwj; Sun, 18 Dec 2022 05:35:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf7AvuZ083jfmAdbRuz/2HWW2c2DjHkshO2/ZB2FMFzmDPRW08KtcqEBg0qAmPNXgO/SJSQQ X-Received: by 2002:a05:6a00:1696:b0:56e:dca8:ba71 with SMTP id k22-20020a056a00169600b0056edca8ba71mr51413756pfc.32.1671370501766; Sun, 18 Dec 2022 05:35:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671370501; cv=none; d=google.com; s=arc-20160816; b=fLSbTi9oONeLLnmuKxK1tFNsC+S5rIz7PDY0IGPs+oqP2USKO/jq1bdkPyDWfgvkfU Gx8hn0Ru326HYyLzvUn3GO6mp8j/l7U8/7oK6t/pCcm7RgzmG6aAhuhqoicFrTwCqc7d AgOdH5ZVxCqAj4Hn7CFsHkjsjsRGZpg7HSC78nF/jJ75iW/ScL4hRIPlcwz6qkViR/x7 C8lfK2EelgcgHfLhNWexvjjZJcTEnHfvYzUB6FOM18ljrubCTVB1zqoj1cu7fw18E4xt ODzi1cKnflSXWZffliV6mYu16WRCQpxT64+dnmgxSIWbxTl85EZoTaxrTsLTe3iH5ZpS 6wkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=LWXfYDV4q1ARzFrDrDuKH+ltZLaholboav6379bd5/w=; b=anleDmJWUsw9w18Z03CZa++jxEtKIMWnuNjYB+OWt8YlByCnMc9FdQs+vj/6XDqkeX 9Sptdb6V89OlJIgWmoUN3hgTR3GaLKPYXyRZJSVT8JPEi58pJhkzVv6NTq2MG8IlHZ6S JYg6uwHNoY1n1x5w8EgsNFa3j/lmPvLIJjNNyN4teWdYcZwvYpVjUcRVieoir6/jqTtb LCe2QptOSOsfjE6oellHG2xGnohqEYytjcqDXc6YrVlwX0oDnxCR7/YNAlaydyoezN/P klLX+V8XrwoR+c0GQKhC2G1y766mQfMsvRWO8RYM9gjC4v+G5khCnvtJGVVC4gtH6zzZ zU+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O728Eyg2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a056a0023c800b00576ad2ad835si8245613pfc.13.2022.12.18.05.34.52; Sun, 18 Dec 2022 05:35:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O728Eyg2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230327AbiLRNNu (ORCPT + 71 others); Sun, 18 Dec 2022 08:13:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbiLRNNs (ORCPT ); Sun, 18 Dec 2022 08:13:48 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A35A32ACA for ; Sun, 18 Dec 2022 05:13:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id BBC26CE0B98 for ; Sun, 18 Dec 2022 13:13:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D71DFC433EF; Sun, 18 Dec 2022 13:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671369218; bh=0hPFIoqG1pb5r61Kc7fAqelgV4PDptfCI2Zixp9Czww=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=O728Eyg27YQRWVtfaRew+4AvR3pwX0ixk0HZrFoBGhHOMVQeWYkF6NwcLBbuB48// GUFIIaXp/ib7Gf3k03s+l10ggGZH6ZgF+DcKyLSz+zI8w/J/qCP6/jK2JG1NtXR0LO UfZTcyt4XuJ6zhpar+la/pcUc9Apdl508e1Z72eBPZ/1tOcBpowyqRZS5U19nCUzNN 9i9U2afJjODUm2eT/pvXUezEt9Q8Layrv6WtZL5G3sf1jXAPGox7gSCL8lJgYScqfu W22dYPT4gKbKKXC5oiqNsa9SRqZlEQsIQyI1ok5wiZXvVlftc/ZQ0FQb8uxr1Zfcms XYn6PbADXMNKA== Received: from ip-185-104-136-29.ptr.icomera.net ([185.104.136.29] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1p6tU0-00DR6V-83; Sun, 18 Dec 2022 13:13:36 +0000 Date: Sun, 18 Dec 2022 13:11:01 +0000 Message-ID: <87bko0g8m2.wl-maz@kernel.org> From: Marc Zyngier To: Akihiko Odaki Cc: linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Mathieu Poirier , Oliver Upton , Suzuki K Poulose , Alexandru Elisei , James Morse , Will Deacon , Catalin Marinas , asahi@lists.linux.dev, Alyssa Rosenzweig , Sven Peter , Hector Martin Subject: Re: [PATCH v3 1/7] arm64/sysreg: Convert CCSIDR_EL1 to automatic generation In-Reply-To: <1ef32b0c-6cee-75f7-e1e0-ede1f5b9a016@daynix.com> References: <20221218051412.384657-1-akihiko.odaki@daynix.com> <20221218051412.384657-2-akihiko.odaki@daynix.com> <87cz8hez0i.wl-maz@kernel.org> <1ef32b0c-6cee-75f7-e1e0-ede1f5b9a016@daynix.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.104.136.29 X-SA-Exim-Rcpt-To: akihiko.odaki@daynix.com, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, mathieu.poirier@linaro.org, oliver.upton@linux.dev, suzuki.poulose@arm.com, alexandru.elisei@arm.com, james.morse@arm.com, will@kernel.org, catalin.marinas@arm.com, asahi@lists.linux.dev, alyssa@rosenzweig.io, sven@svenpeter.dev, marcan@marcan.st X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 18 Dec 2022 11:35:12 +0000, Akihiko Odaki wrote: >=20 > On 2022/12/18 20:23, Marc Zyngier wrote: > > On Sun, 18 Dec 2022 05:14:06 +0000, > > Akihiko Odaki wrote: > >>=20 > >> Convert CCSIDR_EL1 to automatic generation as per DDI0487I.a. The field > >> definition is for case when FEAT_CCIDX is not implemented. Fields WT, > >> WB, RA and WA are defined as per A.j since they are now reserved and > >> may have UNKNOWN values in I.a, which the file format cannot represent. > >>=20 > >> Signed-off-by: Akihiko Odaki > >> --- > >> arch/arm64/include/asm/sysreg.h | 1 - > >> arch/arm64/tools/sysreg | 11 +++++++++++ > >> 2 files changed, 11 insertions(+), 1 deletion(-) > >>=20 > >> diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/= sysreg.h > >> index 7d301700d1a9..910e960661d3 100644 > >> --- a/arch/arm64/include/asm/sysreg.h > >> +++ b/arch/arm64/include/asm/sysreg.h > >> @@ -425,7 +425,6 @@ > >> #define SYS_CNTKCTL_EL1 sys_reg(3, 0, 14, 1, > >> 0) > >> -#define SYS_CCSIDR_EL1 sys_reg(3, 1, 0, 0, 0) > >> #define SYS_AIDR_EL1 sys_reg(3, 1, 0, 0, 7) > >> #define SYS_RNDR_EL0 sys_reg(3, 3, 2, 4, 0) > >> diff --git a/arch/arm64/tools/sysreg b/arch/arm64/tools/sysreg > >> index 384757a7eda9..acc79b5ccf92 100644 > >> --- a/arch/arm64/tools/sysreg > >> +++ b/arch/arm64/tools/sysreg > >> @@ -871,6 +871,17 @@ Sysreg SCXTNUM_EL1 3 0 13 0 7 > >> Field 63:0 SoftwareContextNumber > >> EndSysreg > >> +Sysreg CCSIDR_EL1 3 1 0 0 0 > >> +Res0 63:32 > >> +Field 31:31 WT > >> +Field 30:30 WB > >> +Field 29:29 RA > >> +Field 28:28 WA > >=20 > > For fields described as a single bit, the tool supports simply > > indicating the bit number (28 rather than 28:28). > >=20 > > However, I strongly recommend against describing fields that have been > > dropped from the architecture. This only happens when these fields > > are never used by any implementation, so describing them is at best > > useless. >=20 > arch/arm64/tools/gen-sysreg.awk does not allow a hole and requires all > bits are described hence these descriptions. If you have an > alternative idea I'd like to hear. I'd simply suggest creating an UNKNOWN field encompassing bits [21:28]. Alternatively, feel free to try the patch below, which allows you to describe these 4 bits as "Unkn 31:28", similar to Res0/Res1. > > >=20 > >> +Field 27:13 NumSets > >> +Field 12:3 Associavity Also, you may want to fix the typo here (Associativity). Thanks, M. =46rom 3112be25ec785de4c92d11d5964d54f216a2289c Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Sun, 18 Dec 2022 12:55:23 +0000 Subject: [PATCH] arm64: Allow the definition of UNKNOWN system register fie= lds The CCSIDR_EL1 register contains an UNKNOWN field (which replaces fields that were actually defined in previous revisions of the architecture). Define an 'Unkn' field type modeled after the Res0/Res1 types to allow such description. This allows the generation of #define CCSIDR_EL1_UNKN (UL(0) | GENMASK_ULL(31, 28)) which may have its use one day. Hopefully the architecture doesn't add too many of those in the future. Signed-off-by: Marc Zyngier --- arch/arm64/tools/gen-sysreg.awk | 20 +++++++++++++++++++- arch/arm64/tools/sysreg | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/arch/arm64/tools/gen-sysreg.awk b/arch/arm64/tools/gen-sysreg.= awk index c350164a3955..e1df4b956596 100755 --- a/arch/arm64/tools/gen-sysreg.awk +++ b/arch/arm64/tools/gen-sysreg.awk @@ -98,6 +98,7 @@ END { =20 res0 =3D "UL(0)" res1 =3D "UL(0)" + unkn =3D "UL(0)" =20 next_bit =3D 63 =20 @@ -112,11 +113,13 @@ END { =20 define(reg "_RES0", "(" res0 ")") define(reg "_RES1", "(" res1 ")") + define(reg "_UNKN", "(" unkn ")") print "" =20 reg =3D null res0 =3D null res1 =3D null + unkn =3D null =20 next } @@ -134,6 +137,7 @@ END { =20 res0 =3D "UL(0)" res1 =3D "UL(0)" + unkn =3D "UL(0)" =20 define("REG_" reg, "S" op0 "_" op1 "_C" crn "_C" crm "_" op2) define("SYS_" reg, "sys_reg(" op0 ", " op1 ", " crn ", " crm ", " op2 ")") @@ -161,7 +165,9 @@ END { define(reg "_RES0", "(" res0 ")") if (res1 !=3D null) define(reg "_RES1", "(" res1 ")") - if (res0 !=3D null || res1 !=3D null) + if (unkn !=3D null) + define(reg "_UNKN", "(" unkn ")") + if (res0 !=3D null || res1 !=3D null || unkn !=3D null) print "" =20 reg =3D null @@ -172,6 +178,7 @@ END { op2 =3D null res0 =3D null res1 =3D null + unkn =3D null =20 next } @@ -190,6 +197,7 @@ END { next_bit =3D 0 res0 =3D null res1 =3D null + unkn =3D null =20 next } @@ -215,6 +223,16 @@ END { next } =20 +/^Unkn/ && (block =3D=3D "Sysreg" || block =3D=3D "SysregFields") { + expect_fields(2) + parse_bitdef(reg, "UNKN", $2) + field =3D "UNKN_" msb "_" lsb + + unkn =3D unkn " | GENMASK_ULL(" msb ", " lsb ")" + + next +} + /^Field/ && (block =3D=3D "Sysreg" || block =3D=3D "SysregFields") { expect_fields(3) field =3D $3 diff --git a/arch/arm64/tools/sysreg b/arch/arm64/tools/sysreg index bd5fceb26c54..472f68f020d9 100644 --- a/arch/arm64/tools/sysreg +++ b/arch/arm64/tools/sysreg @@ -15,6 +15,8 @@ =20 # Res1 [:] =20 +# Unkn [:] + # Field [:] =20 # Enum [:] --=20 2.34.1 --=20 Without deviation from the norm, progress is not possible.