Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1073345rwb; Tue, 29 Nov 2022 08:39:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf766HyHQ15xcULpUcowR1cYoO3lBIHwLE6qTiUy9Vqy5Zd3UuGvQquTNHyk52LA2T1PyG9b X-Received: by 2002:a17:906:8616:b0:7ac:db70:3ab5 with SMTP id o22-20020a170906861600b007acdb703ab5mr48669063ejx.160.1669739970864; Tue, 29 Nov 2022 08:39:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669739970; cv=none; d=google.com; s=arc-20160816; b=rS4b8myHqrTP7UcKqSnGNtIpAPgqv5fOQrZA8GcoswuieKGZTXWzPSGF7WxZ4ny5A8 uMZB8ulauxpA87biDFk3yohOUEGYKSkMtE9V5qxIOfmJ8inyuayr9qH4m6XsBFPKLih1 tyUzu6uHrBJKoGOSQqmOmS8G4QfQhV2XJWlNWBBKp8lWqKBRk1EE/5fGzqo7L+04ZkVK AxxHvDwjhjykVNJQk7Qcd7CSr4o4WPV1Q4Dk0rwTdAf6pvQHRmmEmFF16J4/ZWcHhbkH 2tH6AYQYulcD4iPMwqRUpZcxOozv2/sTE8Vv3nAKjkVnWdruyTaRepgXwk4fkp7iGZ2N Weag== 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=a2BTyx6zja/aiP2vpU1kgbIcNE6NH07BMx/8T7jRK2A=; b=TLWPJ/xDn3K2Zp4YOL/8y8xYL/kY+Xlj0vvWsFGlquGMPo/qBUEiS3P3kQ6CmfHfFJ fFQ4BTAxWyLG0t5mejggig25fCa9x3p1qClWS5ps20Bl0XvH3RNCiUWaoCqJ7j+SCkNy jLA7fyO5JVlwlBs3Y9p8KljIp4GPa1MUEEFQGkXv7vy+fqAd5Rf2F20Thyias9gCZ3dL ZAvd3bM177UOR2tXznnpAmsOssc1ijx/XZdf6DRIzLaSca6B2Chd3WxK2bZnt4gZCLzw wSzWKkicevUHDGYr0rq4gMX7ljoimNQK7krz+FgM2rep1MUy2E8bwhepYL1Y4dCz2R8x 0HJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=ANvZAIuN; 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 sy24-20020a1709076f1800b00783ac0b4d32si10383375ejc.941.2022.11.29.08.39.10; Tue, 29 Nov 2022 08:39:30 -0800 (PST) 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=@ventanamicro.com header.s=google header.b=ANvZAIuN; 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 S236117AbiK2QM6 (ORCPT + 84 others); Tue, 29 Nov 2022 11:12:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236004AbiK2QM3 (ORCPT ); Tue, 29 Nov 2022 11:12:29 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C52368C4A for ; Tue, 29 Nov 2022 08:12:27 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id b2so18702116eja.7 for ; Tue, 29 Nov 2022 08:12:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=a2BTyx6zja/aiP2vpU1kgbIcNE6NH07BMx/8T7jRK2A=; b=ANvZAIuNiA+jgFYRHiId7bCAXZ0st4A1Ivv1McCza4miewPJjMOnECcdKk8SgJhoEn xtw4y16QpvZ0E/V8080GtKCOvg2LMJMtzgqCEGoPi4rfQR2n84LHNczcRXT+8/xJ3VkU LGVDginlRkG/X+io9Ml3rtrtf0oPd7OaXKasWvdj3soNdyxD6fo9D5MBVVcvhF27mJ0f lEICX3kOVnfuG+b6ZbisSmnCk3Q30EWVlR9UDBK4wA3NuWRKENrPWb8kZ6ITfxmTD9+k kamM45FdTepWPGm9/Lmybfv9ZIQKSYlWOmqCqKOfGJp2a0i1Y+yf+jdYcDM8XbxkEG7j LivA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=a2BTyx6zja/aiP2vpU1kgbIcNE6NH07BMx/8T7jRK2A=; b=AZL/RW55aLTAxuPa7rAzQ1Gs0rgvkbnCQE6beqqyuBwyd47uuMsq8o+jtg5xn+x5FZ emfekeS1JQOjIOqNnzaRrw0ZMFOS5bDC4CTUxBGOBy9yq0AR3zmNpYEMOLFiarGj9uLk aljE83GYWsUbKd1aeFHyKY5VJ3mfYncxg719sz2K9lXWwqXglMfIS6I1KriZ+JJWbGdS h8N85QNH314QJ3kz+MB2kRLipqMoN9wYlsx1SFmZZ1f+5CsAojFK7i+gRE5mmVr4DnVe 3r/vq+R/yEAxkdW1nIEjxvCR12IgNorHQSfu57oRoDY0yZ0VuHYFcwiiu4aQgwZMrRpW Balg== X-Gm-Message-State: ANoB5plJzruUYgKK7bi09I849a40H8HE1fGvZmmHxiv6o3cTGtFBlRqM aEQYXnzaixAIgdEvJb8OehajTQ== X-Received: by 2002:a17:906:844:b0:78c:2c03:804c with SMTP id f4-20020a170906084400b0078c2c03804cmr36090401ejd.107.1669738345813; Tue, 29 Nov 2022 08:12:25 -0800 (PST) Received: from localhost (2001-1ae9-1c2-4c00-748-2a9a-a2a6-1362.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:748:2a9a:a2a6:1362]) by smtp.gmail.com with ESMTPSA id p23-20020a17090635d700b00780b1979adesm6318224ejb.218.2022.11.29.08.12.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Nov 2022 08:12:25 -0800 (PST) Date: Tue, 29 Nov 2022 17:12:23 +0100 From: Andrew Jones To: Conor Dooley Cc: linux-riscv@lists.infradead.org, aou@eecs.berkeley.edu, conor@kernel.org, devicetree@vger.kernel.org, guoren@kernel.org, heiko@sntech.de, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, palmer@dabbelt.com, paul.walmsley@sifive.com, robh+dt@kernel.org Subject: Re: [RFC 1/2] RISC-V: clarify ISA string ordering rules in cpu.c Message-ID: <20221129161223.gelsvctfnqg7pdwb@kamzik> References: <20221129144742.2935581-2-conor.dooley@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221129144742.2935581-2-conor.dooley@microchip.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Tue, Nov 29, 2022 at 02:47:42PM +0000, Conor Dooley wrote: > While the list of rules may have been accurate when created, it now > lacks some clarity in the face of isa-manual updates. Specifically: > > - there is no mention here of a distinction between regular 'Z' > extensions which are "Additional Standard Extensions" and "Zxm" > extensions which are "Standard Machine-Level Extensions" > > - there is also no explicit mention of where either should be sorted in > the list > > - underscores are only required between two *multi-letter* extensions but > the list of rules implies that this is required between a multi-letter > extension and any other extension. IOW "rv64imafdzicsr_zifencei" is a > valid string > > Attempt to clean up the list of rules, by adding information on the > above & sprinkling in some white space for readability. > > Signed-off-by: Conor Dooley > --- > arch/riscv/kernel/cpu.c | 22 +++++++++++++++++----- > 1 file changed, 17 insertions(+), 5 deletions(-) > > diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c > index 852ecccd8920..5e42c92a8456 100644 > --- a/arch/riscv/kernel/cpu.c > +++ b/arch/riscv/kernel/cpu.c > @@ -120,20 +120,32 @@ device_initcall(riscv_cpuinfo_init); > .uprop = #UPROP, \ > .isa_ext_id = EXTID, \ > } > + > /* > * Here are the ordering rules of extension naming defined by RISC-V > * specification : > - * 1. All extensions should be separated from other multi-letter extensions > - * by an underscore. > + * > + * 1. All multi-letter extensions should be separated from other multi-letter > + * extensions by an underscore. > + * > * 2. The first letter following the 'Z' conventionally indicates the most > * closely related alphabetical extension category, IMAFDQLCBKJTPVH. > - * If multiple 'Z' extensions are named, they should be ordered first > - * by category, then alphabetically within a category. > + * 'Z' extensions should be sorted after single-letter extensions and before > + * any higher-privileged extensions. > + * If multiple 'Z' extensions are named, they should be ordered first by > + * category, then alphabetically within a category. > + * > * 3. Standard supervisor-level extensions (starts with 'S') should be > * listed after standard unprivileged extensions. If multiple > * supervisor-level extensions are listed, they should be ordered > * alphabetically. > - * 4. Non-standard extensions (starts with 'X') must be listed after all > + * > + * 4 Standard machine-level extensions (starts with 'Zxm') should be > + * listed after any lower-privileged, standard extensions. If multiple > + * machine-level extensions are listed, they should be ordered > + * alphabetically. > + * > + * 5. Non-standard extensions (starts with 'X') must be listed after all > * standard extensions. They must be separated from other multi-letter > * extensions by an underscore. > */ > -- > 2.38.1 > Alternatively, we could change the comment to just point out the spec chapter and provide an example, e.g. /* * The canonical order of ISA extension names in the ISA string is defined in * chapter 27 of the unprivileged spec. An example string following the * order is * * rv64imadc_zifoo_zigoo_zafoo_sbar_scar_zxmbaz_xqux_xrux * * Notice how Z-extensions are first sorted by category using the canonical * order of the first letter following the Z. Extension groups are in the * order specified in chapter 27. Extensions within each group are sorted * alphabetically. */ Thanks, drew