linux-user/elfload: Fix /proc/cpuinfo features: on s390x
PATCH 1/1 linux-user/elfload: Fix /proc/cpuinfo features: on s390x
elf_hwcap_str() takes a bit number, but compares it for equality with the HWCAP_S390_* masks. This causes /proc/cpuinfo to display incorrect hwcaps.
Fix by introducing the HWCAP_S390_NR_* constants and using them in elf_hwcap_str() instead of the HWCAP_S390_*. While at it, add the missing nnpa, pcimio and sie hwcaps from the latest kernel.
Output before:
features : esan3 zarch stfle msa
Output after:
features : esan3 zarch stfle msa ldisp eimm etf3eh highgprs vx vxe
--- include/elf.h | 66 +++++++++++++++++++++++++++++++------------- linux-user/elfload.c | 41 ++++++++++++++------------- 2 files changed, 69 insertions(+), 38 deletions(-)
include/elf.h +47 -19
@@ -596,25 +596,53 @@ typedef struct {/* Bits present in AT_HWCAP for s390. */ -#define HWCAP_S390_ESAN3 1 -#define HWCAP_S390_ZARCH 2 -#define HWCAP_S390_STFLE 4 -#define HWCAP_S390_MSA 8 -#define HWCAP_S390_LDISP 16 -#define HWCAP_S390_EIMM 32 -#define HWCAP_S390_DFP 64 -#define HWCAP_S390_HPAGE 128 -#define HWCAP_S390_ETF3EH 256 -#define HWCAP_S390_HIGH_GPRS 512 -#define HWCAP_S390_TE 1024 -#define HWCAP_S390_VXRS 2048 -#define HWCAP_S390_VXRS_BCD 4096 -#define HWCAP_S390_VXRS_EXT 8192 -#define HWCAP_S390_GS 16384 -#define HWCAP_S390_VXRS_EXT2 32768 -#define HWCAP_S390_VXRS_PDE 65536 -#define HWCAP_S390_SORT 131072 -#define HWCAP_S390_DFLT 262144 +#define HWCAP_S390_NR_ESAN3 0 +#define HWCAP_S390_NR_ZARCH 1 +#define HWCAP_S390_NR_STFLE 2 +#define HWCAP_S390_NR_MSA 3 +#define HWCAP_S390_NR_LDISP 4 +#define HWCAP_S390_NR_EIMM 5 +#define HWCAP_S390_NR_DFP 6 +#define HWCAP_S390_NR_HPAGE 7 +#define HWCAP_S390_NR_ETF3EH 8 +#define HWCAP_S390_NR_HIGH_GPRS 9 +#define HWCAP_S390_NR_TE 10 +#define HWCAP_S390_NR_VXRS 11 +#define HWCAP_S390_NR_VXRS_BCD 12 +#define HWCAP_S390_NR_VXRS_EXT 13 +#define HWCAP_S390_NR_GS 14 +#define HWCAP_S390_NR_VXRS_EXT2 15 +#define HWCAP_S390_NR_VXRS_PDE 16 +#define HWCAP_S390_NR_SORT 17 +#define HWCAP_S390_NR_DFLT 18 +#define HWCAP_S390_NR_VXRS_PDE2 19 +#define HWCAP_S390_NR_NNPA 20 +#define HWCAP_S390_NR_PCI_MIO 21 +#define HWCAP_S390_NR_SIE 22 + +#define HWCAP_S390_ESAN3 (1 << HWCAP_S390_NR_ESAN3) +#define HWCAP_S390_ZARCH (1 << HWCAP_S390_NR_ZARCH) +#define HWCAP_S390_STFLE (1 << HWCAP_S390_NR_STFLE) +#define HWCAP_S390_MSA (1 << HWCAP_S390_NR_MSA) +#define HWCAP_S390_LDISP (1 << HWCAP_S390_NR_LDISP) +#define HWCAP_S390_EIMM (1 << HWCAP_S390_NR_EIMM) +#define HWCAP_S390_DFP (1 << HWCAP_S390_NR_DFP) +#define HWCAP_S390_HPAGE (1 << HWCAP_S390_NR_HPAGE) +#define HWCAP_S390_ETF3EH (1 << HWCAP_S390_NR_ETF3EH) +#define HWCAP_S390_HIGH_GPRS (1 << HWCAP_S390_NR_HIGH_GPRS) +#define HWCAP_S390_TE (1 << HWCAP_S390_NR_TE) +#define HWCAP_S390_VXRS (1 << HWCAP_S390_NR_VXRS) +#define HWCAP_S390_VXRS_BCD (1 << HWCAP_S390_NR_VXRS_BCD) +#define HWCAP_S390_VXRS_EXT (1 << HWCAP_S390_NR_VXRS_EXT) +#define HWCAP_S390_GS (1 << HWCAP_S390_NR_GS) +#define HWCAP_S390_VXRS_EXT2 (1 << HWCAP_S390_NR_VXRS_EXT2) +#define HWCAP_S390_VXRS_PDE (1 << HWCAP_S390_NR_VXRS_PDE) +#define HWCAP_S390_SORT (1 << HWCAP_S390_NR_SORT) +#define HWCAP_S390_DFLT (1 << HWCAP_S390_NR_DFLT) +#define HWCAP_S390_VXRS_PDE2 (1 << HWCAP_S390_NR_VXRS_PDE2) +#define HWCAP_S390_NNPA (1 << HWCAP_S390_NR_NNPA) +#define HWCAP_S390_PCI_MIO (1 << HWCAP_S390_NR_PCI_MIO) +#define HWCAP_S390_SIE (1 << HWCAP_S390_NR_SIE)/* M68K specific definitions. */ /* We use the top 24 bits to encode information about the
linux-user/elfload.c +22 -19
47 lines not on this page · raw message
Signature · 1 line
2.41.0
Quoted 14 lines · Ilya Leoshkevich
elf_hwcap_str()takes a bit number, but compares it for equality with the HWCAP_S390_* masks. This causes/proc/cpuinfoto display incorrect hwcaps.Fix by introducing the HWCAP_S390_NR_* constants and using them in
elf_hwcap_str()instead of the HWCAP_S390_*. While at it, add the missing nnpa, pcimio and sie hwcaps from the latest kernel.Output before:
features : esan3 zarch stfle msa
Output after:
Quoted 8 lines
features : esan3 zarch stfle msa ldisp eimm etf3eh highgprs vx vxe
Fixes e19807bee357 ("linux-user/elfload: Introduce elf_hwcap_str() on s390x")Signed-off-by Ilya Leoshkevich<[email protected]>--- include/elf.h | 66 +++++++++++++++++++++++++++++++------------- linux-user/elfload.c | 41 ++++++++++++++------------- 2 files changed, 69 insertions(+), 38 deletions(-)
r~
PATCH 1/1 linux-user/elfload: Fix /proc/cpuinfo features: on s390x
Quoted 29 lines · Richard Henderson
Quoted 19 lines · Ilya Leoshkevich
elf_hwcap_str()takes a bit number, but compares it for equality with
the HWCAP_S390_* masks. This causes/proc/cpuinfoto display incorrect
hwcaps.Fix by introducing the HWCAP_S390_NR_* constants and using them in
elf_hwcap_str()instead of the HWCAP_S390_*. While at it, add the missing nnpa, pcimio and sie hwcaps from the latest kernel.Output before:
features : esan3 zarch stfle msa
Output after:
features : esan3 zarch stfle msa ldisp eimm etf3eh highgprs vx vxe
Quoted 8 lines
Fixes e19807bee357 ("linux-user/elfload: Introduce elf_hwcap_str()on s390x")
Signed-off-by Ilya Leoshkevich<[email protected]>---
include/elf.h | 66 +++++++++++++++++++++++++++++++--------
-----
linux-user/elfload.c| 41 ++++++++++++++-------------2 files changed, 69 insertions(+), 38 deletions(-)
Quoted 3 lines
Reviewed-by Richard Henderson <[email protected]>r~
Hi,
I noticed that while the other s390x fixes were picked up and are in master, this one wasn't. Is there anything I need to improve here?
Best regards,
Ilya
Quoted 30 lines · Ilya Leoshkevich
Quoted 29 lines · Richard Henderson
Quoted 27 lines · Ilya Leoshkevich
elf_hwcap_str()takes a bit number, but compares it for equality with
the HWCAP_S390_* masks. This causes/proc/cpuinfoto display incorrect
hwcaps.Fix by introducing the HWCAP_S390_NR_* constants and using them in
elf_hwcap_str()instead of the HWCAP_S390_*. While at it, add the missing nnpa, pcimio and sie hwcaps from the latest kernel.Output before:
features : esan3 zarch stfle msa
Output after:
features : esan3 zarch stfle msa ldisp eimm etf3eh
highgprs vx vxeFixes e19807bee357 ("linux-user/elfload: Introduce elf_hwcap_str()on s390x")
Signed-off-by Ilya Leoshkevich<[email protected]>--- include/elf.h | 66 +++++++++++++++++++++++++++++++-------- ----- linux-user/elfload.c | 41 ++++++++++++++------------- 2 files changed, 69 insertions(+), 38 deletions(-)
Quoted 9 lines
Quoted 3 lines
Reviewed-by Richard Henderson <[email protected]>r~
Hi,
I noticed that while the other s390x fixes were picked up and are in master, this one wasn't. Is there anything I need to improve here?
I just missed it while collecting patches. Sorry about that. Queued to tcg-next.
r~
Quoted 35 lines · Richard Henderson
Quoted 34 lines · Ilya Leoshkevich
Quoted 32 lines · Richard Henderson
Quoted 19 lines · Ilya Leoshkevich
elf_hwcap_str()takes a bit number, but compares it for equality with
the HWCAP_S390_* masks. This causes/proc/cpuinfoto display incorrect
hwcaps.Fix by introducing the HWCAP_S390_NR_* constants and using them in
elf_hwcap_str()instead of the HWCAP_S390_*. While at it, add the missing nnpa, pcimio and sie hwcaps from the latest kernel.Output before:
features : esan3 zarch stfle msa
Output after:
features : esan3 zarch stfle msa ldisp eimm etf3eh highgprs vx vxe
Quoted 8 lines
Fixes e19807bee357 ("linux-user/elfload: Introduce elf_hwcap_str()on s390x")
Signed-off-by Ilya Leoshkevich<[email protected]>---
include/elf.h | 66 +++++++++++++++++++++++++++++++--------
-----
linux-user/elfload.c| 41 ++++++++++++++-------------2 files changed, 69 insertions(+), 38 deletions(-)Reviewed-by Richard Henderson <[email protected]>r~
Quoted 8 lines
Quoted 5 lines
Hi,
I noticed that while the other s390x fixes were picked up and are in master, this one wasn't. Is there anything I need to improve here?
I just missed it while collecting patches. Sorry about that. Queued to tcg-next.
If you like, I can also take this through my s390x branch ... I'm currently in progress of assembling a pull request, so if you've got nothing else pending right now, I can put it there.
Thomas