Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1899263lqp; Tue, 16 Apr 2024 00:38:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUutMaFrMz1GHSi4HtaQKqNwrTKuDXbEa9ZwDMsip4gCR4A+KZ7tfiM2tobqfUcLtZ20hfTjdAx6mLaZQqtkXQf4EZV5wLli9VMzLpfjQ== X-Google-Smtp-Source: AGHT+IFabeYo/pipjTQp+gE/3Ae2c+wXt8bbccvIMeHO3IUTHPxJ6xyNdqdYImXJWT4phpWbArT+ X-Received: by 2002:a50:f699:0:b0:570:2367:47e7 with SMTP id d25-20020a50f699000000b00570236747e7mr3687403edn.12.1713253109776; Tue, 16 Apr 2024 00:38:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713253109; cv=pass; d=google.com; s=arc-20160816; b=vjY848GwE3v7+mRD+j+8ej1A5V8QbiTSw8KwO1TWvWpIHFfV4jaDcc6zkkTFdLMdei U4QXs+RhFNNUm5ZccTH9XS6MV4RJI40pBctGg6k0Rx7/s8naLu1cRvCgatvFuqLXU64G AyZLFOXUcGavZ0z94FcCTQvwSNQQAglIc2H8JGT2BxoZamPaftmXfxl4rpq6G1zVdcEc w+yAA+3P4fcfW/6Ro/XkGg6BZdAxP8LC+dTnfGnvLNNZ11N+vNdz9PVHLAx/ENaU5I47 Y0YdDAx/7bhWeNQl5/bpojT9Y8xCZL4fa0Of9JHCNTmRA0EayL+BE+9xMRXSIvhZM8ny nl5w== 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=Lpt7EQoTjHWx7MukNwQgGlRKG76k6XuM6dbXi3sRZ08=; fh=4jyGPlIgBC+cOBl2betKVRRu896Cfe1VEzAQNc3FCOU=; b=WRY/5lkJ/9/OxYssbUCzW7P/9QV6jVwyocdlABYbcN8ISNilc+O6QdkbRJLBmRb+Ln g7khWKg5egNc1/rUpqbDrzW1yOBH/crZ28ny7UvNCWNq+yPSQWoLGpiAW9HKewxBzk2o hwrx69CX5gtN/yRVEspldCARga80N/4rZdOX1ruL9AfZBQ8tQHbElHVvfeM+bYFChIF8 FMRahVbkB2U9xKJbX8y9U3rxLl5Ae3IqZsDu2I34MYLnm5Mqm6LZB08vx6rvs3yJ7y6r nh/IeugRhvCF9kTP4vaOTcf7gEjp1Kx1lcuePK/xs1dXN2Hv5RlbPDCEB0dSYYPFZ9th PZ/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=ffkhviKU; 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-146437-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146437-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n18-20020a5099d2000000b0056e5c7059f7si5648050edb.590.2024.04.16.00.38.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 00:38:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146437-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=ffkhviKU; 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-146437-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146437-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 56A991F22AC1 for ; Tue, 16 Apr 2024 07:38:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C45FF84D14; Tue, 16 Apr 2024 07:38:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="ffkhviKU" 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 DA72A71B50; Tue, 16 Apr 2024 07:38:15 +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=1713253097; cv=none; b=pZl+zZ4AQugq6FEXohn4b7fICuKCHk9vPL9YOyQhpA3B9AOQHybefA6u99amlk3GCuqK4iZGYqyiAGrTtFdFwTM5hWQlFfMnZmcOVCe8xXGB8SYzYTOrMF6U8rV05JJoZZJokLjwPGBh0BouPdrw7DGI40APvmyghit8YqOI9ao= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713253097; c=relaxed/simple; bh=x5lugkkuTzZRflrDEuf9ADF8MPGbuJ8c7gc3ccW/M98=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lrqWVHaOiGPO7fqcVZAeItq5wHWRaNmHwD5BMctGozvtjHPxJNj7QrzprPONpvoQ3iedQoKK1SHariu8e/RfxEKNxfXrQ1rWk88ufwlGXiVBX8M8HqM23yEyfYSln0GYraCQnAA63vmi4eo0unM1CCdpOdo3Zsqg8GDOg+kGicA= 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=ffkhviKU; 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=1713253095; x=1744789095; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=x5lugkkuTzZRflrDEuf9ADF8MPGbuJ8c7gc3ccW/M98=; b=ffkhviKUAXUiuThSZ/tx29uQArlrjZFAD6ATYNjVEoxvac3g+66r9l7T oUrR5m3pyB58wq5a+tUEXqrdtvxw2ntFN7B1lx7owY9qXwd2YvZzQKYub M7TVs1DPW9EBFDoeO8ns02UiPHUocA+nRschigTr9ReBRIzRQ51A2N182 2iMNF+KAe0Cb3yIKVILn5yKBBlnH7OtHE8oWxgfYfe0znRuhLflaQkzHa 6yOBXWvCl1U6OmGJkcRXGZ3TPK0NseMZkhe5HQvOOsyv2SwvRMrH7yZQE N6Nn2NLhCTtJJAfLWNVvI17PtTD1/TxNopz9zaTnt2VnYwJvA1A4iAB/v g==; X-CSE-ConnectionGUID: 61Rrqh/nSVOeoxSPEgjDLA== X-CSE-MsgGUID: Y9MCszL3RR+vu36uIQGM/A== X-IronPort-AV: E=Sophos;i="6.07,205,1708412400"; d="asc'?scan'208";a="21182016" 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; 16 Apr 2024 00:38:08 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) 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; Tue, 16 Apr 2024 00:37:29 -0700 Received: from wendy (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Tue, 16 Apr 2024 00:37:25 -0700 Date: Tue, 16 Apr 2024 08:36:33 +0100 From: Conor Dooley To: Charlie Jenkins CC: Conor Dooley , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Evan Green , =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= , Jonathan Corbet , Shuah Khan , , , , Palmer Dabbelt , , , , Subject: Re: [PATCH 02/19] riscv: cpufeature: Fix thead vector hwcap removal Message-ID: <20240416-husband-flavored-96c1dad58b6e@wendy> References: <20240411-dev-charlie-support_thead_vector_6_9-v1-0-4af9815ec746@rivosinc.com> <20240411-dev-charlie-support_thead_vector_6_9-v1-2-4af9815ec746@rivosinc.com> <20240412-tuesday-resident-d9d07e75463c@wendy> <20240412-eastcoast-disparity-9c9e7d178df5@spud> <20240412-chemist-haunt-0a30a8f280ca@spud> <20240413-sharper-unlivable-5a65660b19e2@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="S0aAJ0pL4KXiXwbM" Content-Disposition: inline In-Reply-To: --S0aAJ0pL4KXiXwbM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 15, 2024 at 08:34:05PM -0700, Charlie Jenkins wrote: > On Sat, Apr 13, 2024 at 12:40:26AM +0100, Conor Dooley wrote: > > On Fri, Apr 12, 2024 at 02:31:42PM -0700, Charlie Jenkins wrote: > > > On Fri, Apr 12, 2024 at 10:27:47PM +0100, Conor Dooley wrote: > > > > On Fri, Apr 12, 2024 at 01:48:46PM -0700, Charlie Jenkins wrote: > > > > > On Fri, Apr 12, 2024 at 07:47:48PM +0100, Conor Dooley wrote: > > > > > > On Fri, Apr 12, 2024 at 10:12:20AM -0700, Charlie Jenkins wrote: > >=20 > > > > > > > This is already falling back on the boot CPU, but that is not= a solution > > > > > > > that scales. Even though all systems currently have homogenous > > > > > > > marchid/mvendorid I am hesitant to assert that all systems are > > > > > > > homogenous without providing an option to override this. > > > > > >=20 > > > > > > There are already is an option. Use the non-deprecated property= in your > > > > > > new system for describing what extesions you support. We don't = need to > > > > > > add any more properties (for now at least). > > > > >=20 > > > > > The issue is that it is not possible to know which vendor extensi= ons are > > > > > associated with a vendor. That requires a global namespace where = each > > > > > extension can be looked up in a table. I have opted to have a > > > > > vendor-specific namespace so that vendors don't have to worry abo= ut > > > > > stepping on other vendor's toes (or the other way around). In ord= er to > > > > > support that, the vendorid of the hart needs to be known prior. > > > >=20 > > > > Nah, I think you're mixing up something like hwprobe and having > > > > namespaces there with needing namespacing on the devicetree probing= side > > > > too. You don't need any vendor namespacing, it's perfectly fine (IM= O) > > > > for a vendor to implement someone else's extension and I think we s= hould > > > > allow probing any vendors extension on any CPU. > > >=20 > > > I am not mixing it up. Sure a vendor can implement somebody else's > > > extension, they just need to add it to their namespace too. > >=20 > > I didn't mean that you were mixing up how your implementation worked, my > > point was that you're mixing up the hwprobe stuff which may need > > namespacing for $a{b,p}i_reason and probing from DT which does not. > > I don't think that the kernel should need to be changed at all if > > someone shows up and implements another vendor's extension - we already > > have far too many kernel changes required to display support for > > extensions and I don't welcome potential for more. >=20 > Yes I understand where you are coming from. We do not want it to require > very many changes to add an extension. With this framework, there are > the same number of changes to add a vendor extension as there is to add > a standard extension.=20 No, it is actually subtly different. Even if the kernel already supports the extension, it needs to be patched for each vendor > There is the upfront cost of creating the struct > for the first vendor extension from a vendor, but after that the > extension only needs to be added to the associated vendor's file (I am > extracting this out to a vendor file in the next version). This is also > a very easy task since the fields from a different vendor can be copied > and adapted. >=20 > > Another thing I just thought of was systems where the SoC vendor > > implements some extension that gets communicated in the ISA string but > > is not the vendor in mvendorid in their various CPUs. I wouldn't want to > > see several different entries in structs (or several different hwprobe > > keys, but that's another story) for this situation because you're only > > allowing probing what's in the struct matching the vendorid. >=20 > Since the isa string is a per-hart field, the vendor associated with the > hart will be used. I don't know if you just didn't really read what I said or didn't understand it, but this response doesn't address my comment. Consider SoC vendor S buys CPUs from vendors A & B and asks both of them to implement Xsjam. The CPUs are have the vendorid of either A or B, depending on who made it. This scenario should not result in two different hwprobe keys nor two different in-kernel riscv_has_vendor_ext() checks to see if the extension is supported. *If* the extension is vendor namespaced, it should be to the SoC vendor whose extension it is, not the individual CPU vendors that implemented it. Additionally, consider that CPUs from both vendors are in the same SoC and all CPUs support Xsjam. Linux only supports homogeneous extensions so we should be able to detect that all CPUs support the extension and use it in a driver etc, but that's either not going to work (or be difficult to orchestrate) with different mappings per CPU vendor. I saw your v2 cover letter, in which you said: Only patch vendor extension if all harts are associated with the same vendor. This is the best chance the kernel has for working properly if there are multiple vendors. I don't think that level of paranoia is required: if firmware tells us that an extension is supported, then we can trust that those extensions have been implemented correctly. If the fear of implementation bugs is what is driving the namespacing that you've gone for, I don't think that it is required and we can simplify things, with the per-vendor structs being the vendor of the extension (so SoC vendor S in my example), not A and B who are the vendors of the CPU IP. Thanks, Conor. --S0aAJ0pL4KXiXwbM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZh4qgQAKCRB4tDGHoIJi 0jJZAQDQmcK4nj841UhHcb8WvWbPC7o7TCt9g7AQS757vS0CSwD/XR1svOyQ4sAV a2VdMwg8xaojsbGnITddWN30iDLuywA= =fr0c -----END PGP SIGNATURE----- --S0aAJ0pL4KXiXwbM--