82e9c66e81
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>
34 lines
661 B
C
34 lines
661 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright 2022-2023 Rivos, Inc
|
|
*/
|
|
|
|
#ifndef _ASM_CPUFEATURE_H
|
|
#define _ASM_CPUFEATURE_H
|
|
|
|
#include <linux/bitmap.h>
|
|
#include <asm/hwcap.h>
|
|
|
|
/*
|
|
* These are probed via a device_initcall(), via either the SBI or directly
|
|
* from the corresponding CSRs.
|
|
*/
|
|
struct riscv_cpuinfo {
|
|
unsigned long mvendorid;
|
|
unsigned long marchid;
|
|
unsigned long mimpid;
|
|
};
|
|
|
|
struct riscv_isainfo {
|
|
DECLARE_BITMAP(isa, RISCV_ISA_EXT_MAX);
|
|
};
|
|
|
|
DECLARE_PER_CPU(struct riscv_cpuinfo, riscv_cpuinfo);
|
|
|
|
DECLARE_PER_CPU(long, misaligned_access_speed);
|
|
|
|
/* Per-cpu ISA extensions. */
|
|
extern struct riscv_isainfo hart_isa[NR_CPUS];
|
|
|
|
#endif
|