RISC-V: Track ISA extensions per hart
authorEvan Green <evan@rivosinc.com>
Tue, 9 May 2023 18:25:02 +0000 (11:25 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Mon, 19 Jun 2023 16:51:22 +0000 (09:51 -0700)
commit82e9c66e81c814e20ee2a3aafb60a9012c79fb40
tree2f4aeeb8cd3205f32f6f521ba38fbe97872b991b
parentc6699baf10647b87b075bf6c65d25b4cd52d4830
RISC-V: Track ISA extensions per hart

The kernel maintains a mask of ISA extensions ANDed together across all
harts. Let's also keep a bitmap of ISA extensions for each CPU. Although
the kernel is currently unlikely to enable a feature that exists only on
some CPUs, we want the ability to report asymmetric CPU extensions
accurately to usermode.

Note that riscv_fill_hwcaps() runs before the per_cpu_offsets are built,
which is why I've used a [NR_CPUS] array rather than per_cpu() data.

Signed-off-by: Evan Green <evan@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Link: https://lore.kernel.org/r/20230509182504.2997252-3-evan@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/cpufeature.h
arch/riscv/kernel/cpufeature.c