|
From: Florian K. <fk...@so...> - 2026-03-13 22:37:30
|
https://sourceware.org/cgit/valgrind/commit/?id=f86f6e5a157c533d69558dc629c13ab3f6c75309 commit f86f6e5a157c533d69558dc629c13ab3f6c75309 Author: Florian Krohm <fl...@ei...> Date: Fri Mar 13 22:36:23 2026 +0000 s390: Add VEX_HWCAPS_S390X_MRMM In b640fa64b8 z196 was chosen to be the minimum required machine model. That machine provides a list of facilities (aka hardware capabilities). But show_hwcaps_s390x did not show them. This patch adds VEX_HWCAPS_S390X_MRMM (where MRMM means Minimum Required Machine Model) which represents all hardware capabilities of that machine. Also: drop the "s390x" prefix in show_hwcaps_s390x because "s390x" isn't a hardware capability. When running with -d hardware capabilities are shown like so: --1085356:1: main ... arch = S390X, hwcaps = z196-vx-msa5-mi2-lsc2-vxe-dflt-vxe2-vxd-msa8-msa9-msa12 Diff: --- VEX/priv/main_main.c | 9 ++++----- VEX/pub/libvex.h | 4 +++- coregrind/m_machine.c | 3 +++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index e2f20fc31c..b9a18a9d28 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -1899,11 +1899,11 @@ static const HChar* show_hwcaps_arm64 ( UInt hwcaps ) static const HChar* show_hwcaps_s390x ( UInt hwcaps ) { - static const HChar prefix[] = "s390x"; static const struct { UInt hwcaps_bit; HChar name[6]; } hwcaps_list[] = { + { VEX_HWCAPS_S390X_MRMM, "z196" }, /* always first */ { VEX_HWCAPS_S390X_VX, "vx" }, { VEX_HWCAPS_S390X_MSA5, "msa5" }, { VEX_HWCAPS_S390X_MI2, "mi2" }, @@ -1919,8 +1919,7 @@ static const HChar* show_hwcaps_s390x ( UInt hwcaps ) { VEX_HWCAPS_S390X_MSA12, "msa12" }, }; /* Allocate a large enough buffer */ - static HChar buf[sizeof prefix + - NUM_HWCAPS * (sizeof hwcaps_list[0].name + 1) + 1]; // '\0' + static HChar buf[NUM_HWCAPS * (sizeof hwcaps_list[0].name + 1) + 1]; // '\0' if (buf[0] != '\0') return buf; /* already constructed */ @@ -1929,8 +1928,8 @@ static const HChar* show_hwcaps_s390x ( UInt hwcaps ) hwcaps = VEX_HWCAPS_S390X(hwcaps); - p = buf + vex_sprintf(buf, "%s", prefix); - for (i = 0 ; i < NUM_HWCAPS; ++i) { + p = buf + vex_sprintf(buf, "%s", hwcaps_list[0].name); + for (i = 1 ; i < NUM_HWCAPS; ++i) { if (hwcaps & hwcaps_list[i].hwcaps_bit) p = p + vex_sprintf(p, "-%s", hwcaps_list[i].name); } diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index f22a264f81..fe41048d9e 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -176,6 +176,7 @@ typedef #define VEX_HWCAPS_S390X_MI3 (1 << 17) /* Miscellaneous-instruction-extensions facility 3 */ #define VEX_HWCAPS_S390X_VXE3 (1 << 18) /* Vector-enhancements facility 3 */ #define VEX_HWCAPS_S390X_MSA12 (1 << 19) /* Msg.-security-assist extension 12 */ +#define VEX_HWCAPS_S390X_MRMM (1 << 19) /* Minimum required machine model */ /* Special value representing all available s390x hwcaps */ #define VEX_HWCAPS_S390X_ALL (VEX_HWCAPS_S390X_VX | \ @@ -191,7 +192,8 @@ typedef VEX_HWCAPS_S390X_MSA9 | \ VEX_HWCAPS_S390X_MI3 | \ VEX_HWCAPS_S390X_VXE3 | \ - VEX_HWCAPS_S390X_MSA12) + VEX_HWCAPS_S390X_MSA12 | \ + VEX_HWCAPS_S390X_MRMM) #define VEX_HWCAPS_S390X(x) ((x) & ~VEX_S390X_MODEL_MASK) #define VEX_S390X_MODEL(x) ((x) & VEX_S390X_MODEL_MASK) diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c index 7676b4353e..c564a10b19 100644 --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c @@ -1535,6 +1535,8 @@ Bool VG_(machine_get_hwcaps)( void ) identification yet. Keeping fingers crossed. */ model = VG_(get_machine_model)(); + /* When upgrading the minimum machine model do not forget to adjust + VEX_HWCAPS_S390X_MMM below and in main_main.c */ if (model < VEX_S390X_MODEL_Z196) { VG_(message)(Vg_FailMsg, "Your machine is too old. " "You need at least a z196 to run valgrind.\n"); @@ -1574,6 +1576,7 @@ Bool VG_(machine_get_hwcaps)( void ) const UInt hwcaps_bit; const HChar name[6]; // may need adjustment for new facility names } fac_hwcaps[] = { + { True, 0, VEX_HWCAPS_S390X_MRMM, "Z196" }, /* always first */ { False, 129, VEX_HWCAPS_S390X_VX, "VX" }, { False, 57, VEX_HWCAPS_S390X_MSA5, "MSA5" }, { False, 58, VEX_HWCAPS_S390X_MI2, "MI2" }, |