Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp4037992pxp; Tue, 15 Mar 2022 11:07:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6flRU7tTOuRMwtjqEFstZy8/dZxp54KCg7F2U+leQD+dy7O0h2jQU90v5uAR7y8+0/Xsu X-Received: by 2002:aa7:8211:0:b0:4f7:8b7:239b with SMTP id k17-20020aa78211000000b004f708b7239bmr29897302pfi.64.1647367625978; Tue, 15 Mar 2022 11:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647367625; cv=none; d=google.com; s=arc-20160816; b=DxPkFlko3KJzpTuN4A+SW/ySXBcRK8yW+j9v6EE95X4y7Oll6ZHk/CV8XJoNKwhz9N bJJ9kWYkYPiUQcJBj7J8c6E4oqmUs5drUUYxxHUprrgV+g/TJ/fpDQqhSp+eTK72cN3G x6LBzN34SNqLTWl0LV/XmS9A4TH8qaBPeZcPrcb5H6mpREKIbjqvh9xVXNrv4x7Sc5nX PBdS7bksfBAMCtLNMfH8v6zqWBgG/cb4NvayHnqkinDyATC153VPydBLKb/RR0dZ+H8y AfOT6aKoKADvSGU70nMFedzPcU4LsX92wD+1zQZvCCRjnDQ6SCTKrDH1fj+IZkEBkMec 3RYA== 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=6w3smz0Oju2eB1A2qrt4ZKtokvH1F+OKqqamdL7L7P4=; b=SA736c3vn3yQlEfjKZ4Bg6N5kESnztuaAt+iV+FLwt3XAmXtUra9IBnXLdKxU8fkiw PEB9prBTBoAqsdfwMWolewxj4quI13bQ7dV3e9ACn7PKAJDTwmjKC3tDz2ftS3+40/H2 46x+O3lEpia06XUFxfNeVD91mxSq38WS1gYwykZewHpUmF9h+E1+vg5KLb3zOZ82vxFI hqE4O/QDq9eqG/2Mo/dhHBKtXV8gH/CE7tBQXZug7k+tSUJqAWER8eIa/wPBkLzGdfEC gEioWjnwuqBP2npSrHUf1BuEdeuDjBciV2d9Nw023soAd1rmkrz+xaL9K8fNqGd7zdwp iwkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=pdMnUTk+; 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 x125-20020a633183000000b0038176734775si1321359pgx.637.2022.03.15.11.06.51; Tue, 15 Mar 2022 11:07:05 -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=pdMnUTk+; 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 S245034AbiCNUkL (ORCPT + 99 others); Mon, 14 Mar 2022 16:40:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240136AbiCNUkK (ORCPT ); Mon, 14 Mar 2022 16:40:10 -0400 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F809340EA for ; Mon, 14 Mar 2022 13:38:59 -0700 (PDT) Received: by mail-qt1-x834.google.com with SMTP id j21so7865766qta.0 for ; Mon, 14 Mar 2022 13:38:59 -0700 (PDT) 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=6w3smz0Oju2eB1A2qrt4ZKtokvH1F+OKqqamdL7L7P4=; b=pdMnUTk+FxlOr0gcR6zu3Q3yrpEn5lHgpsJ7lD6tENqImWy+nWDQ07qXGibnvAZczi W6tj7yTDQv1Ba/F7OQUNHNehdhKHCuw3xUJxj4SIaMvSARglSlK7TFbieFmzMdMMIE63 vivff60xvi2SY4dAPo8Whzm0S1NtIjb5NwzSuPWk4XhVHGZ2fYCoQE0+GroYxBaR/r+H Rg4dQprmKpEKwAGYNlkkTjxqyLZTHR5pWxX4bOtYj07JrjnUlHFsoZMDglcnFGHNrsmn fIq42izBdQmHAGMMbHbjyhFaGvKtJ5ibxOsaLaNyJKjP4RglNZMQTCCIYNUJqonJVPUB 2ETQ== 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=6w3smz0Oju2eB1A2qrt4ZKtokvH1F+OKqqamdL7L7P4=; b=oxCO0z9T+ZTEkwCy/4DXwA7g/C5Fg5s8AqXQXAblvWJIl5Re4qDZwCkINX08mq5URN tPcVN0d2qzSrGTg867G3PmWYZg1amUzuVSLt4ykjWM+YKiNRYA4BZbBLNtNZyZY8NbP3 qRawxwmWjGT215pkH2nNXUMF4IPozSGvl5vJkaTteRFpuEbxAcOI8xLmXD351Tgm11Vy HATYH/MJgBanB3MmlCgrbtU6aWF4w9CtP17cRZKD04Wnfj9Kod5xQA0Azi0K4+QLInjt lLz+uKD+DHE3x7ALXQDHg0HrnezXnkdkeotb5jCUCwoDSd3pbF27PsNGeIDfUcmODMKq J9DA== X-Gm-Message-State: AOAM532+8+rxARgKy+2cc1dCRdhRYHORZturyHBko5qhDDmu0SXMPZ2A B+6jY7YaXYjBli6OzWsH00mXFFGc8y74iA== X-Received: by 2002:a05:622a:1647:b0:2e0:6f65:c54d with SMTP id y7-20020a05622a164700b002e06f65c54dmr20443570qtj.193.1647290338403; Mon, 14 Mar 2022 13:38:58 -0700 (PDT) Received: from rivos-atish.ba.rivosinc.com (adsl-70-228-75-190.dsl.akrnoh.ameritech.net. [70.228.75.190]) by smtp.gmail.com with ESMTPSA id j188-20020a3755c5000000b0067d1c76a09fsm8597023qkb.74.2022.03.14.13.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Mar 2022 13:38:57 -0700 (PDT) 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 v6 0/6] Provide a fraemework for RISC-V ISA extensions Date: Mon, 14 Mar 2022 13:38:39 -0700 Message-Id: <20220314203845.832648-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 : rv64imafdch_svpbmt_svnapot_svinval mmu : sv48 processor : 1 hart : 1 isa : rv64imafdch_svpbmt_svnapot_svinval mmu : sv48 processor : 2 hart : 2 isa : rv64imafdch_svpbmt_svnapot_svinval mmu : sv48 processor : 3 hart : 3 isa : rv64imafdch_svpbmt_svnapot_svinval 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/e9e240c9a854dceb434ceb53bdbe82a657bee5f2 Changes from v5->v6: 1. Changed the isa extension format from separate row to single row that follows RISC-V spec naming standards. 2. Removed the redundant extension detection log. Changes from v4->v5: 1. Improved the /proc/cpuinfo to include only valid & enabled extensions 2. Improved the multi-letter parsing by skipping the 'su' modes generated in Qemu as suggested by Tsukasa. Changes from v3->v4: 1. Changed temporary variable for current hart isa to a bitmap 2. Added reviewed-by tags. 3. Improved comments 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 | 65 ++++++++++++++++- arch/riscv/kernel/cpufeature.c | 128 +++++++++++++++++++++++++++------ 3 files changed, 195 insertions(+), 23 deletions(-) -- 2.30.2