Bug 496950

Summary: s390x: Fix hardware capabilities and EmFail codes
Product: [Developer tools] valgrind Reporter: Florian Krohm <flo2030>
Component: generalAssignee: Florian Krohm <flo2030>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 495817    
Attachments: patch for hwcaps / EmFail synch
Remove facility bit macros
new hardware caps for vector insn and some fixes

Description Florian Krohm 2024-12-02 18:19:59 UTC
The representation of hardware capabilities is less than ideal
because adding a new one requires changes in several places:

- in libvex_s390x_common.h
  - add a new S390_FAC_xyzzy
- in libvex.h
  - add VEX_HWCAPS_S390X_xyzzy
  - update VEX_HWCAPS_S390X_ALL
- in host_s390_defs.h
  - add macro s390_host_has_xyzzy
- in libvex_emnote.h
  - add EmFail_S390X_xyzzy
- in main_main.c
  - update LibVEX_EmNote_string
  - update function show_hwcaps_s390x
- in m_machine.c
  - update fac_hwcaps table in function VG_(machine_get_hwcaps)
- in extension-s390x.c
  - maybe update accepted_facility[] in function do_extension_STFLE
  
Not surprisingly, occasionally something gets forgotten.
This patch brings everything in synch and adds 2 new capabilities for
the vector enhancements-facility 2 and vector packed-decimal facility.
Those are not used yet but will be shortly.

Regarding S390_FAC_xxxx
I've trimmed that list to those entries that are actually used in m_machine.c
But I am wondering whether that list is needed at all...
Those constants are only used in m_machine.c and could be used in
extension-s390x.c where they are currently hardcoded.
However, given that the facility bit numbers are not going to change in the future
we could as well hardcode them in m_machine.c as well.
Comment 1 Florian Krohm 2024-12-02 18:21:11 UTC
Created attachment 176295 [details]
patch for hwcaps / EmFail synch
Comment 2 Florian Krohm 2024-12-13 11:33:32 UTC
(In reply to Florian Krohm from comment #0)
> The representation of hardware capabilities is less than ideal
> because adding a new one requires changes in several places:

[...]

> Not surprisingly, occasionally something gets forgotten.

Yes. tests/s390x-features.c  would be another place to touch up.
Comment 3 Florian Krohm 2025-01-07 13:22:45 UTC
Created attachment 177161 [details]
Remove facility bit macros

As discussed: remove the facility-bit macros S390_FAC_...
They are guaranteed to never change and are used only in m_machine.c
Comment 4 Florian Krohm 2025-01-07 13:30:23 UTC
Created attachment 177162 [details]
new hardware caps for vector insn and some fixes

This patch adds:
- forgotten s390_host_has_mi2 macro
- handling EmFail_S390X_ppno
- handling EmFail_S390X_vxe
- "nnpa" to show_hwcaps_s390x
- EmFail machinery for "dflt" and "nnpa" hardware capabilities
- new hardware capabilities: "vxe2", "vxd", "msa", "msa4", "msa8", "msa9" need for vector insns
Comment 5 Florian Krohm 2025-03-12 23:11:56 UTC
Fixed in 744e47c8ff5bd9a7908b63b9d053b32bac18d686