2023-07-10 10:01:09

by Conor Dooley

[permalink] [raw]
Subject: [PATCH v4 00/11] RISC-V: Probe DT extension support using riscv,isa-extensions & riscv,isa-base

Hey,

Based on my latest iteration of deprecating riscv,isa [1], here's an
implementation of the new properties for Linux. The first few patches,
up to "RISC-V: split riscv_fill_hwcap() in 3", are all prep work that
further tames some of the extension related code, on top of my already
applied series that cleans up the ISA string parser.
Perhaps "RISC-V: shunt isa_ext_arr to cpufeature.c" is a bit gratuitous,
but I figured a bit of coalescing of extension related data structures
would be a good idea. Note that riscv,isa will still be used in the
absence of the new properties. Palmer suggested adding a Kconfig option
to turn off the fallback for DT, which I have gone and done. It's locked
behind the NONPORTABLE option for good reason.

In v2, I've also come up with a more reasonable name for the new
function I added & fixed up various comments from Drew and Evan.

In v3, there's the new commandline option that Drew suggested. I have
Also picked up a patch from Palmer that adds more helpful prints where
harts fail the checks in riscv_early_of_processor_id(), and I've
sprinkled a few more of those prints in my new additions to the
function.

v4 just rebases on v6.5-rc1 and fixes the nommu build issue due to a
missing __init.

Cheers,
Conor.

[1] (it's in v6.5-rc1 now)

CC: Rob Herring <[email protected]>
CC: Krzysztof Kozlowski <[email protected]>
CC: Paul Walmsley <[email protected]>
CC: Palmer Dabbelt <[email protected]>
CC: Albert Ou <[email protected]>
CC: Jonathan Corbet <[email protected]>
CC: Andrew Jones <[email protected]>
CC: Heiko Stuebner <[email protected]>
CC: Evan Green <[email protected]>
CC: Sunil V L <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

Conor Dooley (9):
RISC-V: drop a needless check in print_isa_ext()
RISC-V: shunt isa_ext_arr to cpufeature.c
RISC-V: repurpose riscv_isa_ext array in riscv_fill_hwcap()
RISC-V: add missing single letter extension definitions
RISC-V: add single letter extensions to riscv_isa_ext
RISC-V: split riscv_fill_hwcap() in 3
RISC-V: enable extension detection from new properties
RISC-V: try new extension properties in of_early_processor_hartid()
RISC-V: provide Kconfig & commandline options to control parsing
"riscv,isa"

Heiko Stuebner (1):
RISC-V: don't parse dt/acpi isa string to get rv32/rv64

Palmer Dabbelt (1):
RISC-V: Provide a more helpful error message on invalid ISA strings

.../admin-guide/kernel-parameters.txt | 7 +
arch/riscv/Kconfig | 18 +
arch/riscv/include/asm/hwcap.h | 17 +-
arch/riscv/kernel/cpu.c | 179 +++---
arch/riscv/kernel/cpufeature.c | 519 ++++++++++++------
5 files changed, 437 insertions(+), 303 deletions(-)

--
2.40.1



2023-07-10 10:03:39

by Conor Dooley

[permalink] [raw]
Subject: [PATCH v4 03/11] RISC-V: drop a needless check in print_isa_ext()

isa_ext_arr cannot be empty, as some of the extensions within it are
always built into the kernel. When this code was first added, back in
commit a9b202606c69 ("RISC-V: Improve /proc/cpuinfo output for ISA
extensions"), the array was empty and needed a dummy item & thus there
could be no extensions present. When the first multi-letter ones did
get added, it was Sscofpmf - which didn't have a Kconfig symbol to
disable it.

Remove this check, as it has been redundant since Sscofpmf was added.

Reviewed-by: Andrew Jones <[email protected]>
Signed-off-by: Conor Dooley <[email protected]>
---
Changes in v2:
- Reword commit message to explain why this can be dropped
---
arch/riscv/kernel/cpu.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c
index f808b67f5a27..e721f15fdf17 100644
--- a/arch/riscv/kernel/cpu.c
+++ b/arch/riscv/kernel/cpu.c
@@ -237,10 +237,6 @@ static void print_isa_ext(struct seq_file *f)

arr_sz = ARRAY_SIZE(isa_ext_arr) - 1;

- /* No extension support available */
- if (arr_sz <= 0)
- return;
-
for (i = 0; i <= arr_sz; i++) {
edata = &isa_ext_arr[i];
if (!__riscv_isa_extension_available(NULL, edata->isa_ext_id))
--
2.40.1