From patchwork Tue Nov 7 10:55: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: 13448497 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 30BD0C4332F for ; Tue, 7 Nov 2023 10:56:13 +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=otK6sXzu86lyIBhq/HSynW4+y8OfHPdPr5CDDG2iE5I=; b=SLxL2LNCGNqzEK ksaY6MBMVGrkRPavWy3mvtIz1r8lqCQNj+X4LPsVqK4t65OyDoNiWUPXLNn+MAWYR0d4a3190f/8B qwckuS7ns0gVnHzRdm6/+vtaeuEFOHcqEWgOOAP+7ahoGKDU5r7cI6a9Pf0I1vqrU7jR/yi8v+5/h Jy7upE9WCGPd4mY+eLvbNd+nxU6zikiex+U8Og5oGoJsDVHsdufvXrtJSrPcgR28Ss6NOwpdUIgk0 vE6t7FaLbgGIlUUTO+ZhbNNQ2Rlle+lN6Z9t8hTZ7FPLQM4CL1YTMctWEhobv2cH6HNF1a8KNgI/j JsCFsCdro1v6377O1x0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkd-00197i-1E; Tue, 07 Nov 2023 10:56:07 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0JkZ-00195A-27 for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:05 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2c6eac9c053so17671161fa.1 for ; Tue, 07 Nov 2023 02:56:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354560; x=1699959360; 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=TTPh4b9H/nO8hrW4fuWs0VYK/m0j/zKHKOI67JxMX58=; b=0RzPSw/xHUKJ301sU7ArHIym9ovQb9nqYGOmD14ZXTzd38EI8eIVxT5sTIPjD7P18Y LT2qKvR8Eu/SzDL1RgsbvZgy6p9AslCVRqos2QmCGDbothMPbrx4csKZwCRcE18rN0Uc y3FqPO5R0cLl06MtJam2Aoa5EFjQcwJSNpMja5DX9ZIXZLzte4yxxlWUeSvJJirYD/U1 2M157lwVuSxEzvdQ6HHV4v+USBw+6aAgHxlHbqpCxNQnxe6T1MDYwbU4suWa24iiSI+7 y970V1tPCjeBtS2YqagZrhPJJ2C242dGwFY//6G00sxFFa0EFjC9veKQQgByfh/6yr0l uNgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354560; x=1699959360; 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=TTPh4b9H/nO8hrW4fuWs0VYK/m0j/zKHKOI67JxMX58=; b=P3+p3nVVhr8BNy1ea1+uBo3hEBGfiKZPlcl89OTgn7KVjw7mYSM4uFmhpY5aGytwTi Iw8vlGfYqHm9dOKv6YaJ2W2UJKeeYRIv629vDEqjglu0jWGGZxcTXxAH9P75/Z7qhx13 953+mTRAY28iEVqf25BdMCKDXxFZGbAPxxuCbYQt52FwuQkMz7RHrg9fygjGXb88y7Y3 D7CeK6sIbInW0UML90sfW07/lkF+0EulissNaOR1/8BHOZf4rY07QTeCxC4+NigR/z0W Ns59HiMlx+n/XBlBT2+w0tsVaMNrr/O8hRND+wcgST2qNh6ubB/X0pisH2GbKhvxDt9i 8BUA== X-Gm-Message-State: AOJu0Yxlspi8Clju/W3haXM/OjKdI90moFsukBRZTQo9XettdFIz+rFC IQWQh0QUZI4uCQewbpRcEOCIC9K10lWksg48on0E6Q== X-Google-Smtp-Source: AGHT+IH6kSTyN/uSnqdIlgzf5lG+Dfp4JV8XqbpNFHyUam9HN1gSjiiGpNBk+IykQOWB11yd1ldOxw== X-Received: by 2002:a2e:a9a2:0:b0:2bf:e5dc:aa68 with SMTP id x34-20020a2ea9a2000000b002bfe5dcaa68mr26713821ljq.3.1699354559989; Tue, 07 Nov 2023 02:55:59 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.55.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:55:59 -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 Subject: [PATCH v3 00/20] riscv: report more ISA extensions through hwprobe Date: Tue, 7 Nov 2023 11:55:36 +0100 Message-ID: <20231107105556.517187-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-20231107_025603_902831_32DAD1AE X-CRM114-Status: GOOD ( 12.72 ) 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 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: hwprobe: factorize hwprobe ISA extension reporting 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 | 210 ++++++++++++++++++ arch/riscv/include/asm/hwcap.h | 36 ++- arch/riscv/include/uapi/asm/hwprobe.h | 26 +++ arch/riscv/kernel/cpufeature.c | 189 ++++++++++++++-- arch/riscv/kernel/sys_riscv.c | 64 ++++-- 6 files changed, 566 insertions(+), 40 deletions(-)