diff mbox

[v2] linux-user: implement HWCAP bits on MIPS

Message ID 20180315151348.6451-1-james.cowgill@mips.com (mailing list archive)
State New, archived
Headers show

Commit Message

James Cowgill March 15, 2018, 3:13 p.m. UTC
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(+)

Comments

no-reply@patchew.org March 15, 2018, 3:19 p.m. UTC | #1
Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20180315151348.6451-1-james.cowgill@mips.com
Subject: [Qemu-devel] [PATCH v2] linux-user: implement HWCAP bits on MIPS

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
   6265e23b1c..56e8698ffa  master     -> master
 t [tag update]            patchew/20180315115144.801202-1-eblake@redhat.com -> patchew/20180315115144.801202-1-eblake@redhat.com
 * [new tag]               patchew/20180315151348.6451-1-james.cowgill@mips.com -> patchew/20180315151348.6451-1-james.cowgill@mips.com
Switched to a new branch 'test'
31ed3b34df linux-user: implement HWCAP bits on MIPS

=== OUTPUT BEGIN ===
Checking PATCH 1/1: linux-user: implement HWCAP bits on MIPS...
ERROR: braces {} are necessary for all arms of this statement
#35: FILE: linux-user/elfload.c:967:
+    do { if (cpu->env.insn_flags & (flag)) { hwcaps |= hwcap; } } while (0)
[...]

total: 1 errors, 0 warnings, 30 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
Laurent Vivier March 15, 2018, 3:25 p.m. UTC | #2
Le 15/03/2018 à 16:13, James Cowgill a écrit :
> 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(+)
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Peter Maydell April 10, 2018, 1:53 p.m. UTC | #3
On 15 March 2018 at 15:25, Laurent Vivier <laurent@vivier.eu> wrote:
> Le 15/03/2018 à 16:13, James Cowgill a écrit :
>> 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(+)
>>
>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>

Hi Laurent -- did this MIPS HWCAP fix get lost somewhere? I can't
see it in master or your latest pullreq.

thanks
-- PMM
Laurent Vivier April 10, 2018, 3:34 p.m. UTC | #4
Le 10/04/2018 à 15:53, Peter Maydell a écrit :
> On 15 March 2018 at 15:25, Laurent Vivier <laurent@vivier.eu> wrote:
>> Le 15/03/2018 à 16:13, James Cowgill a écrit :
>>> 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(+)
>>>
>>
>> Reviewed-by: Laurent Vivier <laurent@vivier.eu>

Hi Peter,

> Hi Laurent -- did this MIPS HWCAP fix get lost somewhere? I can't
> see it in master or your latest pullreq.

yes, I've missed it. I add it to my pull request.

Thank you,
Laurent
diff mbox

Patch

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