From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Laurent Vivier <laurent@vivier.eu>,
David Hildenbrand <david@redhat.com>,
Thomas Huth <thuth@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org,
Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH v2 3/4] linux-user/elfload: Introduce elf_hwcap_str() on s390x
Date: Mon, 5 Jun 2023 13:39:49 +0200 [thread overview]
Message-ID: <20230605113950.1169228-4-iii@linux.ibm.com> (raw)
In-Reply-To: <20230605113950.1169228-1-iii@linux.ibm.com>
It is required for implementing /proc/cpuinfo emulation.
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
linux-user/elfload.c | 27 +++++++++++++++++++++++++++
linux-user/loader.h | 1 +
2 files changed, 28 insertions(+)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 49ec9ccc944..d80d68484b6 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1605,6 +1605,33 @@ uint32_t get_elf_hwcap(void)
return hwcap;
}
+const char *elf_hwcap_str(uint32_t bit)
+{
+ static const char *hwcap_str[] = {
+ [HWCAP_S390_ESAN3] = "esan3",
+ [HWCAP_S390_ZARCH] = "zarch",
+ [HWCAP_S390_STFLE] = "stfle",
+ [HWCAP_S390_MSA] = "msa",
+ [HWCAP_S390_LDISP] = "ldisp",
+ [HWCAP_S390_EIMM] = "eimm",
+ [HWCAP_S390_DFP] = "dfp",
+ [HWCAP_S390_HPAGE] = "edat",
+ [HWCAP_S390_ETF3EH] = "etf3eh",
+ [HWCAP_S390_HIGH_GPRS] = "highgprs",
+ [HWCAP_S390_TE] = "te",
+ [HWCAP_S390_VXRS] = "vx",
+ [HWCAP_S390_VXRS_BCD] = "vxd",
+ [HWCAP_S390_VXRS_EXT] = "vxe",
+ [HWCAP_S390_GS] = "gs",
+ [HWCAP_S390_VXRS_EXT2] = "vxe2",
+ [HWCAP_S390_VXRS_PDE] = "vxp",
+ [HWCAP_S390_SORT] = "sort",
+ [HWCAP_S390_DFLT] = "dflt",
+ };
+
+ return bit < ARRAY_SIZE(hwcap_str) ? hwcap_str[bit] : NULL;
+}
+
static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop)
{
regs->psw.addr = infop->entry;
diff --git a/linux-user/loader.h b/linux-user/loader.h
index ad6ca9dbe35..59cbeacf24f 100644
--- a/linux-user/loader.h
+++ b/linux-user/loader.h
@@ -58,6 +58,7 @@ extern unsigned long guest_stack_size;
#ifdef TARGET_S390X
uint32_t get_elf_hwcap(void);
+const char *elf_hwcap_str(uint32_t bit);
#endif
#endif /* LINUX_USER_LOADER_H */
--
2.40.1
next prev parent reply other threads:[~2023-06-05 11:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 11:39 [PATCH v2 0/4] linux-user: Emulate /proc/cpuinfo on s390x Ilya Leoshkevich
2023-06-05 11:39 ` [PATCH v2 1/4] s390x/tcg: Fix CPU address returned by STIDP Ilya Leoshkevich
2023-06-05 11:39 ` [PATCH v2 2/4] linux-user/elfload: Expose get_elf_hwcap() on s390x Ilya Leoshkevich
2023-06-05 11:39 ` Ilya Leoshkevich [this message]
2023-06-05 11:39 ` [PATCH v2 4/4] linux-user: Emulate /proc/cpuinfo " Ilya Leoshkevich
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=20230605113950.1169228-4-iii@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=david@redhat.com \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--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).