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: 16331 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp150456vqo; Tue, 7 Nov 2023 02:56:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHyN8WwBxDsJOIfUTlC4/2iij9uz4YrBatjhJFlZlDHiH6c8CQhfoMRJ0ZbECyvMyCzk1z7 X-Received: by 2002:a17:903:2845:b0:1cc:77af:e85b with SMTP id kq5-20020a170903284500b001cc77afe85bmr17715399plb.38.1699354606921; Tue, 07 Nov 2023 02:56:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699354606; cv=none; d=google.com; s=arc-20160816; b=FWL/5oZ2dlP/8bCPn/o6fXMWHpTNCDHFaqTgdm2Q9FYmBu+TwgSfdG3vHQKxmPUtof Yb/tkpeismUwPUsi3mNzt9OxpIs4Xzk7ZB8iPFmG75lykOgOIyU0XMp2RW8DyCeZ8T7T EjxSLjAJ/jfyJc3qvPnY6lzNSAkyDQ3eObesfZTrvG2W0oeiyjcWmscmmSdR0dIy+xUW 0VcsYs5g1cqghxYQFPly2t7R7PX7l11/CX+WaDx30c15d4X/OQu730afDHVLy7yjlN5c aDX09MV1CZfyFHW8JTN7fgzdJ5avX57e5ltpqByhTo2vajiUfvMallULWJgGtLwFIzYZ kfPA== 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=TTPh4b9H/nO8hrW4fuWs0VYK/m0j/zKHKOI67JxMX58=; fh=lvGFqwUxN+Dx1jonz8cRGrvjuKDcjMXylffmtrJGOYA=; b=BdZGA47WcxDe9bI4JsDZTSy0Yji5AgEHHhMIQzin2b879LiuX6VHV4NAHdTIxjE9+U rNTskeAv2nUSHsW6nBQo2uJtLXi00nse2s4yfI1f9oBaygUDYLipDTVGZyBSjQCqL9oq 7f1tF+EtGcY3C/VOQVcETCaPfA9kINLiodTwpkIPs8ynqtGhWBfa71H23WaID26JJk3U pj2rzYPxXlwxLFC78+Fscan/49Od/w3x0+llWWTCY3uVCP+ASqKI8t4MONn85E/wkUS4 F3cnTma6i8HKH0cpUmljq93ypdQqf+xd8B8hFFMVWyt6MFsizwUPIQRWGoJG/qxPHeXw KSkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=dG2tWBbh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id lb7-20020a170902fa4700b001c0cbaf6970si9422609plb.501.2023.11.07.02.56.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=dG2tWBbh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 6BD57802B814; Tue, 7 Nov 2023 02:56:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234001AbjKGK4N (ORCPT + 32 others); Tue, 7 Nov 2023 05:56:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233960AbjKGK4J (ORCPT ); Tue, 7 Nov 2023 05:56:09 -0500 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C03B6102 for ; Tue, 7 Nov 2023 02:56:01 -0800 (PST) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c6eac9c053so17671121fa.1 for ; Tue, 07 Nov 2023 02:56:01 -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=vger.kernel.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=dG2tWBbhRDHvbIkW5ClEAiaUyelabHcTrliKlXVzC2YLfDNI49M7R8iTAiy5vo/Yn1 JAn40viFDD0tXr0nabvxcYbgPDrw9cD6gLge9dm+IJIdVHvtSEJhfSpzyyIbWajLII04 XCMFyowDBR+d/3RUpU5cI+K/NQJB2gg2hlRpG6U4FHd3Ueicij5MLhanD+1+AiT+OT+M 4qat3VKGM8VAyIn+yHFcaGbRocLC83zZrBW6lAECJrL3wZjXwqZRK93no7yq/I0rG/pb uUnMIrJ+EiXY2fayyJoqFaanmpf+l3IE+8v4p+0S/TZM+RtVdtO2zlfSMg4w0kSwJ1Md na/g== 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=m8VjSVgJcUDg/hwA4LKTjym3gttLPWruCAosykDscTWbagyd+1u9V7Cia8+GX7uAYA 2QIHsUZ988bdJjztHH8c6YJ4zIMySo8yOuJ+LqLrgLE1AxTsE8taVlCjFRm9wZUaWl32 b3hPNA40oKnH/YTLP/BiVDitbOTqzRz5f/Is0dH831h5IbVEauR+wo2VfugrXTkhLMpQ QtHrvIPk4ieFFCp1XpTXykWvq1JIKhpv8xCxkwo9PMFOQfgPSH0X6+E+it8fuP0GTLJr Z8Uxf5HlQet0Ef3ppgNuYl45238L21cphta3If0exQOMsybzZ7xPRb0PSiCWmi3phJxS WPkg== X-Gm-Message-State: AOJu0YwNmDqpu2lMZ28c+QCU5/3tIAnRDgVwoe0X8A35mWsYL9vFJfXo lFhegXB+dTHFSvMofU3k2Fxrlw== 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-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 07 Nov 2023 02:56:37 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781902456234836507 X-GMAIL-MSGID: 1781902456234836507 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(-)