From: James Cowgill <james.cowgill@mips.com>
To: qemu-devel@nongnu.org, Riku Voipio <riku.voipio@iki.fi>,
Laurent Vivier <laurent@vivier.eu>
Cc: Richard Henderson <richard.henderson@linaro.org>,
James Cowgill <james.cowgill@mips.com>
Subject: [Qemu-devel] [PATCH v2] linux-user: implement HWCAP bits on MIPS
Date: Thu, 15 Mar 2018 15:13:48 +0000 [thread overview]
Message-ID: <20180315151348.6451-1-james.cowgill@mips.com> (raw)
In-Reply-To: <20180314153121.23838-1-james.cowgill@mips.com>
Add support for the two currently defined HWCAP bits on MIPS - R6 and
MSA.
Buglink: https://bugs.launchpad.net/qemu/+bug/1754372
Signed-off-by: James Cowgill <james.cowgill@mips.com>
---
v2 changes:
- Fix kernel hwcap.h path.
linux-user/elfload.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 5fc130cc20..318c124712 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -950,6 +950,30 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMIPSState *e
#define USE_ELF_CORE_DUMP
#define ELF_EXEC_PAGESIZE 4096
+/* See arch/mips/include/uapi/asm/hwcap.h. */
+enum {
+ HWCAP_MIPS_R6 = (1 << 0),
+ HWCAP_MIPS_MSA = (1 << 1),
+};
+
+#define ELF_HWCAP get_elf_hwcap()
+
+static uint32_t get_elf_hwcap(void)
+{
+ MIPSCPU *cpu = MIPS_CPU(thread_cpu);
+ uint32_t hwcaps = 0;
+
+#define GET_FEATURE(flag, hwcap) \
+ do { if (cpu->env.insn_flags & (flag)) { hwcaps |= hwcap; } } while (0)
+
+ GET_FEATURE(ISA_MIPS32R6 | ISA_MIPS64R6, HWCAP_MIPS_R6);
+ GET_FEATURE(ASE_MSA, HWCAP_MIPS_MSA);
+
+#undef GET_FEATURE
+
+ return hwcaps;
+}
+
#endif /* TARGET_MIPS */
#ifdef TARGET_MICROBLAZE
--
2.16.2
next prev parent reply other threads:[~2018-03-15 15:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 15:31 [Qemu-devel] [PATCH] linux-user: implement HWCAP bits on MIPS James Cowgill
2018-03-14 15:38 ` no-reply
2018-03-14 16:13 ` Laurent Vivier
2018-03-15 10:52 ` James Cowgill
2018-03-15 13:00 ` Laurent Vivier
2018-03-15 14:19 ` James Cowgill
2018-03-15 14:35 ` Laurent Vivier
2018-03-15 15:13 ` James Cowgill [this message]
2018-03-15 15:19 ` [Qemu-devel] [PATCH v2] " no-reply
2018-03-15 15:25 ` Laurent Vivier
2018-04-10 13:53 ` Peter Maydell
2018-04-10 15:34 ` Laurent Vivier
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=20180315151348.6451-1-james.cowgill@mips.com \
--to=james.cowgill@mips.com \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=riku.voipio@iki.fi \
/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).