From 346881fb0afa5edebaaae3a7c595ed2672b551eb Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 21 Nov 2025 15:51:53 +0000 Subject: [PATCH] s390: long displacement facility related cleanups (BZ 509562) The long displacement facilities are always present on the supported machines. - Remove s390_host_has_ldisp and VEX_HWCAPS_S390X_LDISP - Update tests/s390x_features.c Part of fixing https://bugs.kde.org/show_bug.cgi?id=509562 --- VEX/priv/host_s390_defs.h | 2 -- VEX/priv/main_main.c | 4 ---- VEX/pub/libvex.h | 4 +--- coregrind/m_machine.c | 20 +------------------- none/tests/libvex_test.c | 2 +- tests/s390x_features.c | 2 -- 6 files changed, 3 insertions(+), 31 deletions(-) diff --git a/VEX/priv/host_s390_defs.h b/VEX/priv/host_s390_defs.h index fdcc199c6..8fc1a94b9 100644 --- a/VEX/priv/host_s390_defs.h +++ b/VEX/priv/host_s390_defs.h @@ -918,8 +918,6 @@ VexInvalRange patchProfInc_S390(VexEndness endness_host, extern UInt s390_host_hwcaps; /* Convenience macros to test installed facilities */ -#define s390_host_has_ldisp \ - (s390_host_hwcaps & (VEX_HWCAPS_S390X_LDISP)) #define s390_host_has_eimm \ (s390_host_hwcaps & (VEX_HWCAPS_S390X_EIMM)) #define s390_host_has_gie \ diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index 8f3ab8945..c40e642b9 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -1923,7 +1923,6 @@ static const HChar* show_hwcaps_s390x ( UInt hwcaps ) UInt hwcaps_bit; HChar name[6]; } hwcaps_list[] = { - { VEX_HWCAPS_S390X_LDISP, "ldisp" }, { VEX_HWCAPS_S390X_EIMM, "eimm" }, { VEX_HWCAPS_S390X_GIE, "gie" }, { VEX_HWCAPS_S390X_DFP, "dfp" }, @@ -2298,9 +2297,6 @@ static void check_hwcaps ( VexArch arch, UInt hwcaps ) } case VexArchS390X: - if (! s390_host_has_ldisp) - invalid_hwcaps(arch, hwcaps, - "Host does not have long displacement facility.\n"); return; case VexArchMIPS32: diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index a1eb48f41..a3345af5b 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -162,7 +162,6 @@ typedef #define VEX_S390X_MODEL_UNKNOWN 19 /* always last in list */ #define VEX_S390X_MODEL_MASK 0x3F -#define VEX_HWCAPS_S390X_LDISP (1<<6) /* Long-displacement facility */ #define VEX_HWCAPS_S390X_EIMM (1<<7) /* Extended-immediate facility */ #define VEX_HWCAPS_S390X_GIE (1<<8) /* General-instruction-extension facility */ #define VEX_HWCAPS_S390X_DFP (1<<9) /* Decimal floating point facility */ @@ -188,8 +187,7 @@ typedef #define VEX_HWCAPS_S390X_MSA9 (1<<30) /* Message-security-assist extension 9 */ /* Special value representing all available s390x hwcaps */ -#define VEX_HWCAPS_S390X_ALL (VEX_HWCAPS_S390X_LDISP | \ - VEX_HWCAPS_S390X_EIMM | \ +#define VEX_HWCAPS_S390X_ALL (VEX_HWCAPS_S390X_EIMM | \ VEX_HWCAPS_S390X_GIE | \ VEX_HWCAPS_S390X_DFP | \ VEX_HWCAPS_S390X_FGX | \ diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c index 6729e57c6..73dfaf8ea 100644 --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c @@ -1533,7 +1533,7 @@ Bool VG_(machine_get_hwcaps)( void ) vki_sigaction_fromK_t saved_sigill_act; vki_sigaction_toK_t tmp_sigill_act; - volatile Bool have_LDISP, have_STFLE; + volatile Bool have_STFLE; Int i, r, model; /* If the model is "unknown" don't treat this as an error. Assume @@ -1570,17 +1570,6 @@ Bool VG_(machine_get_hwcaps)( void ) /* Determine hwcaps. Note, we cannot use the stfle insn because it is not supported on z900. */ - have_LDISP = True; - if (VG_MINIMAL_SETJMP(env_unsup_insn)) { - have_LDISP = False; - } else { - /* BASR loads the address of the next insn into r1. Needed to avoid - a segfault in XY. */ - __asm__ __volatile__("basr %%r1,%%r0\n\t" - ".long 0xe3001000\n\t" /* XY 0,0(%r1) */ - ".short 0x0057" : : : "r0", "r1", "cc", "memory"); - } - /* Check availability of STFLE. If available store facility bits in hoststfle. */ ULong hoststfle[S390_NUM_FACILITY_DW]; @@ -1610,12 +1599,6 @@ Bool VG_(machine_get_hwcaps)( void ) vai.hwcaps = model; if (have_STFLE) vai.hwcaps |= VEX_HWCAPS_S390X_STFLE; - if (have_LDISP) { - /* Use long displacement only on machines >= z990. For all other - machines it is millicoded and therefore slow. */ - if (model >= VEX_S390X_MODEL_Z990) - vai.hwcaps |= VEX_HWCAPS_S390X_LDISP; - } /* Detect presence of certain facilities using the STFLE insn. Note, that these facilities were introduced at the same time or later @@ -1627,7 +1610,6 @@ Bool VG_(machine_get_hwcaps)( void ) UInt hwcaps_bit; const HChar name[6]; // may need adjustment for new facility names } fac_hwcaps[] = { - { False, 18, VEX_HWCAPS_S390X_LDISP, "LDISP" }, { False, 21, VEX_HWCAPS_S390X_EIMM, "EIMM" }, { False, 34, VEX_HWCAPS_S390X_GIE, "GIE" }, { False, 42, VEX_HWCAPS_S390X_DFP, "DFP" }, diff --git a/none/tests/libvex_test.c b/none/tests/libvex_test.c index 6a8086ace..b56e9cbd6 100644 --- a/none/tests/libvex_test.c +++ b/none/tests/libvex_test.c @@ -131,7 +131,7 @@ static UInt arch_hwcaps (VexArch va) { case VexArchARM64: return 0; case VexArchPPC32: return 0; case VexArchPPC64: return 0; - case VexArchS390X: return VEX_HWCAPS_S390X_LDISP; + case VexArchS390X: return 0; #if (__mips_isa_rev>=6) case VexArchMIPS32: return VEX_PRID_COMP_MIPS | VEX_MIPS_CPU_ISA_M32R6 | VEX_MIPS_HOST_FR; diff --git a/tests/s390x_features.c b/tests/s390x_features.c index 625984dbb..cad158853 100644 --- a/tests/s390x_features.c +++ b/tests/s390x_features.c @@ -246,8 +246,6 @@ static int go(char *feature, char *cpu) match = facilities[0] & FAC_BIT(0); } else if (strcmp(feature, "s390x-stfle") == 0 ) { match = facilities[0] & FAC_BIT(7); - } else if (strcmp(feature, "s390x-ldisp") == 0 ) { - match = (facilities[0] & FAC_BIT(18)) && (facilities[0] & FAC_BIT(19)); } else if (strcmp(feature, "s390x-eimm") == 0 ) { match = facilities[0] & FAC_BIT(21); } else if (strcmp(feature, "s390x-genins") == 0 ) { -- 2.47.3