mbox series

[v4,00/20] riscv: report more ISA extensions through hwprobe

Message ID 20231114141256.126749-1-cleger@rivosinc.com (mailing list archive)
Headers show
Series riscv: report more ISA extensions through hwprobe | expand

Message

Clément Léger Nov. 14, 2023, 2:12 p.m. UTC
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
  <whatever options you want>

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(-)

Comments

Conor Dooley Nov. 22, 2023, 4:16 p.m. UTC | #1
On Tue, Nov 14, 2023 at 09:12:36AM -0500, Clément Léger wrote:
> Changes in V4:
>  - 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.

This text don't match what the change was. Here you say "only", but the
binding has the IMO correct wording, with "only" removed.
patchwork-bot+linux-riscv@kernel.org Dec. 12, 2023, 10:20 p.m. UTC | #2
Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Tue, 14 Nov 2023 09:12:36 -0500 you wrote:
> 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
> 
> [...]

Here is the summary with links:
  - [v4,01/20] riscv: add ISA extension parsing for Zbc
    https://git.kernel.org/riscv/c/88e752f0986f
  - [v4,02/20] riscv: hwprobe: export missing Zbc ISA extension
    https://git.kernel.org/riscv/c/2ae2b9097b2e
  - [v4,03/20] riscv: add ISA extension parsing for scalar crypto
    https://git.kernel.org/riscv/c/5ee88a915d4b
  - [v4,04/20] riscv: hwprobe: add support for scalar crypto ISA extensions
    https://git.kernel.org/riscv/c/18883cef7e64
  - [v4,05/20] dt-bindings: riscv: add scalar crypto ISA extensions description
    https://git.kernel.org/riscv/c/ffd19e815367
  - [v4,06/20] riscv: add ISA extension parsing for vector crypto
    https://git.kernel.org/riscv/c/4fa9e167b63b
  - [v4,07/20] riscv: hwprobe: export vector crypto ISA extensions
    https://git.kernel.org/riscv/c/d06b89615a9e
  - [v4,08/20] dt-bindings: riscv: add vector crypto ISA extensions description
    https://git.kernel.org/riscv/c/eb8c82b7a8c4
  - [v4,09/20] riscv: add ISA extension parsing for Zfh/Zfh[min]
    https://git.kernel.org/riscv/c/68bddb2748ac
  - [v4,10/20] riscv: hwprobe: export Zfh[min] ISA extensions
    https://git.kernel.org/riscv/c/5cb9bea00d12
  - [v4,11/20] dt-bindings: riscv: add Zfh[min] ISA extensions description
    https://git.kernel.org/riscv/c/6853ab83405c
  - [v4,12/20] riscv: add ISA extension parsing for Zihintntl
    https://git.kernel.org/riscv/c/8ab84bf68d2b
  - [v4,13/20] riscv: hwprobe: export Zhintntl ISA extension
    https://git.kernel.org/riscv/c/814d9823088a
  - [v4,14/20] dt-bindings: riscv: add Zihintntl ISA extension description
    https://git.kernel.org/riscv/c/4bd2e33d1613
  - [v4,15/20] riscv: add ISA extension parsing for Zvfh[min]
    https://git.kernel.org/riscv/c/c7fa1ef17e6f
  - [v4,16/20] riscv: hwprobe: export Zvfh[min] ISA extensions
    https://git.kernel.org/riscv/c/9a42ab69b658
  - [v4,17/20] dt-bindings: riscv: add Zvfh[min] ISA extension description
    https://git.kernel.org/riscv/c/1f532a7d898e
  - [v4,18/20] riscv: add ISA extension parsing for Zfa
    https://git.kernel.org/riscv/c/4758aec519ae
  - [v4,19/20] riscv: hwprobe: export Zfa ISA extension
    https://git.kernel.org/riscv/c/f838a77a4881
  - [v4,20/20] dt-bindings: riscv: add Zfa ISA extension description
    https://git.kernel.org/riscv/c/e810a257576f

You are awesome, thank you!