Skip to content

Commit

Permalink
8315195: RISC-V: Update hwprobe query for new extensions
Browse files Browse the repository at this point in the history
Reviewed-by: fyang, fjiang, luhenry
  • Loading branch information
robehn committed Sep 1, 2023
1 parent b4f7069 commit 0d4cadb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
16 changes: 16 additions & 0 deletions src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
#define RISCV_HWPROBE_KEY_IMA_EXT_0 4
#define RISCV_HWPROBE_IMA_FD (1 << 0)
#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_MISALIGNED_UNKNOWN (0 << 0)
Expand Down Expand Up @@ -129,6 +133,18 @@ void RiscvHwprobe::add_features_from_query_result() {
if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_IMA_C)) {
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)) {
VM_Version::unaligned_access.enable_feature(
query[RISCV_HWPROBE_KEY_CPUPERF_0].value & RISCV_HWPROBE_MISALIGNED_MASK);
Expand Down
10 changes: 1 addition & 9 deletions src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,11 @@ void VM_Version::vendor_features() {

void VM_Version::rivos_features() {
// 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_Zicboz.enable_feature();
ext_Zicbop.enable_feature();

// If we running on a pre-6.5 kernel
ext_Zba.enable_feature();
ext_Zbb.enable_feature();
ext_Zbs.enable_feature();
Expand Down

0 comments on commit 0d4cadb

Please sign in to comment.