summaryrefslogtreecommitdiffstats
path: root/linux-user/elfload.c
diff options
context:
space:
mode:
authorCornelia Huck2019-06-07 16:06:09 +0200
committerCornelia Huck2019-06-07 16:06:27 +0200
commitc984c4e8e31e57c44b3674d9dd8ed6aa5e68306e (patch)
tree4247f68a9a12cc89e9c2c7a39e99f271a379cab7 /linux-user/elfload.c
parentMAINTAINERS: cover tests/migration/s390x/ (diff)
parentlinux-user: elf: ELF_HWCAP for s390x (diff)
downloadqemu-c984c4e8e31e57c44b3674d9dd8ed6aa5e68306e.tar.gz
qemu-c984c4e8e31e57c44b3674d9dd8ed6aa5e68306e.tar.xz
qemu-c984c4e8e31e57c44b3674d9dd8ed6aa5e68306e.zip
Merge tag 's390x-tcg-2019-06-07' into s390-next-staging
Finalize implementation of the "Vector Facility" for s390x TCG. Add it to the QEMU CPU model, so it is enabled as default. Also: - One fix (and one workaround) for the STFLE instruction - Fix the alignment of vector registers (and change the data type) - Properly generate ELF_HWCAP for s390x for linux-user - Use a gvec helper for VECTOR SELECT # gpg: Signature made Fri 07 Jun 2019 02:58:01 PM CEST # gpg: using RSA key 1BD9CAAD735C4C3A460DFCCA4DDE10F700FF835A # gpg: issuer "david@redhat.com" # gpg: Good signature from "David Hildenbrand <david@redhat.com>" [full] # gpg: aka "David Hildenbrand <davidhildenbrand@gmail.com>" [full] * tag 's390x-tcg-2019-06-07': (33 commits) linux-user: elf: ELF_HWCAP for s390x s390x/tcg: Use tcg_gen_gvec_bitsel for VECTOR SELECT s390x: Bump the "qemu" CPU model up to a stripped-down z13 s390x/tcg: We support the Vector Facility s390x/tcg: Allow linux-user to use vector instructions s390x/tcg: Implement VECTOR FP TEST DATA CLASS IMMEDIATE s390x/tcg: Implement VECTOR FP SUBTRACT s390x/tcg: Implement VECTOR FP SQUARE ROOT s390x/tcg: Implement VECTOR FP PERFORM SIGN OPERATION s390x/tcg: Implement VECTOR FP MULTIPLY AND (ADD|SUBTRACT) s390x/tcg: Implement VECTOR FP MULTIPLY s390x/tcg: Implement VECTOR LOAD ROUNDED s390x/tcg: Implement VECTOR LOAD LENGTHENED s390x/tcg: Implement VECTOR LOAD FP INTEGER s390x/tcg: Implement VECTOR FP DIVIDE s390x/tcg: Implement VECTOR FP CONVERT TO LOGICAL 64-BIT s390x/tcg: Implement VECTOR FP CONVERT TO FIXED 64-BIT s390x/tcg: Implement VECTOR FP CONVERT FROM LOGICAL 64-BIT s390x/tcg: Implement VECTOR FP CONVERT FROM FIXED 64-BIT s390x/tcg: Implement VECTOR FP COMPARE (EQUAL|HIGH|HIGH OR EQUAL) ... Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'linux-user/elfload.c')
-rw-r--r--linux-user/elfload.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index a57b7049dd..5451d262ec 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1308,6 +1308,34 @@ static inline void init_thread(struct target_pt_regs *regs,
#define ELF_DATA ELFDATA2MSB
#define ELF_ARCH EM_S390
+#include "elf.h"
+
+#define ELF_HWCAP get_elf_hwcap()
+
+#define GET_FEATURE(_feat, _hwcap) \
+ do { if (s390_has_feat(_feat)) { hwcap |= _hwcap; } } while (0)
+
+static uint32_t get_elf_hwcap(void)
+{
+ /*
+ * Let's assume we always have esan3 and zarch.
+ * 31-bit processes can use 64-bit registers (high gprs).
+ */
+ uint32_t hwcap = HWCAP_S390_ESAN3 | HWCAP_S390_ZARCH | HWCAP_S390_HIGH_GPRS;
+
+ GET_FEATURE(S390_FEAT_STFLE, HWCAP_S390_STFLE);
+ GET_FEATURE(S390_FEAT_MSA, HWCAP_S390_MSA);
+ GET_FEATURE(S390_FEAT_LONG_DISPLACEMENT, HWCAP_S390_LDISP);
+ GET_FEATURE(S390_FEAT_EXTENDED_IMMEDIATE, HWCAP_S390_EIMM);
+ if (s390_has_feat(S390_FEAT_EXTENDED_TRANSLATION_3) &&
+ s390_has_feat(S390_FEAT_ETF3_ENH)) {
+ hwcap |= HWCAP_S390_ETF3EH;
+ }
+ GET_FEATURE(S390_FEAT_VECTOR, HWCAP_S390_VXRS);
+
+ return hwcap;
+}
+
static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop)
{
regs->psw.addr = infop->entry;