Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6323649rwl; Wed, 22 Mar 2023 09:08:54 -0700 (PDT) X-Google-Smtp-Source: AK7set8hCnn+t55Wvha6+ZcCoCGi0XPvdnydP0HtmytIqidiXUXigPkaB57w5ZEl1HcSmIZxsDCn X-Received: by 2002:a17:906:75a:b0:92b:e949:8007 with SMTP id z26-20020a170906075a00b0092be9498007mr7762515ejb.55.1679501333855; Wed, 22 Mar 2023 09:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679501333; cv=none; d=google.com; s=arc-20160816; b=a3UjoqlXSg95onYDmO5PS/79LBCpB0MDrO8Bi3bWBDhNHS0XOaPHDwHgWsro6H1qV9 W/3uCiNM0YM0SOfVcLmRZli6hUEIT/vp0piGrytPsqtQWuuSGTDN5vfRdHzUM5aQzhgB 9XUnS2qQplCBb7r2ih1b6YTERyk3I9hAp+iPcoyB+i7EnonNnpB7OcDX2Lb3MX+HfEjL qc3icApFV11wM7juwvtDUvkFy6/2uHJAK1TUod1mCRlzMBR3ocpcvsJGxEfLPxdJgP7W QA0UEkWXDA3KLQF9kDCBU4NNo02MCcH98ipb+YzovlBLi6Hx/l9qJ9Qu1O7/Cd2Y9V1+ HQXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=bQMj+UbSGYt/V4ItEl8Atz++wkEESN6wJSeRvZafcDU=; b=wg8r7ayBUa76HRSW1VO3w7vFNfRW0gupMDItk1y7hFGpBrSVYy6nUQfC9K0P676/SP 9/DSVqnuRntM2wDQxsTCrgz7fWHl/E5S4Rfw5LAnurOlcVpDEmhVIxKgJ+IWt7AtltDx YsHJHJ4mJMzPBvxSdjidiZXRvH2JichhpHnLmeMW3AWAJ7bgnSJ/zhw/So37253718VV J+61C+lHi1PT/iBMUrCpogac49Kv0o2vk4230wmZr5JWJmX7MDOOIpzslwGilZx9MeBZ IuV2VRtMZB5qo9u5pjKgeFzqxRn89WPSX3dxDoDRuHWerHVK+ZnZPjTOHGTx6j54XLQn MALw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=fXDTK4Uw; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w2-20020aa7d282000000b004d49f845574si15604052edq.223.2023.03.22.09.08.29; Wed, 22 Mar 2023 09:08:53 -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=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=fXDTK4Uw; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbjCVQFH (ORCPT + 99 others); Wed, 22 Mar 2023 12:05:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbjCVQFF (ORCPT ); Wed, 22 Mar 2023 12:05:05 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60AC2A242 for ; Wed, 22 Mar 2023 09:05:03 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id a11so8983641lji.6 for ; Wed, 22 Mar 2023 09:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1679501101; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bQMj+UbSGYt/V4ItEl8Atz++wkEESN6wJSeRvZafcDU=; b=fXDTK4UwWJxghhGY844FVJkS0jod018sFRa0JBR2+G/lVjO/CNliTnwbakz6nPokPM ctesUpwtgM7AtGOBQBk/KcVJvZPTuY4YB+apo51lhApvb0i6T+YI89tfIMxJFGF/7ux5 juJINe4wcZSKbe5qz65JOk30xQa36Jqx3MzzCnYaHQ5IYG6+PO2I14y5OIXs5kxDTkdF 1GQzH/YyUtvAXNacXkMC5rRcgMYiaWgSG03Tag7KIj9qW4H+teBEqY4enNWq8SNghfg1 9+EuKVWvhD8tt7Fbg3arhOW22QAjiVRVddT5aSc3tb9uQ5pIPLeFLjsMPz+Guw2w8av6 2zDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679501101; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bQMj+UbSGYt/V4ItEl8Atz++wkEESN6wJSeRvZafcDU=; b=uhHlFGY4SMUY16QONI/U6wiJUQjRAxFJWyuQPYPsh+Hs7tcvOZY4biDWaFo66GFsHl L9h9ugt0EK7SrY1wlily1lcc3HXguYy0681bHJr2m2udQlWqN/LuwX0bMGDOmiE+66MX vdVQaJwbDkxrfFdx38BA6O8/65weIExlQYsC3915z1TMzmQn7ywzkg62knnVc5e7Z1Tu aZALw9gsUiPN7u4X+0hQCOExxe1qK/oMRcUfqRGicL4GCI/J+MaA/koPI+RshPPBlN5u 2tnLp0e4y/cV77+OBiRvFYdoZosCiaWFY4X3rqa9N3FrXJINkqPm/cH0Ru3jOzIEYgzg GyrQ== X-Gm-Message-State: AO0yUKWuui23n5nWj6iIUC6RllO/JPxgBeNnNznxheQlIC0MvQVXZbjY 1J98GEQOmoYocbIlNaiQs9tvt2aADysQFPBnq1lq4g== X-Received: by 2002:a2e:7e05:0:b0:299:ac4e:a8a6 with SMTP id z5-20020a2e7e05000000b00299ac4ea8a6mr2145466ljc.9.1679501101548; Wed, 22 Mar 2023 09:05:01 -0700 (PDT) MIME-Version: 1.0 References: <20230314183220.513101-1-evan@rivosinc.com> <20230314183220.513101-4-evan@rivosinc.com> <8e132bed-c85a-4bfd-bff8-5147db1cec32@spud> In-Reply-To: <8e132bed-c85a-4bfd-bff8-5147db1cec32@spud> From: Evan Green Date: Wed, 22 Mar 2023 09:04:25 -0700 Message-ID: Subject: Re: [PATCH v4 3/6] RISC-V: hwprobe: Add support for RISCV_HWPROBE_BASE_BEHAVIOR_IMA To: Conor Dooley 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, RCVD_IN_DNSWL_NONE,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 Yep, you and Heiko are on the same wavelength these days. I'll make that ch= ange. -Evan On Wed, Mar 22, 2023 at 8:36=E2=80=AFAM Conor Dooley wro= te: > > 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. > > > > 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 = *pair, > > 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; > > > > /* > > * For forward compatibility, unknown keys don't fail the whole > > -- > > 2.25.1 > >