Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19597785rwd; Wed, 28 Jun 2023 11:20:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7+A6FRMaqndE54Di8oBXaKyBIl1M3P6OsPj0kjB23SwqEOPWiybG5NER1cyNgyrCAU85zf X-Received: by 2002:aa7:c648:0:b0:51d:8961:bf07 with SMTP id z8-20020aa7c648000000b0051d8961bf07mr8538327edr.3.1687976447589; Wed, 28 Jun 2023 11:20:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687976447; cv=none; d=google.com; s=arc-20160816; b=Q8IwSI4GU6gLoXtzbn7gyPeTrMGVqzTEcH0KTctyHg6Ma8XA1rz0mFWJkARJXLclcO j5n+/Qse3sH+hTv02eORB/aHlxpp7Uk7dxX4ZRfS78+S4gYfIWBidF3Ntkq5xQ48qe1W nCHWr9E0/lUX7wBAIlOjfUVlamiOTn+KmW392EYyW5+znm7DtPlQx3rzj9yRZOuZb93s IquoGKL/5dMXGupobybouFld0LmWuSx4TS91b424DL9KL0P6zJstNJXQkmD+pbTe+yUq x4fOI3gxOSCgXrpe8cxLaxezusomsGjWi0Daj1KSqbySRMAsJ1xxDW0NfIT34uFB1+kO T4rw== 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=UIfoyCpUUajyFpMhMqY2mJy3ksaLY6ORUfahwyFeKps=; fh=ktAqZtXNKa+LnUrpZI5yBhZV6rmJkSLRQJRGVpASDpE=; b=OKDUa0NizwduLocKUvVCpn2ENlUmL+kUBakNInPEg9/zAdAHxxvpO+8J035gbVuHj1 gOWRP5Qy1rp6WKsX/TdjrttKPP2OILaBamNN8fwIQIMOTqKS91G3paiAOky6BM88G/6h bp1OhjJSMqBENh73RjO9ZSSZff5vCOJK7QORp+eFQlsQupG75vVBYFLRTSFgOpJjTrbY WKskryW8FjVk9TIJPYUGuHhLTtoXzn72nqK24l3G48QvTx4/Wc251QAgV2hZauwZRx33 vMKc2JJEOAk0uewJ9owHMNg6SXvgZWS5Em9UOjomVKYKuufqsLpjqyupx95q1YdHVRCS Hbkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=PZhSyKn0; 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 f19-20020a056402151300b0051dd50ceaa1si360035edw.140.2023.06.28.11.20.20; Wed, 28 Jun 2023 11:20:47 -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.20221208.gappssmtp.com header.s=20221208 header.b=PZhSyKn0; 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 S231303AbjF1Rvg (ORCPT + 99 others); Wed, 28 Jun 2023 13:51:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230519AbjF1Rve (ORCPT ); Wed, 28 Jun 2023 13:51:34 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEE042123 for ; Wed, 28 Jun 2023 10:51:32 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2b6a675743dso1211381fa.2 for ; Wed, 28 Jun 2023 10:51:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1687974691; x=1690566691; 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=UIfoyCpUUajyFpMhMqY2mJy3ksaLY6ORUfahwyFeKps=; b=PZhSyKn0rBq8tzcP5Bek1yLJg+XNjZNPiL4LicVXac8ZOnPsWOnWA/9I80VfEM4619 g5ay6vTG1iOzQj4ZH+Ab5XNGun/Iazle8Ji9pUkAGLMi2e0llijrwn+V/yw5k+v/9Luh RzJbb8msOTGWs80BMmcTGN4oLQohW5sbBQId13ax1T8cACnTMXSM57HORJikYJABP05Y 2AX9yXWr89Mwke4BESf25avuAOE7dLikndEcqN49udXL2cEUvH21ZM8j0MuNZ9J6gnou jI1RYyDbtxgC9SexfytFdTs6FJo2prck5CqbvHYZFhbG0bmUDr6FmBp4iMJnL9/K/rYm 7JHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687974691; x=1690566691; 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=UIfoyCpUUajyFpMhMqY2mJy3ksaLY6ORUfahwyFeKps=; b=BMjkqhCrx/nN8bOYjoEIjntF4oFm4DKJwGtCCzs6brtaHMAcn3I430JmFhJ5yxZDXk l/mvtWD9RESKLyQPVqeHH1uUsxIH7T5BG4qlhVCYxJ9Vy/ToMpHRUlzsidiZz2Ff75qG K83zu6WHbRMEaFYunJ7ijVPvk8ddHvAqph7XeBQiyiA+BKdjZyDPv4otso06+BV4/xc3 SwuxFvRIBBNuGyzpHBQ/VS7BfpbSydgAvlU471r+tvoExRr4Wuo45ZRVC8UufPKQ9MpR O5oo3JOYvxAbBJe9vxvTuEMyWlsF0KUXxQcqcatIe+HmeiiiU6HO1dOMZPdku7OG55QY voxA== X-Gm-Message-State: AC+VfDwxUjLK+VzH7groyjBoH7FWMnVkkBE26yeJz6JcFqcHZGQbaliG YXwVGNWvLpp7htVZ7GwnX2gzD8EgBsKgsjpwEP97Hw== X-Received: by 2002:a2e:3e08:0:b0:2b6:9ed0:46f4 with SMTP id l8-20020a2e3e08000000b002b69ed046f4mr8648646lja.23.1687974691162; Wed, 28 Jun 2023 10:51:31 -0700 (PDT) MIME-Version: 1.0 References: <20230626-provable-angrily-81760e8c3cc6@wendy> <20230626-sensuous-clothing-124f7ae0aedf@wendy> <20230628-gizzard-trading-a5f9785128b5@spud> In-Reply-To: <20230628-gizzard-trading-a5f9785128b5@spud> From: Evan Green Date: Wed, 28 Jun 2023 10:50:55 -0700 Message-ID: Subject: Re: [PATCH v1 6/9] RISC-V: add single letter extensions to riscv_isa_ext To: Conor Dooley Cc: Conor Dooley , palmer@dabbelt.com, Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Albert Ou , Andrew Jones , Heiko Stuebner , Sunil V L , linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Wed, Jun 28, 2023 at 10:43=E2=80=AFAM Conor Dooley wr= ote: > > On Wed, Jun 28, 2023 at 10:33:20AM -0700, Evan Green wrote: > > On Mon, Jun 26, 2023 at 4:21=E2=80=AFAM Conor Dooley wrote: > > > > > > So that riscv_fill_hwcap() can use riscv_isa_ext to probe for single > > > letter extensions, add them to it. riscv_isa_ext_data grows a new > > > member, signifying whether an extension is multi-letter & thus requir= ing > > > special handling. > > > As a result, what gets spat out in /proc/cpuinfo will become borked, = as > > > single letter extensions will be printed as part of the base extensio= ns > > > and while printing from riscv_isa_arr. Take the opportunity to unify = the > > > printing of the isa string, using the new member of riscv_isa_ext_dat= a > > > in the process. > > > > > > Signed-off-by: Conor Dooley > > > --- > > > arch/riscv/include/asm/hwcap.h | 1 + > > > arch/riscv/kernel/cpu.c | 36 ++++++---------------- > > > arch/riscv/kernel/cpufeature.c | 56 +++++++++++++++++++++-----------= -- > > > 3 files changed, 46 insertions(+), 47 deletions(-) > > > > > > diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/= hwcap.h > > > index a35bee219dd7..6ad896dc4342 100644 > > > --- a/arch/riscv/include/asm/hwcap.h > > > +++ b/arch/riscv/include/asm/hwcap.h > > > @@ -77,6 +77,7 @@ unsigned long riscv_get_elf_hwcap(void); > > > struct riscv_isa_ext_data { > > > const unsigned int id; > > > const char *name; > > > + const bool multi_letter; > > > > Instead of defining a new member, could we just infer this by making a > > macro like #define MULTI_LETTER(name) (name[0] && name[1])? > > Or don't even try to be clever like this and just call strnlen on the > name & check if it is 1? It's only used in 2 places. Sounds good to me!