Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6437872pxb; Tue, 15 Feb 2022 02:24:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVvHNS+ampIgyqeEVmhChV8R2jefxF8Mba6SovUyc8e7hpI4FJmFQFQ0YalbKazbVUMLe7 X-Received: by 2002:a17:90b:1d04:b0:1b9:337d:490 with SMTP id on4-20020a17090b1d0400b001b9337d0490mr3600149pjb.144.1644920666735; Tue, 15 Feb 2022 02:24:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644920666; cv=none; d=google.com; s=arc-20160816; b=yQ/pjzBtZPFi7xO43V/+/bBMKBOeuvm5aExQRFR78Rn1A43bkU7xWfsCjJRNenjkkS 28MJLEHX3eg7Q1S5B7Z4bLFOk9k/1kc6ccnjF3s46ILmH5fc2LxZmjxVtTRqnACCbQgF jNk128Aaz/+4bbxVuz1qoBHUE5EZ94G2G4JN+abs6dBk7bAOSOCgdNwh0Gq0DLMoJBDG EZhFbrt4uM5emWyo9xN8q8x/oU1XiNt8upPzPO8xK0sXMdgVFbZSZhZ8BWAzxi8JqF/h w4CTwEMLI3mSJCNeGEO+ecDJX8iNE1f9z+voRLqjXGKNpZ0H0crejjPhMQEAZ+iRH88h 8iZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=94zuPq2u7S7IuvdQC3T3gt4sxQz8uNo1pA51T1QzfOM=; b=E6Wh40dFs2V1jskTd6DAYWP5F0mSg7ecxgp47sKB8RMVn0AOePdJvslwaVVBTTJkL0 8VcsFqRPHhGVQD6Le1YXCkUHirGJc+KgOAT4lgUhliz3lRNA55gzHY2QXEwjDCz/6GHn XAAPiFbGQ1JzBXo3YUEZ3Y4ehqAgfnGzriJHr/BmqkX+sTpj1CqTTSHTqOZgVQrA1WCH O/OPAYxUe9zfMZ2oGs0HEkCCmmJbrSi/jqXmDzhw+0soI0gjrJM252huNJzUudv1fTCg JcA6PBEvU5FBfT+/5Kze5UCEm2utJUES6+fili2ny0XwQ/SYaQ7C4DmCbN/0gTE93KNt rK9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=oXqITTty; 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 x24si2266789pgc.506.2022.02.15.02.24.11; Tue, 15 Feb 2022 02:24:26 -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=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=oXqITTty; 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 S235526AbiBOJCp (ORCPT + 99 others); Tue, 15 Feb 2022 04:02:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235139AbiBOJCm (ORCPT ); Tue, 15 Feb 2022 04:02:42 -0500 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50150114FDF for ; Tue, 15 Feb 2022 01:02:31 -0800 (PST) Received: by mail-qv1-xf2a.google.com with SMTP id x3so11353905qvd.8 for ; Tue, 15 Feb 2022 01:02:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=94zuPq2u7S7IuvdQC3T3gt4sxQz8uNo1pA51T1QzfOM=; b=oXqITTtyvfd9bHj1UUEuwmPenKxCQ5523q9nzwEO8w5VJCBGzM9ghj2KUA5i0TjLFx Ys12W+pBymEITarI/Mt2wWZlxCb9r+0ZbJvahV7goHiEwztoJzjZz9HkbhU2/y1ZxjWm Gkdakdeo+UKhfCbL99UQyRy8XK6Llrpv53n8cHI/rydrfz8IUoLPxwbcIYaU0abEiWxF hmub8pVPRIS05ocu3J/0jpsILbBMGht6GEGMypdtGG13zkdEl41Ec1rqHilNUq8bkYo5 fx24g/02Shkj9e9P0tG8RgjqGp1EX1yEi815/fkcBpz3DlTF3/k+KqTilxk7w7qm4KRH Rg9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=94zuPq2u7S7IuvdQC3T3gt4sxQz8uNo1pA51T1QzfOM=; b=AZribKxmmfcuWvpl9Gm09EqXk6kYFa+jnUQLYwFVV65W8lSWj+bDAufBXeOvqpXT3u BUDhl0uKfWbw59ELgUQ1mKesKJTQWdAWIoIcSG5/N1BWT5pZgg0/NRnwusacag5NGRh0 DuSBBF8HvQOEYI1fBOh/I6f4zxn6pjKHmlR3LDI98Is9vETPH1WSLJk/oXkZOjrQo438 zcPj9bT9ezpn4klhP0YB/8m8rrpJE4afQpj2dQ0+dKL2oGQJcWThD2jkot6mOoYWYhtN qpsE4I6W71NmiQTHYwTbmTnc979SEMyWVRm2AIZEMTmlw8stXYscR3zTVP9KXYrK7+Bb mnMA== X-Gm-Message-State: AOAM531LEkzQ537gCQsoyUldumGX+HUL0dCMe4d4ePIHeDNMl7utr9PN Y1dnYZDLWoUNmSSKstSTu3SCvFBQ8xnpHp5+ X-Received: by 2002:a05:6214:21a5:: with SMTP id t5mr1975944qvc.51.1644915750023; Tue, 15 Feb 2022 01:02:30 -0800 (PST) Received: from rivos-atish.. (adsl-70-228-75-190.dsl.akrnoh.ameritech.net. [70.228.75.190]) by smtp.gmail.com with ESMTPSA id w4sm17711158qko.123.2022.02.15.01.02.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 01:02:29 -0800 (PST) From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Albert Ou , Atish Patra , Anup Patel , Damien Le Moal , devicetree@vger.kernel.org, Jisheng Zhang , Krzysztof Kozlowski , linux-riscv@lists.infradead.org, Palmer Dabbelt , Paul Walmsley , Rob Herring Subject: [PATCH v3 0/6] Provide a fraemework for RISC-V ISA extensions Date: Tue, 15 Feb 2022 01:02:05 -0800 Message-Id: <20220215090211.911366-1-atishp@rivosinc.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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=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 This series implements a generic framework to parse multi-letter ISA extensions. This series is based on Tsukasa's v3 isa extension improvement series[1]. I have fixed few bugs and improved comments from that series (PATCH1-3). I have not used PATCH 4 from that series as we are not using ISA extension versioning as of now. We can add that later if required. PATCH 4 allows the probing of multi-letter extensions via a macro. It continues to use the common isa extensions between all the harts. Thus hetergenous hart systems will only see the common ISA extensions. PATCH 6 improves the /proc/cpuinfo interface for the available ISA extensions via /proc/cpuinfo. Here is the example output of /proc/cpuinfo: (with debug patches in Qemu and Linux kernel) / # cat /proc/cpuinfo processor : 0 hart : 0 isa : rv64imafdcsu isa-ext : sstc,sscofpmf mmu : sv48 processor : 1 hart : 1 isa : rv64imafdcsu isa-ext : sstc,sscofpmf mmu : sv48 processor : 2 hart : 2 isa : rv64imafdcsu isa-ext : sstc,sscofpmf mmu : sv48 processor : 3 hart : 3 isa : rv64imafdcsu isa-ext : sstc,sscofpmf mmu : sv48 Anybody adding support for any new multi-letter extensions should add an entry to the riscv_isa_ext_id and the isa extension array. E.g. The patch[2] adds the support for various ISA extensions. [1] https://lore.kernel.org/all/0f568515-a05e-8204-aae3-035975af3ee8@irq.a4lg.com/T/ [2] https://github.com/atishp04/linux/commit/dc6f9200033bb5a72d8fd1a179bb272c6ade17e6 Changes from v2->v3: 1. Updated comments to mark clearly a fix required for Qemu only. 2. Fixed a bug where the 1st multi-letter extension can be present without _ 3. Added Tested by tags. Changes from v1->v2: 1. Instead of adding a separate DT property use the riscv,isa property. 2. Based on Tsukasa's v3 isa extension improvement series. Atish Patra (3): RISC-V: Implement multi-letter ISA extension probing framework RISC-V: Do no continue isa string parsing without correct XLEN RISC-V: Improve /proc/cpuinfo output for ISA extensions Tsukasa OI (3): RISC-V: Correctly print supported extensions RISC-V: Minimal parser for "riscv, isa" strings RISC-V: Extract multi-letter extension names from "riscv, isa" arch/riscv/include/asm/hwcap.h | 25 +++++++ arch/riscv/kernel/cpu.c | 44 ++++++++++- arch/riscv/kernel/cpufeature.c | 130 ++++++++++++++++++++++++++++----- 3 files changed, 178 insertions(+), 21 deletions(-) -- 2.30.2