From patchwork Tue Nov 14 14:12:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13455345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0164EC4167D for ; Tue, 14 Nov 2023 14:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=EyxtnwCrpQfXlyzUWl8N5YccXMGJ3DjFXdDjT39sKmQ=; b=CxEdSPzc+nbqD8 JbFEUE6fj8xzKC3WEesjzXWW1cCqTB+zMvBBQ+POyD6F+wU9kqV9P96lupSqXroD8ki7/G22tre8H gbZdN4AzrCqi5I4pOQSAfgO5m8DoJu8PZ5qxaA4pIruuPR0Wq+yJuH2CAKZr9/4dwQbGhHc6i+9Jd t7RfPRK/JSMzK8xwE2ZzmPwvlyhG52oDHYg6O+8pT1ZCgr1Hfb/WsRF+kNu1LF4IAUrm7eK1YOH8t klZmRWuHUnm0LF/XE8FCy3xi6FGljy5kBhuwl5wBqSCN3liCRuq0NCjEKpHe19P+ZJo4lrAlO2EyC y0NqXsqxg0IQYjnxJg9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r2uAd-00G8pu-2T; Tue, 14 Nov 2023 14:13:39 +0000 Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r2uAZ-00G8ml-0w for linux-riscv@lists.infradead.org; Tue, 14 Nov 2023 14:13:38 +0000 Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-778a25cad6dso14497785a.0 for ; Tue, 14 Nov 2023 06:13:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699971210; x=1700576010; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HQjQphgrA/D8IHhb5D1IdcN3VnDD+XZViad2Wn0dvR0=; b=jhzhlw+LBY5tQwu1SuDFLKroqEHqdimD7t7o4/k2qg5zT49wQU/liNQ5tV9cuAqxOy FtGU191sJoMd+gZbwkTIbUB1QOi0EzvB7c7lNHmQSilODi2w3M4D9eXqB3utznRMKDpv e1mZ52d2LwXER9gnQdzewJgdGDAtYxUlQ/O1RQ7R8VMf1Z1KCFs/G7L1HV49G9SHh1ir Gs6iuOOBtVN/YbS4ZBHAk+Xw+RNqA+QE4pdYICWtgYWZQUd40aeRGfL106HTuR9xMNW5 5WN2+tSJl28b/ahVyj4cF1k0flsE5VgjF2LqpFUBREHQ/JgNHFL898Ix81v1FxzHHZaw PXZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699971210; x=1700576010; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HQjQphgrA/D8IHhb5D1IdcN3VnDD+XZViad2Wn0dvR0=; b=h5m2klaPWVrbA+Uo+Hmo+EJ/OcVtDdrhTHnTm7uVrMQ0F6wlvxRq0i68kXLVGm0E10 1URJ7PmpLlNuGZU54poIS0FYHjYCyVtu4+Lu8N6dBm9r2SKEc48Iw7ti1CidnliY+hSe ywwXjbzV0SjfaR571GFH5qKXY1br936zw4Z8GIpu7ap+1Q9lfjxwmGv83aZaqryx0GEP xpVcu6vbRkMwwLP01EbhtuMqvxLCxLkkpb9IM1/Lt7qHER4zmnnVswtYn6bXzVnPc35t 2E2hssHWF5oN0Ej47rIrlpUqTG+6iJTZ2kFvs7w/suC/OBi3OuQ6C7bU7RQWFxd4K6jH WH+w== X-Gm-Message-State: AOJu0YxCXRsh6SS2r8PB5qu1rGuOuH23kGrKppYYQEoUUoi22Ykr5Fdg KdcG/gPxTy+U4KaIcZeWjNDPNs+AmdYmFD0wVnZL5g== X-Google-Smtp-Source: AGHT+IGheyAGwa9SEinQILE8hC+p0W4sbxl1g6NAUPPkIdAxCstjHbETQlMdJWiCH5rmRKIUUwuHcQ== X-Received: by 2002:a05:620a:3941:b0:778:8ae9:2247 with SMTP id qs1-20020a05620a394100b007788ae92247mr2341870qkn.5.1699971210654; Tue, 14 Nov 2023 06:13:30 -0800 (PST) Received: from carbon-x1.. ([12.186.190.2]) by smtp.gmail.com with ESMTPSA id m2-20020a05620a220200b00777611164c5sm2701263qkh.106.2023.11.14.06.13.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 06:13:30 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz , Jerry Shih Subject: [PATCH v4 00/20] riscv: report more ISA extensions through hwprobe Date: Tue, 14 Nov 2023 09:12:36 -0500 Message-ID: <20231114141256.126749-1-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231114_061335_331280_986C3347 X-CRM114-Status: GOOD ( 15.67 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org In order to be able to gather more information about the supported ISA extensions from userspace using the hwprobe syscall, add more ISA extensions report. This series adds the following ISA extensions parsing support: - Zfh[min] - Zvfh[min] - Zihintntl - Zbc - Zvbb - Zvbc - Zvkb - Zvkg - Zvkned - Zvknh[ab] - Zvksed - Zvksh - Zvkn - Zvknc - Zvkng - Zvks - Zvksc - Zvksg - Zvkt - Zfa - Zbkb - Zbkc - Zbkx - Zknd - Zkne - Zknh - Zkr - Zksed - Zksh - Zkt Some of these extensions are actually shorthands for other "sub" extensions. This series includes a patch from Conor/Evan that adds a way to specify such "bundled" extensions. When exposing these bundled extensions to userspace through hwprobe, only the "sub" extensions are exposed. In order to test it, one can use qemu and the small hwprobe utility provided[1]. Run qemu by specifying additional ISA extensions, for instance: $ qemu-system-riscv64 -cpu rv64,v=true,zk=true,zvksh=true,zvkned=true Then, run hwprobe: $ ./hwprobe Base system ISA: - IMA_FD - C - V Supported extensions: - Zba - Zbb - Zbs - Zbc - Zbkb - Zbkc - Zbkx - Zknd - Zkne - Zknh - Zkt - Zvkned - Zvksh - Zihintntl - Zfa Link: https://github.com/clementleger/hwprobe_dump [1] --- Changes in V4: - Rebase on master - Do not represent zvknhb as a superset anymore - Remove mention to hwprobe in dt-bindings documents - Add a text specifying that Zkr string dt binding means that the CSR provided by Zkr are accessible only by the privilege level to which the device-tree has been provided. - Use a pointer for extension instead of struct copy in patch 1 - Add missing RISCV_ISA_EXT_ZBC define - Remove ISA check macro since another similar commit was merged Changes in V3: - Rebased on top of origin/master - Rename bundle_ext to subset_ext since it is used for superset extensions (Zvbb for instance). - Add an invalid id for pure lasso extension - Fix wrong type for check_isa ext, int -> unsigned int - Use bundled extension for ZVBB/ZVNHB - Split ZBC hwprobe support from scalar crypto patch - Fix typos (Evan) - Added a few Rb: from Evan - Change Zfh/Zfhmin to Zfh[min] to be more coherent with other commits - Reword comment about CHECK_ISA_EXT to be more clear Changes in V2: - Fix typo in first commit title (fatorize->factorize) - Add Zfa support - Fix missing uppercase for Zvkt naming in dt-bindings - Add Conor Acked-by on dt-bindings commits - Add scalar crypto support from Conor/Evan. - Use reporting of bunbled extensions for vector crypto Clément Léger (19): riscv: add ISA extension parsing for Zbc riscv: hwprobe: export missing Zbc ISA extension riscv: hwprobe: add support for scalar crypto ISA extensions dt-bindings: riscv: add scalar crypto ISA extensions description riscv: add ISA extension parsing for vector crypto riscv: hwprobe: export vector crypto ISA extensions dt-bindings: riscv: add vector crypto ISA extensions description riscv: add ISA extension parsing for Zfh/Zfh[min] riscv: hwprobe: export Zfh[min] ISA extensions dt-bindings: riscv: add Zfh[min] ISA extensions description riscv: add ISA extension parsing for Zihintntl riscv: hwprobe: export Zhintntl ISA extension dt-bindings: riscv: add Zihintntl ISA extension description riscv: add ISA extension parsing for Zvfh[min] riscv: hwprobe: export Zvfh[min] ISA extensions dt-bindings: riscv: add Zvfh[min] ISA extension description riscv: add ISA extension parsing for Zfa riscv: hwprobe: export Zfa ISA extension dt-bindings: riscv: add Zfa ISA extension description Evan Green (1): riscv: add ISA extension parsing for scalar crypto Documentation/arch/riscv/hwprobe.rst | 81 +++++++ .../devicetree/bindings/riscv/extensions.yaml | 213 ++++++++++++++++++ arch/riscv/include/asm/cpufeature.h | 4 +- arch/riscv/include/asm/hwcap.h | 30 ++- arch/riscv/include/uapi/asm/hwprobe.h | 26 +++ arch/riscv/kernel/cpufeature.c | 189 ++++++++++++++-- arch/riscv/kernel/sys_riscv.c | 33 +++ 7 files changed, 551 insertions(+), 25 deletions(-)