qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: James Cowgill <james.cowgill@mips.com>
To: qemu-devel@nongnu.org, Riku Voipio <riku.voipio@iki.fi>,
	Laurent Vivier <laurent@vivier.eu>
Cc: James Cowgill <james.cowgill@mips.com>
Subject: [Qemu-devel] [PATCH] linux-user: implement HWCAP bits on MIPS
Date: Wed, 14 Mar 2018 15:31:21 +0000	[thread overview]
Message-ID: <20180314153121.23838-1-james.cowgill@mips.com> (raw)

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>
---
This was resent because I think I messed up my email config. Apologies if you
receive this twice.

 linux-user/elfload.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 5fc130cc20..747b0ed10b 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/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

             reply	other threads:[~2018-03-14 15:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14 15:31 James Cowgill [this message]
2018-03-14 15:38 ` [Qemu-devel] [PATCH] linux-user: implement HWCAP bits on MIPS 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 ` [Qemu-devel] [PATCH v2] " James Cowgill
2018-03-15 15:19   ` no-reply
2018-03-15 15:25   ` Laurent Vivier
2018-04-10 13:53     ` Peter Maydell
2018-04-10 15:34       ` Laurent Vivier
  -- strict thread matches above, loose matches on Subject: below --
2018-03-14 14:20 [Qemu-devel] [PATCH] " James Cowgill
2018-03-14 15:32 ` no-reply

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=20180314153121.23838-1-james.cowgill@mips.com \
    --to=james.cowgill@mips.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.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).