Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp671820lqt; Thu, 6 Jun 2024 15:10:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUThPjp972222zJjTodE4jAHXBAu6+TJOJVzbm7F/Ifcfg0/LcqaQwPOY5e/OmNicv1RS6KM3zXG7JVngKxj68a8hZXXUy4SR/xQmAXsw== X-Google-Smtp-Source: AGHT+IHOh+u0LkOQxBK8b3sHlQVHvwGbyI3om/KHnQ3QOBlOSAW5wAp2bH23leFUb6iBKtQO3W4+ X-Received: by 2002:a05:622a:64e:b0:43e:3c3b:d9d1 with SMTP id d75a77b69052e-44041b5005fmr13859391cf.3.1717711826639; Thu, 06 Jun 2024 15:10:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717711826; cv=pass; d=google.com; s=arc-20160816; b=TBdZYEomrkeSYjA78Yv+mOOpFS475ZgbOJPE5Ncq7OnOfweMVpMvKUC3n+OavD7imt YFkfJzcgFxnk+NePlfLTKcBFw3JeIomFxalMRgCHub+dsES1dWs5HTNnQtRwhup0J4vm HScJ/Q5kkWcSVP1HYRqd9ZGloc0HIvHeKXt8lItBJfnDACIG0/9AoHa6DUsjgW2rqsO2 E5PbtDzIbEcsIYPcsjkZCpOx/dvL/6nZwlcImSeO61JNd81MLl6k8UmPkRGAllupLo5j qUYjrehD3YeFBo/CMZDLiUxHhZAgcwjpNkqILkGMkQDetCqMLSIEL/wmd+45KziBBg3K XqVQ== 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=mJTeyb0eINc0gwLURpfqtisGaEu72F/v9nDe3ziMfx8=; fh=IQ/tdCCi0CbmzVdnhJAQeytVHr0+TYJzr5HaXoUoqJY=; b=L6uqLaq7EDuYYFz1tfU/pn3dqaO98oPzHM9rZoigW0F+3NDMu+fQfoVScYRZZYx+aJ rTj0W9u6oPtoWiytieTpbAZFxNFVEPREg15w2ytmDa4eWzyiLx4iKtkpddPMjN3ML+hw PlDnQpMPfS8a/Y0L2NdMIRPjm9PtfJl9Xxzc3B/lrgRmbnDcVYwUKSZx7YG+DIbSuzWD r2schMul+WXC46LvgOQQzt0p0mQc8lp0JWo9I9JXXvCyNmgFj3M9i8oPLzjpEK68mbph PnwHxU0zM6jsIzDvtieYr5rVHF/0mupfGYKOjv3e2Xd1BVK7LZOHJbBZ1rVG0r3zsB1X gmJQ==; 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=YqkpmnOw; 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-205110-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205110-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-44038b16166si25270841cf.311.2024.06.06.15.10.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 15:10:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205110-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=YqkpmnOw; 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-205110-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205110-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 51AA21C23EF3 for ; Thu, 6 Jun 2024 22:10:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39D7213D25D; Thu, 6 Jun 2024 22:10:21 +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="YqkpmnOw" Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (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 801A3487A9 for ; Thu, 6 Jun 2024 22:10:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717711820; cv=none; b=sWzHvSXKNJAkZqHMeBKVBEjfTk819HtBdHF64NmbK9IVICmv6YjOjYlhbeQ4sZQhVdwMM7d83oy4D2oPqMfN+y/8+Jsh0Hy+DBs9UwE58dGoG52oQGlhgzJBTd7/L8KSCnmqYHV1SNQ5myYgB0DRykRMfSU8wu5X86qzl8DBinw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717711820; c=relaxed/simple; bh=eFsaU4eSsMIiwxDQvxkU6/iVZeYSlNg0j3AYHmAB86w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kSjmRBHO1LqV8vGq5MeVwsQWuNCecLvvraF7BqCl6S3nO1oyKOZf1eNDsvueoroqKCfmSwbvABK6Gpu8gFGlx0n6uApK1uwv2Ch9mMl+cVTvX0RLenYvFbbvl0Z839nEZgiXNNa3a2ptjaABKeaeCMUyR2j8jahh9bZcIlahJCo= 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=YqkpmnOw; arc=none smtp.client-ip=209.85.210.54 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-ot1-f54.google.com with SMTP id 46e09a7af769-6f938c18725so921266a34.1 for ; Thu, 06 Jun 2024 15:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717711817; x=1718316617; 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=mJTeyb0eINc0gwLURpfqtisGaEu72F/v9nDe3ziMfx8=; b=YqkpmnOwFCNHct23WRepxwi/TPsnorVKMTeq/nGLApb2C4cwY/2rTPU8HIuTkChiAz QedqsrY5IOAij1CJyYFeQH2BRB1kcjmwctKV6IDIIGjTNyEZgs8VTtG6ighr4ho6eLo9 8MFrdILg+to3z0PSzBHX24MQuxLdbXvkoGZOtXaMPKlUZu4MomCpibBG6FZnJKj05ygS 71sNqZIbNbMV4xyOOkft46cyjOGmHnjLGfNulzpYlDATmGov6jatzNC1V8EhgTu6VEjN jfOns+bcBJHjMhalNxVa2sr2QohPqd/mkECMPc62MrCJADNoj2T0n4wJIIN/4udr5z8t ABqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717711817; x=1718316617; 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=mJTeyb0eINc0gwLURpfqtisGaEu72F/v9nDe3ziMfx8=; b=WLxoM2T2Lgqg389RMf/5TDD7u3QFFXuaNztpFn+Go9+on4zfoL1U8l+ZVpnTnMAfC/ B4AerXjsQF0r1senHF2Cau+FEE7R0LlUA5wjECjwa6i2OhlTptPq3QQDEqZvkC7yW9L2 /Z91Rosvk4oNzDw9Yd6Vt41vw5rePiixm0h6bDIQVQbGj2u2pM2Yelwr5jNmGGrXhPYQ gQHVJhny5hr2XisSUrSJf25BKeC2162rTrL5V+ru/pLMMXdsthfOd8uz8cyI+rJg40mf W3V4K7o5vvO2Cm1wJc6SO9i5Imh4AgRdojJrR/8TIjDfQG/HJaz0AQvz/b4ofGJHkqlD ziWA== X-Forwarded-Encrypted: i=1; AJvYcCWKiDel9DLtIoVzFodrk5lMyzneJTGS+I11Uz9ajZql/O7ew4IiMpTKLp8dCH4HRiAZ7Ha5iO5HDGv15wZqJrUceQYJzX6qNLoGeExR X-Gm-Message-State: AOJu0YxDJf1hxXUxtFOlPhGuabeg/zUev5TMVDvGK7npTosqL1qhHqgm hSmGdXdyHTUbF1oRYus+PtpC91FaLoThVWmrv5CpaUHxMeAliF19jy7jqd/DV0A= X-Received: by 2002:a05:6358:63a3:b0:199:a132:8aa with SMTP id e5c5f4694b2df-19f1fedc4b3mr123515855d.17.1717711817515; Thu, 06 Jun 2024 15:10:17 -0700 (PDT) Received: from ghost ([50.145.13.30]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6de2017fc69sm1356840a12.17.2024.06.06.15.10.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 15:10:16 -0700 (PDT) Date: Thu, 6 Jun 2024 15:10:13 -0700 From: Charlie Jenkins To: Conor Dooley Cc: Jesse Taube , linux-riscv@lists.infradead.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Evan Green , Andrew Jones , Xiao Wang , =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= , Andy Chiu , Greentime Hu , Heiko Stuebner , Guo Ren , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Costa Shulyupin , Andrew Morton , Baoquan He , Sami Tolvanen , Zong Li , Ben Dooks , Erick Archer , Vincent Chen , Joel Granados , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] RISC-V: Add Zicclsm to cpufeature and hwprobe Message-ID: References: <20240606183215.416829-1-jesse@rivosinc.com> <20240606-acetone-whisking-af2ba796238f@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: <20240606-acetone-whisking-af2ba796238f@spud> On Thu, Jun 06, 2024 at 07:43:52PM +0100, Conor Dooley wrote: > On Thu, Jun 06, 2024 at 02:32:13PM -0400, Jesse Taube wrote: > > > Zicclsm Misaligned loads and stores to main memory regions with both > > > the cacheability and coherence PMAs must be supported. > > > Note: > > > This introduces a new extension name for this feature. > > > This requires misaligned support for all regular load and store > > > instructions (including scalar and vector) but not AMOs or other > > > specialized forms of memory access. Even though mandated, misaligned > > > loads and stores might execute extremely slowly. Standard software > > > distributions should assume their existence only for correctness, > > > not for performance. > > > > Detecing zicclsm allows the kernel to report if the > > hardware supports misaligned accesses even if support wasn't probed. > > > > This is useful for usermode to know if vector misaligned accesses are > > supported. > > > > Signed-off-by: Jesse Taube > > --- > > arch/riscv/include/asm/hwcap.h | 1 + > > arch/riscv/include/uapi/asm/hwprobe.h | 1 + > > arch/riscv/kernel/cpufeature.c | 1 + > > arch/riscv/kernel/sys_hwprobe.c | 1 + > > 4 files changed, 4 insertions(+) > > > > diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h > > index e17d0078a651..8c0d0b555a8e 100644 > > --- a/arch/riscv/include/asm/hwcap.h > > +++ b/arch/riscv/include/asm/hwcap.h > > @@ -81,6 +81,7 @@ > > #define RISCV_ISA_EXT_ZTSO 72 > > #define RISCV_ISA_EXT_ZACAS 73 > > #define RISCV_ISA_EXT_XANDESPMU 74 > > +#define RISCV_ISA_EXT_ZICCLSM 75 > > > > #define RISCV_ISA_EXT_XLINUXENVCFG 127 > > > > diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h > > index 2902f68dc913..060212331a03 100644 > > --- a/arch/riscv/include/uapi/asm/hwprobe.h > > +++ b/arch/riscv/include/uapi/asm/hwprobe.h > > @@ -59,6 +59,7 @@ struct riscv_hwprobe { > > #define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33) > > #define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34) > > #define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35) > > +#define RISCV_HWPROBE_EXT_ZICCLSM (1ULL << 36) > > Missing an update to hwprobe.rst. > "RISCV_HWPROBE_EXT_ZIHINTPAUSE (1ULL << 36)" was also defined here in 6.10 so this key needs to be bumped down one. - Charlie > > #define RISCV_HWPROBE_KEY_CPUPERF_0 5 > > #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) > > #define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c > > index 3ed2359eae35..863c708f2f2e 100644 > > --- a/arch/riscv/kernel/cpufeature.c > > +++ b/arch/riscv/kernel/cpufeature.c > > @@ -305,6 +305,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { > > __RISCV_ISA_EXT_DATA(svnapot, RISCV_ISA_EXT_SVNAPOT), > > __RISCV_ISA_EXT_DATA(svpbmt, RISCV_ISA_EXT_SVPBMT), > > __RISCV_ISA_EXT_DATA(xandespmu, RISCV_ISA_EXT_XANDESPMU), > > + __RISCV_ISA_EXT_DATA(zicclsm, RISCV_ISA_EXT_ZICCLSM), > > Please read the ordering comment above this structure! > Also, you're missing dt-binding documentation for the extension. > > > }; > > > > const size_t riscv_isa_ext_count = ARRAY_SIZE(riscv_isa_ext); > > diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c > > index 8cae41a502dd..b286b73e763e 100644 > > --- a/arch/riscv/kernel/sys_hwprobe.c > > +++ b/arch/riscv/kernel/sys_hwprobe.c > > @@ -125,6 +125,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, > > EXT_KEY(ZVKT); > > EXT_KEY(ZVFH); > > EXT_KEY(ZVFHMIN); > > + EXT_KEY(ZICCLSM); > > Order looks off here too, I think this should be added in in the same > order as to riscv_isa_ext, although the requirement isn't hard here, > just that adding to the end of a list means it's annoying to check for > what's missing. > > Thanks, > Conor. > > > } > > > > if (has_fpu()) { > > -- > > 2.43.0 > > > >