Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp194499lqp; Fri, 12 Apr 2024 14:57:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAtPaX5vJfG6JC/z/Y7wcHAhs0RAG5NvXzgLtPUDrojc+KzQr56aBfW/xhVoMacSXuOxTXw5ZEXbfjZiCvuTvtB5pCyh55dxm6GMzEyw== X-Google-Smtp-Source: AGHT+IG/b+R2iZGweQ7id0IS0ssgurfGbzxeHWG9G+T2wfLfXraE5bAjMbL2gXPiM7HVe1wkIzCy X-Received: by 2002:a92:ca0f:0:b0:368:85c6:6bd1 with SMTP id j15-20020a92ca0f000000b0036885c66bd1mr4833794ils.10.1712959029164; Fri, 12 Apr 2024 14:57:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712959029; cv=pass; d=google.com; s=arc-20160816; b=Dcd4zBc4bk32NspihD9xv+1yAV6zlfnieCqkk/gyh0r4rjOAtONd8UHGQFOc3jcvOs ygE+o9nh1Hsr3nR7LwF4CSqlqilndEbOec1HQQvezIbXUIRI9+qdvyQ5mjRYMNvBZPx3 lqpOJrnghCCDzJawLJiFt1XlbX4mtbe6XF8uemy4VH890NvTziAHl6L+dtE2Po0zU3Fd VT0yzlVmy6d8xRux7J7PkLxVpJYgNn4YeXg4zlB02r6H4JClV188DGT9Kwd/YLbeAJOJ asGBi4R4woi4XTAeeTobZg42t8mw1p6jjkkRh1cogskDD/oslbdv2w4IwDkFM3mWEdyd g9ag== 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=KaHJoFfHeKcbZbr8DZBqF2w1WE3ebjk/glljyT7W9ZI=; fh=QOzI1g9G2lBCyBkaT7xe3hWwRP2prqJ04YT0frXxwYU=; b=NvWZh9DCbEaQj4Ypi6rTnsgQz2fgqVycrRaAOfYVp7XBieYQFS7YIfoZoV1D+8fiyF pX5EHHK91KWiEa3gQhJRZezfWIuNZLonLkq+V1m3C/XCXuJtdc84wINvrHIztqW87E36 6LDTIkBTkis/1MnXPrQ3fy9IXAPxTzxjRzO/2vaJfHzO4FX8oA/vpNGaDNnKnkDYnpwn 0aqpPUQQJF0fv3i8rhyFbMRZDRyalaKXx4ALnvZqaDkcxJ+V2ilYPfWzZOc6VJKI/M1h lgGd9MM7GWTga+qRcTvOsT29FI1updqWWHkE5UdiauAJfgLiiZeBaC/yP7o5lchsE4pJ A89g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=fidIA4hg; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-143398-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143398-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b1-20020a637141000000b005dc8372021bsi4022588pgn.464.2024.04.12.14.57.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 14:57:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143398-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=fidIA4hg; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-143398-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143398-linux.lists.archive=gmail.com@vger.kernel.org" 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 99177B2203F for ; Fri, 12 Apr 2024 21:57:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB38E4C6E; Fri, 12 Apr 2024 21:56:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="fidIA4hg" Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 64804152180 for ; Fri, 12 Apr 2024 21:56:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712959013; cv=none; b=SI2xKjk0g4RCtMxlHteWwsiFAJyWrQYBNaAX7JOR5E2u9IL8Q22rfUTU/5pAdXW3gUwReHLl3Xmlp5Llt15cwTVxzNid0/2ElSUs3rVfZMnFr6i/sqRoAcvpaqlpAwdscldYAddq2CQVxSwcLemdHrSswUasNec4BP0TPSOKGUs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712959013; c=relaxed/simple; bh=1PaWGfxyrHB5QHCFj3ZBI3SC8je2iOSCNdYW+yj2zZk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lRR3nPnkmq+6hk9MReS94oysuzdNIHGqDvckpSbifXEr3gNytFVw86SjLyGj3vNyiPltCUoGuvhj1WTNGbIXBmWkJOzXf6P26vwYTCYz4FW8RpqWfpQrEm/mjUAHP6EMGuDZmJTvJkYYl9gfCbyh78F+SGXgo+PbhDUG4zP7oMA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=fidIA4hg; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1e50a04c317so8247495ad.1 for ; Fri, 12 Apr 2024 14:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712959012; x=1713563812; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=KaHJoFfHeKcbZbr8DZBqF2w1WE3ebjk/glljyT7W9ZI=; b=fidIA4hgMjYhSe/iokhz19RcljwGVludiAbQOtT/mqtLkfFJodHOeqLL4bG9FV1bKQ X/j4onsaejAYs3iXIs9uz25e2mYJ1fs4kNEmLSYFck06h0dM9o8dXqFzCQ/T+TnMcenN a+UESJqJM3K4Sudn3WsAgFEy9UudSyCCg4pE5vUAgA6GVeAkfj366YyRAH8Y5um0Usvb eoOD3aawPKyRzOMVXI9/b/8ZdrGDrnjzMJq5CySWWx3fSm3ApumvMVIdjjFTxooJ6gPY L0rjYklLLPmoCzVbfqCARJ6q7aOTRnpIMgEgojA3es0nLHwRUVCUE/kARg+U8dGN1TJE +lqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712959012; x=1713563812; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KaHJoFfHeKcbZbr8DZBqF2w1WE3ebjk/glljyT7W9ZI=; b=D8XrTAJaXk75ScxS71YQTIJGmMsTl/aqihIgvVoPH27WNMq4pNVDg29ltmWQvqv0n9 gsQ9LfWfvnFFIvMstJdQQ36T5K3FMQFM7u1cQJtStgPa49DR67yOE90pLRruJ/zo2YGS 4JloraeIFaAX5cj94VZLLWUSypfIemenvgNbfW/nItTDiyms9MrgC/egKBZBD8wlExqu b1/5wljbmRutT/ty2eyh62GsXxmYLWjwwNh2rqQXP6/n07GNtkRLBlTcsbnkytTSNhkh mtSI9xm6xvsrAn5wTeDRP5hin2DXhzYxgeIim0anLhdaP8yrv8NxiCSSmbm0lsy6TgD5 tS/A== X-Forwarded-Encrypted: i=1; AJvYcCX+ON1DQw1u3NS7UC9YqWaqsluTTQhd9sfE1bKTohVpHgr6aEFNxlbkJ35AE08KUmvbON1F7uyLq3PfcygWbcNZJZ2Yblr5v6iviqAB X-Gm-Message-State: AOJu0YyARN1f47egTsh297oobWuv8AmInddBla442B6rKAABV2cb+ZTk 1qXdN5NPFuodOHIgHj16Nn0dn8rfPs7XIS82Sf5T0FAz//x5JPwWJJcOrZ6VR6g= X-Received: by 2002:a17:903:250:b0:1e4:b1ea:23ef with SMTP id j16-20020a170903025000b001e4b1ea23efmr4487004plh.49.1712959011683; Fri, 12 Apr 2024 14:56:51 -0700 (PDT) Received: from ghost ([50.145.13.30]) by smtp.gmail.com with ESMTPSA id o16-20020a170902d4d000b001e088a9e2bcsm3463749plg.292.2024.04.12.14.56.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 14:56:51 -0700 (PDT) Date: Fri, 12 Apr 2024 14:56:48 -0700 From: Charlie Jenkins To: Conor Dooley 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 , linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Palmer Dabbelt , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 08/19] riscv: Introduce vendor variants of extension helpers Message-ID: References: <20240411-dev-charlie-support_thead_vector_6_9-v1-0-4af9815ec746@rivosinc.com> <20240411-dev-charlie-support_thead_vector_6_9-v1-8-4af9815ec746@rivosinc.com> <20240412-dwarf-shower-5a7300fcd283@wendy> <20240412-drab-french-55d8ff2c8cfa@spud> <20240412-geranium-monotone-b47f414715d1@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240412-geranium-monotone-b47f414715d1@spud> On Fri, Apr 12, 2024 at 10:34:10PM +0100, Conor Dooley wrote: > On Fri, Apr 12, 2024 at 02:03:48PM -0700, Charlie Jenkins wrote: > > On Fri, Apr 12, 2024 at 09:40:03PM +0100, Conor Dooley wrote: > > > On Fri, Apr 12, 2024 at 10:43:02AM -0700, Charlie Jenkins wrote: > > > > On Fri, Apr 12, 2024 at 12:49:57PM +0100, Conor Dooley wrote: > > > > > On Thu, Apr 11, 2024 at 09:11:14PM -0700, Charlie Jenkins wrote: > > > > > > Create vendor variants of the existing extension helpers. If the > > > > > > existing functions were instead modified to support vendor extensions, a > > > > > > branch based on the ext value being greater than > > > > > > RISCV_ISA_VENDOR_EXT_BASE would have to be introduced. This additional > > > > > > branch would have an unnecessary performance impact. > > > > > > > > > > > > Signed-off-by: Charlie Jenkins > > > > > > > > > > I've not looked at the "main" patch in the series that adds all of the > > > > > probing and structures for representing this info yet beyond a cursory > > > > > glance, but it feels like we're duplicating a bunch of infrastructure > > > > > here before it is necessary. The IDs are all internal to Linux, so I'd > > > > > rather we kept everything in the same structure until we have more than > > > > > a handful of vendor extensions. With this patch (and the theadpmu stuff) > > > > > we will have three vendor extensions which feels like a drop in the > > > > > bucket compared to the standard ones. > > > > > > > > It is not duplicating infrastructure. If we merge this into the existing > > > > infrastructure, we would be littering if (ext > RISCV_ISA_VENDOR_EXT_BASE) > > > > in __riscv_isa_extension_available. This is particularily important > > > > exactly because we have so few vendor extensions currently so this check > > > > would be irrelevant in the vast majority of cases. > > > > > > That's only because of your implementation. The existing vendor extension > > > works fine without this littering. That's another thing actually, you > > > forgot to convert over the user we already have :) > > > > Oh right, I will convert them over. The fundemental goal of this patch > > is to allow a way for vendors to support their own extensions without > > needing to populate riscv_isa_ext. This is to create separation between > > vendors so they do not impact each other. > > The one that needs converting is xandespmu. As I said on the other patch > a minute I don't think isolating vendors for the internal representation > is needed and can be left in hwprobe. I also don't think we can rely on > a behaviour of "SiFive CPUs will always have SiFive's mvendorid" or that > kinda thing, I've heard talk of the SoC vendor getting their mvendorid > for custom CPU cores instead of the CPU vendor and it's possible for > the SBI implementation to "adjust" the values also. Okay that may be possible but that is up to the vendor when that happens. The vendor extensions are fundamentally different from the standard extensions and have even less guarantees of correctness which seems like it would invite more errata if multiple vendors implement the same vendor extensions. I can extract the code into a different file for each vendor so that is more clear. - Charlie > > > xlinuxenvcfg does not fit into this scheme however. This scheme assumes > > that a hart cannot have multiple vendors which that extension breaks. > > xlinuxenvcfg is really filling a hole in the standard isa that is > > applicible to all vendors and does not appear in the device tree so it > > is okay for that to live outside this scheme. > > Ye, xlinuxenvcfg is an internal psuedo-extension that should be treated > more like a standard one than something vendor. > > > > > It is also unecessary to push off the refactoring until we have some > > > > "sufficient" amount of vendor extensions to deem changing the > > > > infrastructure when I already have the patch available here. This does > > > > not introduce any extra overhead to existing functions and will be able > > > > to support vendors into the future. > > > > > > Yeah, maybe that's true but this was my gut reaction before reading the > > > other patch in detail (which I've still yet to do). > > > > - Charlie > >