From e33cb6d538f8295793b872420a033bf881f808de Mon Sep 17 00:00:00 2001 From: vicwang-oc Date: Fri, 5 Sep 2025 10:26:57 +0800 Subject: [PATCH] add zhaoxin processers support. --- openjdk-17.spec | 7 ++- zhaoxin_processers_support.patch | 88 ++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 zhaoxin_processers_support.patch diff --git a/openjdk-17.spec b/openjdk-17.spec index 1311fa6..33715e3 100644 --- a/openjdk-17.spec +++ b/openjdk-17.spec @@ -920,7 +920,7 @@ Provides: java-src%{?1} = %{epoch}:%{version}-%{release} Name: java-%{javaver}-%{origin} Version: %{newjavaver}.%{buildver} -Release: 2 +Release: 3 # 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 @@ -1075,6 +1075,7 @@ Patch83: huawei-AArch64-Incorrect-matching-rule.patch #17.0.16 Patch84: huawei-remove-provides-in-kaeprovider-module-info.patch +Patch85: zhaoxin_processers_support.patch ############################################ # @@ -1377,6 +1378,7 @@ pushd %{top_level_dir_name} %patch82 -p1 %patch83 -p1 %patch84 -p1 +%patch85 -p1 popd # openjdk %endif @@ -2001,6 +2003,9 @@ cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect %changelog +* Fri Sep 5 2025 vicwang-oc - 1:17.0.16.8-3 +- add zhaoxin processers support. + * Tue Jul 29 2025 wulongyao - 1:17.0.16.8-2 - sync master diff --git a/zhaoxin_processers_support.patch b/zhaoxin_processers_support.patch new file mode 100644 index 0000000..809a680 --- /dev/null +++ b/zhaoxin_processers_support.patch @@ -0,0 +1,88 @@ +diff --git a/src/hotspot/cpu/x86/vm_version_ext_x86.cpp b/src/hotspot/cpu/x86/vm_version_ext_x86.cpp +index a84b37f7977..045903fc9cc 100644 +--- a/src/hotspot/cpu/x86/vm_version_ext_x86.cpp ++++ b/src/hotspot/cpu/x86/vm_version_ext_x86.cpp +@@ -403,6 +403,7 @@ int VM_Version_Ext::number_of_sockets(void) { + + const char* VM_Version_Ext::cpu_family_description(void) { + int cpu_family_id = extended_cpu_family(); ++ int cpu_model_id = extended_cpu_model(); + if (is_amd()) { + if (cpu_family_id < ExtendedFamilyIdLength_AMD) { + return _family_id_amd[cpu_family_id]; +@@ -419,6 +420,23 @@ const char* VM_Version_Ext::cpu_family_description(void) { + if (is_hygon()) { + return "Dhyana"; + } ++ if (is_zx()) { ++ if (cpu_family_id == 7) { ++ switch (cpu_model_id) { ++ case 0x1B: ++ return "wudaokou"; ++ case 0x3B: ++ return "lujiazui"; ++ case 0x5B: ++ return "yongfeng"; ++ case 0x6B: ++ return "shijidadao"; ++ } ++ } else if (cpu_family_id == 6) { ++ return "zhangjiang"; ++ } ++ } ++ + return "Unknown x86"; + } + +@@ -438,6 +456,9 @@ int VM_Version_Ext::cpu_type_description(char* const buf, size_t buf_len) { + } else if (is_hygon()) { + cpu_type = "Hygon"; + x64 = cpu_is_em64t() ? " AMD64" : ""; ++ } else if (is_zx()) { ++ cpu_type = "Zhaoxin"; ++ x64 = cpu_is_em64t() ? "x86_64" : ""; + } else { + cpu_type = "Unknown x86"; + x64 = cpu_is_em64t() ? " x86_64" : ""; +diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp +index 33435239146..5cafca0d232 100644 +--- a/src/hotspot/cpu/x86/vm_version_x86.cpp ++++ b/src/hotspot/cpu/x86/vm_version_x86.cpp +@@ -703,9 +703,17 @@ void VM_Version::get_processor_features() { + if (UseSSE < 1) + _features &= ~CPU_SSE; + +- //since AVX instructions is slower than SSE in some ZX cpus, force USEAVX=0. +- if (is_zx() && ((cpu_family() == 6) || (cpu_family() == 7))) { +- UseAVX = 0; ++ //ZX cpus specific settings ++ if (is_zx() && FLAG_IS_DEFAULT(UseAVX)) { ++ if (cpu_family() == 7) { ++ if (extended_cpu_model() == 0x5B || extended_cpu_model() == 0x6B) { ++ UseAVX = 1; ++ } else if (extended_cpu_model() == 0x1B || extended_cpu_model() == 0x3B) { ++ UseAVX = 0; ++ } ++ } else if (cpu_family() == 6) { ++ UseAVX = 0; ++ } + } + + // first try initial setting and detect what we can support +diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp b/src/hotspot/cpu/x86/vm_version_x86.hpp +index 6c081c06d12..dd219739f31 100644 +--- a/src/hotspot/cpu/x86/vm_version_x86.hpp ++++ b/src/hotspot/cpu/x86/vm_version_x86.hpp +@@ -975,6 +975,12 @@ public: + } else { + return 128; // Athlon + } ++ } else if (is_zx()) { // ZX ++ if (supports_sse2()) { ++ return 256; ++ } else { ++ return 128; ++ } + } else { // Intel + if (supports_sse3() && cpu_family() == 6) { + if (supports_sse4_2() && supports_ht()) { // Nehalem based cpus -- Gitee