From: David Hildenbrand <david@redhat.com>
To: qemu-devel@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>, Riku Voipio <riku.voipio@iki.fi>,
David Hildenbrand <david@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
Laurent Vivier <laurent@vivier.eu>,
qemu-s390x@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH v1] linux-user: elf: ELF_HWCAP for s390x
Date: Tue, 4 Jun 2019 11:36:56 +0200 [thread overview]
Message-ID: <20190604093656.23565-1-david@redhat.com> (raw)
Let's add all HWCAPs that we can support under TCG right now, when the
respective CPU facilities are enabled.
Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Laurent Vivier <laurent@vivier.eu>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Laurent Vivier <laurent@vivier.eu>
Cc: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
This patch is based on "[PATCH v2 00/22] s390x/tcg: Vector Instruction
Support Part 4". I guess it is best if I just include it in my next
pull request.
---
include/elf.h | 1 +
linux-user/elfload.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/include/elf.h b/include/elf.h
index ea7708a4ea..3501e0c8d0 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -598,6 +598,7 @@ typedef struct {
#define HWCAP_S390_ETF3EH 256
#define HWCAP_S390_HIGH_GPRS 512
#define HWCAP_S390_TE 1024
+#define HWCAP_S390_VXRS 2048
/* M68K specific definitions. */
/* We use the top 24 bits to encode information about the
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index a57b7049dd..59b813066c 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1308,6 +1308,45 @@ 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()
+
+static uint32_t get_elf_hwcap(void)
+{
+ uint32_t hwcap = 0;
+
+ if (s390_has_feat(S390_FEAT_ESAN3)) {
+ hwcap |= HWCAP_S390_ESAN3;
+ }
+ if (s390_has_feat(S390_FEAT_ZARCH)) {
+ hwcap |= HWCAP_S390_ZARCH;
+ }
+ if (s390_has_feat(S390_FEAT_STFLE)) {
+ hwcap |= HWCAP_S390_STFLE;
+ }
+ if (s390_has_feat(S390_FEAT_MSA)) {
+ hwcap |= HWCAP_S390_MSA;
+ }
+ if (s390_has_feat(S390_FEAT_LONG_DISPLACEMENT)) {
+ hwcap |= HWCAP_S390_LDISP;
+ }
+ if (s390_has_feat(S390_FEAT_EXTENDED_IMMEDIATE)) {
+ hwcap |= HWCAP_S390_EIMM;
+ }
+ if (s390_has_feat(S390_FEAT_EXTENDED_TRANSLATION_3) &&
+ s390_has_feat(S390_FEAT_ETF3_ENH)) {
+ hwcap |= HWCAP_S390_ETF3EH;
+ }
+ /* 31-bit processes can use 64-bit registers */
+ hwcap |= HWCAP_S390_HIGH_GPRS;
+ if (s390_has_feat(S390_FEAT_VECTOR)) {
+ hwcap |= HWCAP_S390_VXRS;
+ }
+
+ return hwcap;
+}
+
static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop)
{
regs->psw.addr = infop->entry;
--
2.21.0
next reply other threads:[~2019-06-04 9:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-04 9:36 David Hildenbrand [this message]
2019-06-04 12:54 ` [Qemu-devel] [PATCH v1] linux-user: elf: ELF_HWCAP for s390x Laurent Vivier
2019-06-04 13:28 ` David Hildenbrand
2019-06-04 13:00 ` Richard Henderson
2019-06-04 13:27 ` David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190604093656.23565-1-david@redhat.com \
--to=david@redhat.com \
--cc=cohuck@redhat.com \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=riku.voipio@iki.fi \
--cc=rth@twiddle.net \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).