8315195: RISC-V: Update hwprobe query for new extensions

Reviewed-by: fyang, fjiang, luhenry
This commit is contained in:
Robbin Ehn 2023-09-01 14:40:29 +00:00
parent b4f7069c5b
commit 0d4cadb824
2 changed files with 17 additions and 9 deletions

View File

@ -45,6 +45,10 @@
#define RISCV_HWPROBE_KEY_IMA_EXT_0 4 #define RISCV_HWPROBE_KEY_IMA_EXT_0 4
#define RISCV_HWPROBE_IMA_FD (1 << 0) #define RISCV_HWPROBE_IMA_FD (1 << 0)
#define RISCV_HWPROBE_IMA_C (1 << 1) #define RISCV_HWPROBE_IMA_C (1 << 1)
#define RISCV_HWPROBE_IMA_V (1 << 2)
#define RISCV_HWPROBE_EXT_ZBA (1 << 3)
#define RISCV_HWPROBE_EXT_ZBB (1 << 4)
#define RISCV_HWPROBE_EXT_ZBS (1 << 5)
#define RISCV_HWPROBE_KEY_CPUPERF_0 5 #define RISCV_HWPROBE_KEY_CPUPERF_0 5
#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0)
@ -129,6 +133,18 @@ void RiscvHwprobe::add_features_from_query_result() {
if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_IMA_C)) { if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_IMA_C)) {
VM_Version::ext_C.enable_feature(); VM_Version::ext_C.enable_feature();
} }
if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_IMA_V)) {
VM_Version::ext_V.enable_feature();
}
if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_EXT_ZBA)) {
VM_Version::ext_Zba.enable_feature();
}
if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_EXT_ZBB)) {
VM_Version::ext_Zbb.enable_feature();
}
if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_EXT_ZBS)) {
VM_Version::ext_Zbs.enable_feature();
}
if (is_valid(RISCV_HWPROBE_KEY_CPUPERF_0)) { if (is_valid(RISCV_HWPROBE_KEY_CPUPERF_0)) {
VM_Version::unaligned_access.enable_feature( VM_Version::unaligned_access.enable_feature(
query[RISCV_HWPROBE_KEY_CPUPERF_0].value & RISCV_HWPROBE_MISALIGNED_MASK); query[RISCV_HWPROBE_KEY_CPUPERF_0].value & RISCV_HWPROBE_MISALIGNED_MASK);

View File

@ -224,19 +224,11 @@ void VM_Version::vendor_features() {
void VM_Version::rivos_features() { void VM_Version::rivos_features() {
// Enable common features not dependent on marchid/mimpid. // Enable common features not dependent on marchid/mimpid.
ext_I.enable_feature();
ext_M.enable_feature();
ext_A.enable_feature();
ext_F.enable_feature();
ext_D.enable_feature();
ext_C.enable_feature();
ext_H.enable_feature();
ext_V.enable_feature();
ext_Zicbom.enable_feature(); ext_Zicbom.enable_feature();
ext_Zicboz.enable_feature(); ext_Zicboz.enable_feature();
ext_Zicbop.enable_feature(); ext_Zicbop.enable_feature();
// If we running on a pre-6.5 kernel
ext_Zba.enable_feature(); ext_Zba.enable_feature();
ext_Zbb.enable_feature(); ext_Zbb.enable_feature();
ext_Zbs.enable_feature(); ext_Zbs.enable_feature();