Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2193129lqt; Mon, 22 Apr 2024 04:28:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVq+qMgcfmrDVwefcX6898YRJsNL9pAdiNRBLMW8jKtd/zda/tIyZwZjv7V09VCZohIhBQ31MU7PFrcyxkKenIQC8QKoSiPOImlDDEYnQ== X-Google-Smtp-Source: AGHT+IFCK8H/Ugl4JH2iJDTlMC1RMW51N6QpmCQD56r8t4dSR2TDKGYKXJk5R5y44qk9jqnVqj92 X-Received: by 2002:a05:6e02:1fc5:b0:36a:1f36:6be5 with SMTP id dj5-20020a056e021fc500b0036a1f366be5mr13388130ilb.11.1713785292055; Mon, 22 Apr 2024 04:28:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713785292; cv=pass; d=google.com; s=arc-20160816; b=Q2f3AJkpMtLc79ejtkpstZx7NJqFxX0ehKYbdReu0tzo02Pvp8XGC9VDKzw27KHFxB oc0yqiTx1kw7y57ibU7FtdeGbwOx59VGCfbkIEI5aBqEn8kRr6hGe91GWr/0JrQeKF3j OMJfMQtUU5l5uMgIf/qRsSL5JbvesOa0xTbuXp4wW8VVFXnE11Fedi9c1UZgWfXi7rdw 64EXxLpU1QJhtnwIy5Hgil92ZqkwV5mI6Y64sLmHszQuBd8jUYXUNqZhr0i6ZWX0j0rn r0grhc00jtfRMvLpZNiuKajbFrW0nL6PpaLFY9U+VAi6Nakz00QR1j57b+kYAcc/zWw/ g8Kw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=O/5x6nT8vXLm7Jpo6vMb7IN0ZsfgdibmuqBjZdkyb3w=; fh=gGqfexLR41DsjBphs9OR0kOo9wicBO1Lz3D+/6SWIGA=; b=y8MGrexi74reuoXrm+wBjp5PlPeQjHvsTS0uQb4lkTIZklao4JT9qFuSHT/GY97UON zRyxlU8I5ei2Ojy1USAjzBKcFiKT7h2dOGFJU6ST6HFtpux6Rjrlwd4UkPe0goHOtE1W RvXYjNhiR56HCKRT7Ds1wu/yMMffya0baXt6DYJgpCfCafsPcoTEjtgtOxewpzyh+iz4 LxykCGFL8BYzwssYOe0LzdIkFTXSfG35/XdFV/HuCxl6d9pVG23CKD+l9NCyccDF0V6m EBlL/QCT6l2ahnDwbDCrcqLA8vQl68lJ+aUkSt+gY+ts84bb/LiYFv3JLsY/YatTiwNr FP4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=mQfEvkLr; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-153282-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153282-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id be2-20020a656e42000000b005ff1b38c514si2037631pgb.404.2024.04.22.04.28.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 04:28:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153282-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=mQfEvkLr; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-153282-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153282-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AC1FE287586 for ; Mon, 22 Apr 2024 11:20:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ECFA11474B4; Mon, 22 Apr 2024 11:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="mQfEvkLr" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95794146A67; Mon, 22 Apr 2024 11:20:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713784821; cv=none; b=s4nigzF3pXf2t8XyX83TRndXvcPoRzIp5C/zDMVgyW89wtAEcJsVBbHep9N8SDqcjBiD3b6s7Zol2RuYov+JYdnikNfE8/X78X2ScLIL6S/X7GwqT5YZHHI/+BSrCKPsI2ztLG/ueWPFHnVPOYARCqofOqvP0uzKk9J/UaqiFp8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713784821; c=relaxed/simple; bh=XRSUgOnTV4XErsz5ecolHV/4A/hQBybGq5GAfiFEyPU=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Z22DhJ7PbHmFvYqkYxMwcgGXqn/RXFyvKIbirv9XyFeWDpmU/5yeEsaMdA6VLqC1QJHeKNiOoFmqYLK6LeosyIe4dEMfsZcl5WIphSN1NoI2x5JJ9voF4DmKto6Le3l74+PsoyfJtmcU3z0U7bGvhDVEpJJR72fhMM49E+gcoDE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=mQfEvkLr; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1713784818; x=1745320818; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=XRSUgOnTV4XErsz5ecolHV/4A/hQBybGq5GAfiFEyPU=; b=mQfEvkLrzi65g25hLMnQZ5MfSMj887CCw48xfc/wKNVKYoG0NH5pdrYj aPVVFt/EAZPCWsRT5WlR/zuQHpW3gpHydtpWyfRsq560h14HcAFvcpqzj lRH/iqnzLYWL7gOEnwX2Dm3czQijm5uCbS+7++vSomdaiSvlR+bNIIm6f imzAKxMizDDSUrPM5b7L+LUV5P1UkhkljsYyKwd5wHX4yQNpGXq79OcyF 3rjD6ZiTIwV4fOPFiO2RZccHh8HPbnxwpNEEqh6ztwRZQA+kR8K0QFJuF yBvq5S5JT5dTk/C8stt1j4eNtomfYQeFQvrCZAmvadvpG/sFfWWvR8PSF w==; X-CSE-ConnectionGUID: EwlQHltERQKVoL1uwoRBeA== X-CSE-MsgGUID: nEu1AlljSHG4Ko1fQpekdA== X-IronPort-AV: E=Sophos;i="6.07,220,1708412400"; d="asc'?scan'208";a="22052345" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Apr 2024 04:20:16 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 22 Apr 2024 04:19:55 -0700 Received: from wendy (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 22 Apr 2024 04:19:52 -0700 Date: Mon, 22 Apr 2024 12:19:36 +0100 From: Conor Dooley To: =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= CC: Conor Dooley , Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan , Atish Patra , , , , , , , Subject: Re: [PATCH v2 03/12] dt-bindings: riscv: add Zc* extension rules implied by C extension Message-ID: <20240422-stumbling-aliens-b408eebe1f32@wendy> References: <20240418124300.1387978-1-cleger@rivosinc.com> <20240418124300.1387978-4-cleger@rivosinc.com> <20240419-blinked-timid-da722ec6ddc4@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="poViDq5TvQtnA831" Content-Disposition: inline In-Reply-To: --poViDq5TvQtnA831 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 22, 2024 at 10:53:04AM +0200, Cl=E9ment L=E9ger wrote: > On 19/04/2024 17:49, Conor Dooley wrote: > > On Thu, Apr 18, 2024 at 02:42:26PM +0200, Cl=E9ment L=E9ger wrote: > >> As stated by Zc* spec: > >> > >> "As C defines the same instructions as Zca, Zcf and Zcd, the rule is t= hat: > >> - C always implies Zca > >> - C+F implies Zcf (RV32 only) > >> - C+D implies Zcd" > >> > >> Add additionnal validation rules to enforce this in dts. > >=20 > > I'll get it out of the way: NAK, and the dts patch is the perfect > > example of why. I don't want us to have to continually update > > devicetrees. If these are implied due to being subsets of other > > extensions, then software should be able to enable them when that > > other extension is present. >=20 > Acked. >=20 > >=20 > > My fear is that, and a quick look at the "add probing" commit seemed to > > confirm it, new subsets would require updates to the dts, even though > > the existing extension is perfectly sufficient to determine presence. > >=20 > > I definitely want to avoid continual updates to the devicetree for churn > > reasons whenever subsets are added, but not turning on the likes of Zca > > when C is present because "the bindings were updated to enforce this" > > is a complete blocker. I do concede that having two parents makes that > > more difficult and will likely require some changes to how we probe - do > > we need to have a "second round" type thing? >=20 > Yeah, I understand. At first, I actually did the modifications in the > ISA probing loop with some dependency probing (ie loop while we don't > have a stable extension state). But I thought that it was not actually > our problem but rather the ISA string provider. For instance, Qemu > provides them. A newer version of QEMU might, but not all do, so I'm not sure that using it is a good example. My expectations is that a devicetree will be written to the standards of the day and not be updated as subsets are released. If this were the first instance of a superset/bundle I'd be prepared to accept an argument that we should not infer anything - but it's not and we'd be introducing inconsistency with the crypto stuff. I know that both scenarios are different in terms of extension history given that this is splitting things into a subset and that was a superset/bundle created at the same time, but they're not really that different in terms of the DT/ACPI to user "interface". > > Taking Zcf as an example, maybe something like making both of C and F i= nto > > "standard" supersets and adding a case to riscv_isa_extension_check() > > that would mandate that Zca and F are enabled before enabling it, and we > > would ensure that C implies Zca before it implies Zcf? >=20 > I'm afraid that riscv_isa_extension_check() will become a rat nest so > rather than going that way, I would be in favor of adding a validation > callback for the extensions if needed. IOW, extension check split out per extension moving to be a callback? > > Given we'd be relying on ordering, we have to perform the same implicat= ion > > for both F and C and make sure that the "implies" struct has Zca before= Zcf. > > I don't really like that suggestion, hopefully there's a nicer way of d= oing > > that, but I don't like the dt stuff here. >=20 > I guess the "cleanest" way would be to have some "defered-like" > mechanism in ISA probing which would allow to handle ordering as well as > dependencies/implies for extensions. For Zca, Zcf, we actually do not > have ordering problems but I think it would be a bit broken not to > support that as well. We could, I suppose, enable all detected extensions on a CPU and run the aforemention callback, disabling them if conditions are not met? Is that something like what you're suggesting? --poViDq5TvQtnA831 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZiZHyAAKCRB4tDGHoIJi 0rO4AP0QdAfLNIEXKBuCIoQC9LRKn1TSnfbXrn8RTgLezI5EdwD/T7Y7u53/krkw V1xB2TSmkQhvtE4QZxoxvt3Mk5aKWwA= =Pef2 -----END PGP SIGNATURE----- --poViDq5TvQtnA831--