Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6288449rwl; Wed, 22 Mar 2023 08:44:05 -0700 (PDT) X-Google-Smtp-Source: AK7set+Tnx9UhKM2sadqbL7i0J8Ui14rDgXhoWzCZMcKxbCSwP9+33cY3a+9kxnNvfbKGWpOzdOh X-Received: by 2002:a17:90b:4c48:b0:237:30ef:e593 with SMTP id np8-20020a17090b4c4800b0023730efe593mr4542891pjb.24.1679499844594; Wed, 22 Mar 2023 08:44:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679499844; cv=none; d=google.com; s=arc-20160816; b=kqgw5Im1Sa5AzyYJFeCpqc0HNup1dKttvP4qUkPF3aWaqKl242/s45uMGG2nfFGS2O S46u8xSGlx7bUMpCHQTPl98K4hBr8UCNGASKqKL4aRoVVf7y2M+xLZFmnQHPrJvzisGN nsr3jsL7Bx5qQFCDJWtAB/hdpNOPx+BJi7rqYXiUfr9ckLS4PM0VjtUQ9EgWbSot2t2I vT0eAp80+9PWKQkbBDe5SEBRlNdFAApmumNb+jAB24068GDiFNLwo8YtT7jr05UGy3yl CqwI0f0DgXQxqrtuxRGizitiIHwJjjTzUhTxAEFUROu8f+whIi+cssrSVs5AKj7m1JeV 0QlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fIToqCRUqwGc91Z5RtTvoxE98FfZX+a303MOZj4hC4E=; b=Xr2NzqEKToUCDUV883Vht/4urxxkC34/WxIvCEcticYTYXWQmSSWRIPOQQyCoplCrW hTC9NUk80iDdEcBXxeHHr7VYgF8Qkr9AvRsosfvX4jVbO/RfSi+OgGUym2VYErPgTTfu zTmL1/+ZIXojMWzu+li5pSSggDGaBO4FM58fMllI90WaqAQUILgw99+P6Z4mO7bes5ri JH6jWQDsPWLBfNxody9eQ5BwJ0a+jKAbpDTmc66VWScpZmlNnJz+dYVoUc77pz8txQXq +vmH6Pf4y5ieYPnC93oNxi7uCEbKZ4+jlv7bN3AnBv2ttZFLBBm4RcIAk4l3u6Bhrg30 pf9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uWqGKRZE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jd20-20020a170903261400b0019f24b937ffsi15756261plb.521.2023.03.22.08.43.52; Wed, 22 Mar 2023 08:44:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uWqGKRZE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231538AbjCVPgM (ORCPT + 99 others); Wed, 22 Mar 2023 11:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231607AbjCVPgK (ORCPT ); Wed, 22 Mar 2023 11:36:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A65E515CD; Wed, 22 Mar 2023 08:36:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 26C9C621A0; Wed, 22 Mar 2023 15:36:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BEB5C4339B; Wed, 22 Mar 2023 15:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679499365; bh=DZy9l2qyDKre9adLwkTIGVd6PoEOrq5ypuDZNWHxbJU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uWqGKRZENH6xhp47Uo6JUmbc8rMcVyCGI1wIWS9Ycu1PR1v0i/Lz6WE6+ITRbtQWP KAnd/amMvGloOOH7kvjSXNEUHUkGA1gaJqAMqsveJtnl/L2r+/wOKA/YOupxvhpISe P3FgL3ojHPObXM2v0pgehfxYKLrp39ovS8Ar51V52vhsmGInrbpfA4Mrw4C/S1FFTA DuFz4tYaXZxzg234CCAJ1GVEhXEQhPTgYATpEzg3nAgPu9x9So32+zEkijfb7Br4SN tkUOZaFPXlyyZwFHfh4HFM89T11cJdwBtYwAxhUy9nBxJT+LzAxHv3YCLVfdDX6RzX lx0Mz43ukmzFg== Date: Wed, 22 Mar 2023 15:35:59 +0000 From: Conor Dooley To: Evan Green Cc: Palmer Dabbelt , slewis@rivosinc.com, heiko@sntech.de, vineetg@rivosinc.com, Conor Dooley , Albert Ou , Andrew Bresticker , Celeste Liu , Guo Ren , Jonathan Corbet , Palmer Dabbelt , Paul Walmsley , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v4 3/6] RISC-V: hwprobe: Add support for RISCV_HWPROBE_BASE_BEHAVIOR_IMA Message-ID: <8e132bed-c85a-4bfd-bff8-5147db1cec32@spud> References: <20230314183220.513101-1-evan@rivosinc.com> <20230314183220.513101-4-evan@rivosinc.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="r+TYFFM1/Jo8CP9z" Content-Disposition: inline In-Reply-To: <20230314183220.513101-4-evan@rivosinc.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --r+TYFFM1/Jo8CP9z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 14, 2023 at 11:32:17AM -0700, Evan Green wrote: > We have an implicit set of base behaviors that userspace depends on, > which are mostly defined in various ISA specifications. >=20 > Co-developed-by: Palmer Dabbelt > Signed-off-by: Palmer Dabbelt > Signed-off-by: Evan Green > Reviewed-by: Conor Dooley > @@ -125,6 +126,25 @@ static void hwprobe_one_pair(struct riscv_hwprobe *p= air, > case RISCV_HWPROBE_KEY_MIMPID: > hwprobe_arch_id(pair, cpus); > break; > + /* > + * The kernel already assumes that the base single-letter ISA > + * extensions are supported on all harts, and only supports the > + * IMA base, so just cheat a bit here and tell that to > + * userspace. > + */ > + case RISCV_HWPROBE_KEY_BASE_BEHAVIOR: > + pair->value =3D RISCV_HWPROBE_BASE_BEHAVIOR_IMA; > + break; > + > + case RISCV_HWPROBE_KEY_IMA_EXT_0: > + pair->value =3D 0; > + if (has_fpu()) > + pair->value |=3D RISCV_HWPROBE_IMA_FD; > + > + if (elf_hwcap & RISCV_ISA_EXT_c) Random thought while reviewing another patch, and I kinda felt a bit stupid following the existing code to try and make sure, but should this become a call to riscv_isa_extension_available(NULL, c)? It may be nice to propagate that helper, if it works, than check the bit directly. Cheers, Conor. > + pair->value |=3D RISCV_HWPROBE_IMA_C; > + > + break; > =20 > /* > * For forward compatibility, unknown keys don't fail the whole > --=20 > 2.25.1 >=20 --r+TYFFM1/Jo8CP9z Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZBsgXwAKCRB4tDGHoIJi 0uXwAPwO6vaB4a7jTfh6cwcjIbakPGbW2KoWTWyZNWCElUCFGgEA/czXfGY7/Z9G 0R/BZly3E44aKfHbp8z2S2DhkztM8QU= =2y2o -----END PGP SIGNATURE----- --r+TYFFM1/Jo8CP9z--