Backport JDK-8316859 for riscv64

This commit is contained in:
Dingli Zhang 2024-05-06 13:35:27 +08:00
parent 4d5c2e7ff5
commit a40dafa445
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 1013f0b0b911d24eed216485767ec6eb080afa81 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Mon, 25 Sep 2023 08:01:45 +0000
Subject: [PATCH] 8316859: RISC-V: Disable detection of V through HWCAP
---
.../os_cpu/linux_riscv/vm_version_linux_riscv.cpp | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp b/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp
index 454ffbb06d390..69bbf9f366b31 100644
--- a/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp
+++ b/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp
@@ -149,12 +149,21 @@ void VM_Version::setup_cpu_available_features() {
void VM_Version::os_aux_features() {
uint64_t auxv = getauxval(AT_HWCAP);
- int i = 0;
- while (_feature_list[i] != nullptr) {
+ for (int i = 0; _feature_list[i] != nullptr; i++) {
+ if (_feature_list[i]->feature_bit() == HWCAP_ISA_V) {
+ // Special case for V: some dev boards only support RVV version 0.7, while
+ // the OpenJDK only supports RVV version 1.0. These two versions are not
+ // compatible with each other. Given the V bit is set through HWCAP on
+ // some custom kernels, regardless of the version, it can lead to
+ // generating V instructions on boards that don't support RVV version 1.0
+ // (ex: Sipeed LicheePi), leading to a SIGILL.
+ // That is an acceptable workaround as only Linux Kernel v6.5+ supports V,
+ // and that version already support hwprobe anyway
+ continue;
+ }
if ((_feature_list[i]->feature_bit() & auxv) != 0) {
_feature_list[i]->enable_feature();
}
- i++;
}
}

View File

@ -894,7 +894,7 @@ Name: java-latest-%{origin}
Version: %{newjavaver}.%{buildver}
# This package needs `.rolling` as part of Release so as to not conflict on install with
# java-X-openjdk. I.e. when latest rolling release is also an LTS release packaged as
Release: 1
Release: 2
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
@ -977,6 +977,13 @@ Patch6: rh1684077-openjdk_should_depend_on_pcsc-lite-libs_instead_of_pcsc-lite-d
Patch7: downgrade-the-glibc-symver-of-memcpy.patch
Patch8: downgrade-the-glibc-symver-of-log2f-posix_spawn.patch
############################################
#
# RISC-V specific patches
#
############################################
Patch2000: 8316859-RISC-V-Disable-detection-of-V-through-HWCAP.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: alsa-lib-devel
@ -1210,6 +1217,12 @@ popd # openjdk
%patch1000
%ifarch riscv64
pushd %{top_level_dir_name}
%patch2000 -p1
popd
%endif
# Extract systemtap tapsets
%if %{with_systemtap}
tar --strip-components=1 -x -I xz -f %{SOURCE8}
@ -1773,6 +1786,9 @@ cjc.mainProgram(arg)
%changelog
* Mon May 06 2024 Dingli Zhang <dingli@iscas.ac.cn> - 1:21.0.0.35-2
- Backport JDK-8316859 for riscv64
* Mon Nov 27 2023 kuenking111 <wangkun49@huawei.com> - 1:21.0.0.35-1
- Change vendor name to BiSheng