All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: implement HWCAP bits on MIPS
@ 2018-03-14 15:31 James Cowgill
  2018-03-14 15:38 ` no-reply
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: James Cowgill @ 2018-03-14 15:31 UTC (permalink / raw)
  To: qemu-devel, Riku Voipio, Laurent Vivier; +Cc: James Cowgill

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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-04-10 15:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.