Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp578930lqt; Thu, 6 Jun 2024 11:44:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXTriulS1XJ1KApbRTIg5OyhfBQH5m7WdgnFwwp99GRg8bxnbCa4q1NRBD+5PSP4DWtgy9PYAk2NRUbTayJGgSx/wVVhMfYpNJCqsJtbg== X-Google-Smtp-Source: AGHT+IFWL1FgH6yiOcsypbMED/evVubqFskOXISIVkkskBYYcp2kN1Xsqfeg4C8U7ST+/ZmUupHa X-Received: by 2002:a17:906:3650:b0:a6c:7181:500d with SMTP id a640c23a62f3a-a6cd7a89ad7mr26802866b.45.1717699448056; Thu, 06 Jun 2024 11:44:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717699448; cv=pass; d=google.com; s=arc-20160816; b=mPq3pEB9IhEQg55xD0dBJGZElOGG+nCEaU3CscUV5nuTwN/BPfyTohyN90NfIKHqGm YWRLinoMv9zo1haqVj9T+ocoNcoGLa4/zRmEENTAFSgrdbH9hJ6xtY/df6nSng4Q7Upe nYWXyrqCDr23zCH5G1hWnya2ahehyDggO+KIFFt3S095yl0Qr/9LDkWcNrIn3eY7nFI2 Bw6nkGVaboFScnP4xxDezX93x0nl6Xw7/9EJRAAU2mbpMBXnaXstCyra7SvAeySK/53q pyD9jNXZ2H2ppA9JAQbKqDQ7wFYiJ27px10LnQCQNvPahzylCzbooJiTFGX15Rg3agGR 1Gsg== 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=WLUj7DV9aKwRoKMGwPmNck1zRHw7ldI2vvW18FE0AE0=; fh=ZjfvWY4C2cYSc7zg/TXBWqILY49hVWesfxqTJnfFmLA=; b=L1nQ7Ka7rFTuoyL49bCuwQj/v4EbIT7NZGMli/obaVzkk86uDEnP+mmTyR09mJsWRX wASfPEaFbLvGMqaEdRQhccrDAMHqhFrP3xyHFEd4VD1UUtzYGm+kZProryhva7NxJuhN RZ8TLbJYMHrLfontWspuZ/JnEhRW8iAiSGl3043+6XVX2vABuBj6BgzoswFKG2mzMlUi /Npi08IZkHB+zOWtYRB3Cr77fbPJMhQ8vnVaAuWKMRfNfrib0CC2ObFby3x6c65ZwoxY SH7+osr3QZm2qsWnuN3GoPc1BgjY16/D4iN/FpaYI34ZA8olQX+AQfy1PYotTKmsI5f1 QXDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gSXH9NEJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-204905-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c806dad22si95885666b.341.2024.06.06.11.44.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 11:44:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204905-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gSXH9NEJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-204905-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9104D1F23239 for ; Thu, 6 Jun 2024 18:44:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D08C4DA1F; Thu, 6 Jun 2024 18:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gSXH9NEJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BA9484D584 for ; Thu, 6 Jun 2024 18:43:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717699439; cv=none; b=pGBlT/s3zOGulMLad35mcLc9HcoWczIiDdMi18nd/Eaz3uwrE96Mq0MT0iZN6WOkS/5j1+3e2vAZwo3pR5HxCEWOUDl9TViK++WNkLt3yDjbgxXuNGFcL4iVi0w0x0ZVJzi7lb2QCFVtZPrMOqtBz7vCvEYB+F8mur5ZZVGIr00= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717699439; c=relaxed/simple; bh=53jnQieg28uN+Jr1SxbOZfAYrGKD3bK16dUDxYAgWx4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XjBiIxJGIpAXH4Vbw/xwKL4Di/g7eqGipjEDLQnt1m+9Fj0/qdfmfK8n/CEFemzWpXWMEiz3qy1dNUECb3XBBEeWf2dkYFXZ76XMlLgzw2wAStWNJJjS3CdzCVctbDrrFEo7NM2t+KVY/4GZ/UvkrSAG2cv3mZSIuJccGGbrle4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gSXH9NEJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75618C2BD10; Thu, 6 Jun 2024 18:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717699439; bh=53jnQieg28uN+Jr1SxbOZfAYrGKD3bK16dUDxYAgWx4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gSXH9NEJZ7GsMdXuWi87ZX4CdxD7G3HASISeEQ88kPN4e27kq2yXBDY1xqSAt2NJd KafTUoJSdiVY78nKg1okxVRX4duwvo/QVxv3naYOYGKtOOxpBhKuKLYneVxZu4vP9k yuDkhMP0b7UXIqUxv3FE20o/1+JXYNX0opla2kwMIN/nxwJnjyLHXukXaOg8Mi9WH4 HimyFdq1HoCE5RnRalLyRf2+SU4/miqdnIph6TUmMXZGv2EsVYEnRgClvYwz0E7mEU O5+7/ktbTRdoUHei393qNlBXkdqljR1y/uGANP4BZ7gNRkpSWZw8IfI3JfkG9V5XfB Q2X2bH/01M+9g== Date: Thu, 6 Jun 2024 19:43:52 +0100 From: Conor Dooley To: Jesse Taube Cc: linux-riscv@lists.infradead.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Evan Green , Charlie Jenkins , 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: <20240606-acetone-whisking-af2ba796238f@spud> References: <20240606183215.416829-1-jesse@rivosinc.com> 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="1NCbJLZCivnUGaW/" Content-Disposition: inline In-Reply-To: <20240606183215.416829-1-jesse@rivosinc.com> --1NCbJLZCivnUGaW/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > Detecing zicclsm allows the kernel to report if the > hardware supports misaligned accesses even if support wasn't probed. >=20 > This is useful for usermode to know if vector misaligned accesses are > supported. >=20 > 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(+) >=20 > diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwca= p.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 > =20 > #define RISCV_ISA_EXT_XLINUXENVCFG 127 > =20 > diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/u= api/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. > #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/cpufeatur= e.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[] =3D { > __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. > }; > =20 > const size_t riscv_isa_ext_count =3D ARRAY_SIZE(riscv_isa_ext); > diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwpr= obe.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 *pa= ir, > 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. > } > =20 > if (has_fpu()) { > --=20 > 2.43.0 >=20 >=20 --1NCbJLZCivnUGaW/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZmIDaAAKCRB4tDGHoIJi 0g3hAPwNVeSLKAyopibUGHTyx98GbKVXAzBEoWZpWftw+5T5JAEA8hWOi1FbPtsY 8amGAdonpZ3KOn3n1mS+Jw5kqOSYxwE= =pCmy -----END PGP SIGNATURE----- --1NCbJLZCivnUGaW/--