From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D65DC4345F for ; Tue, 16 Apr 2024 14:54:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LTWwNvamHYTjI0RpJjflqgKwjLtn8yDbOz79WdxjSSE=; b=qF1zAowTYMGGmyrHm8To4h5Teo L/JOhTqRuzBgMXitaHOUjH23qb3wUEi+fdc4fT9lrkWtlQt3OcFqcvUFBcy1tztyimtoEqovnuWI9 +dYSC7+0H94cPWO710byZWW1R5zABg1oMx3tyATya+6tGg+ulWotHGn7T3JwbdYDdE6q5waaYWfBZ YpB2gUBb6nOpZrafRN3VTgZfJghdH2tLlQTRSrRNGyR++O9f3uU/52ZAO3zoiMjmkb7zrlSrFcdOy PoldX/tjkhbJNG099T96oNvRxVl0mweMJDsbiKnn0Q19z9QVS9xerXZPqCnJP3D0T0hKTfCXkfmDO Cqs7Gwnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwkCp-0000000Cdkp-2WmS; Tue, 16 Apr 2024 14:54:43 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwkCl-0000000CdiP-18qz; Tue, 16 Apr 2024 14:54:41 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2EC6C61229; Tue, 16 Apr 2024 14:54:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32502C113CE; Tue, 16 Apr 2024 14:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713279277; bh=Ky37z6+ib9PoHukGJLoU7Q3WV2IiY+rxAfk1Wn5VtXw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pEtD5pH9wGVvkTiTrN/Zv2kB3piFiOp8GLYBuZ4Qvza0csKCqdYE+T3XNrOkZjcDc xLdcPJG/CY+e52NYakI14kcCBLgoFt4AC7dD13hoHCIYKPPMgiadW7sCMUb2+3f51T Uh5lw6yh263zVY9j1V2bdrYKM8Z3hsKoibYhJehcBQi5CVj2ortZ3LUbKSZyi+qPkh fWP2aQd4lM7J9clMqP5DvtTkwtiOuHZ66G937Na1DSHjmW9tjeRkAT+T2hHadeJdVQ m3vTMM9KI0jjLuhJMk74BB1SDedHpANEBwdIUJW+fw+awljjiGKv2V+RLXB1Q+23H2 KyWk2I4BCHAqA== Date: Tue, 16 Apr 2024 15:54:32 +0100 From: Conor Dooley To: =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= Cc: Conor Dooley , Deepak Gupta , Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 07/10] riscv: add ISA extension parsing for Zcmop Message-ID: <20240416-gave-apron-3234098ce416@spud> References: <20240410091106.749233-8-cleger@rivosinc.com> <20240410-jawless-cavalry-a3eaf9c562a4@spud> <20240410-judgingly-appease-5df493852b70@spud> <1287e6e9-cb8e-4a78-9195-ce29f1c4bace@rivosinc.com> <20240411-superglue-errant-b32e5118695f@wendy> <20240411-backwater-opal-00c9aed2231e@wendy> <5eda3278-24bc-4c17-a741-523ad5ff79f7@rivosinc.com> MIME-Version: 1.0 In-Reply-To: <5eda3278-24bc-4c17-a741-523ad5ff79f7@rivosinc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240416_075439_446581_6116E514 X-CRM114-Status: GOOD ( 31.72 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============4980458856671975576==" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org --===============4980458856671975576== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="o4oWfyukzOIBXo40" Content-Disposition: inline --o4oWfyukzOIBXo40 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 15, 2024 at 11:10:24AM +0200, Cl=E9ment L=E9ger wrote: >=20 >=20 > On 11/04/2024 13:53, Conor Dooley wrote: > > On Thu, Apr 11, 2024 at 11:08:21AM +0200, Cl=E9ment L=E9ger wrote: > >>>> If we consider to have potentially broken isa string (ie extensions > >>>> dependencies not correctly handled), then we'll need some way to > >>>> validate this within the kernel. > >>> > >>> No, the DT passed to the kernel should be correct and we by and large= we > >>> should not have to do validation of it. What I meant above was writing > >>> the binding so that something invalid will not pass dtbs_check. > >> > >> Acked, I was mainly answering Deepak question about dependencies wrt to > >> using __RISCV_ISA_EXT_SUPERSET() which does not seems to be relevant > >> since we expect a correct isa string to be passed. > >=20 > > Ahh, okay. > >=20 > >> But as you stated, DT > >> validation clearly make sense. I think a lot of extensions strings wou= ld > >> benefit such support (All the Zv* depends on V, etc). > >=20 > > I think it is actually as simple something like this, which makes it > > invalid to have "d" without "f": > >=20 > > | diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml = b/Documentation/devicetree/bindings/riscv/extensions.yaml > > | index 468c646247aa..594828700cbe 100644 > > | --- a/Documentation/devicetree/bindings/riscv/extensions.yaml > > | +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml > > | @@ -484,5 +484,20 @@ properties: > > | Registers in the AX45MP datasheet. > > | https://www.andestech.com/wp-content/uploads/AX45MP-1C-R= ev.-5.0.0-Datasheet.pdf > > | =20 > > | +allOf: > > | + - if: > > | + properties: > > | + riscv,isa-extensions: > > | + contains: > > | + const: "d" > > | + not: > > | + contains: > > | + const: "f" > > | + then: > > | + properties: > > | + riscv,isa-extensions: > > | + false > > | + > > | + > > | additionalProperties: true > > | ... > >=20 > > If you do have d without f, the checker will say: > > cpu@2: riscv,isa-extensions: False schema does not allow ['i', 'm', 'a'= , 'd', 'c'] > >=20 > > At least that's readable, even though not clear about what to do. I wish >=20 > That looks really readable indeed but the messages that result from > errors are not so informative. >=20 > It tried playing with various constructs and found this one to yield a > comprehensive message: >=20 > +allOf: > + - if: > + properties: > + riscv,isa-extensions: > + contains: > + const: zcf > + not: > + contains: > + const: zca > + then: > + properties: > + riscv,isa-extensions: > + items: > + anyOf: > + - const: zca >=20 > arch/riscv/boot/dts/allwinner/sun20i-d1-dongshan-nezha-stu.dtb: cpu@0: > riscv,isa-extensions:10: 'anyOf' conditional failed, one must be fixed: > 'zca' was expected > from schema $id: http://devicetree.org/schemas/riscv/extensions.y= aml >=20 > Even though dt-bindings-check passed, not sure if this is totally a > valid construct though... I asked Rob about this yesterday, he suggested adding: riscv,isa-extensions: if: contains: const: zcf then: contains: const: zca to the existing property, not in an allOf. I think that is by far the most readable version in terms of what goes into the binding. The output would look like: cpu@0: riscv,isa-extensions: ['i', 'm', 'a', 'd', 'c'] does not contain ite= ms matching the given schema (for d requiring f cos I am lazy) Also, his comment about your one that gives the nice message was that it would wrong as the anyOf was pointless and it says all items must be "zca". I didn't try it, but I have a feeling your nice output will be rather less nice if several different deps are unmet - but hey, probably will still be better than having an undocumented extension! --o4oWfyukzOIBXo40 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZh6RJwAKCRB4tDGHoIJi 0gKiAPwO95yHRMreVZI1sGkG9R4vNU1EfJdXv3oNOqMEeB8Z7wEA/fI5rZ01fYH6 ZiMSKf0BThc7H4AEo7Lo2lqLwVoBngw= =iSce -----END PGP SIGNATURE----- --o4oWfyukzOIBXo40-- --===============4980458856671975576== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv --===============4980458856671975576==--