linux-user: implement HWCAP bits on MIPS
PATCH 1/1 linux-user: implement HWCAP bits on MIPS
Add support for the two currently defined HWCAP bits on MIPS - R6 and MSA.
---
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(+)
linux-user/elfload.c +24 -0
@@ -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
Signature · 1 line
2.16.2
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH] 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
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'4b00115726 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 [email protected]
Le 14/03/2018 à 16:31, James Cowgill a écrit :
Quoted 17 lines
Add support for the two currently defined HWCAP bits on MIPS - R6 and MSA.
Signed-off-by James Cowgill <[email protected]>---
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(+)linux-user/elfload.c +0
-0
linux-user/elfload.c static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMIPSState *e · line 953
Quoted 4 lines
linux-user/elfload.c +1
-0@@ -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. */
in fact arch/mips/include/uapi/asm/hwcap.h
linux-user/elfload.c static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMIPSState *e · line 957
Quoted 4 lines
linux-user/elfload.c +4
-0+enum { +HWCAP_MIPS_R6 = (1 <<0 ), +HWCAP_MIPS_MSA = (1 <<1 ), +};
We have this for ARM only in elfload.c since:
afce2927aa Arm AT_HWCAP AUXV entry (Paul Brook) [2005]
but they have been added in include/elf.h since:
41d9ea80ac tcg-arm: Use qemu_getauxval [Richard Henderson, 2013]
and I think we should remove them (they are prefixed by ARM_)
So the MIPS ones should be in include/elf.h (with the #define form).
Richard, any comment?
Thanks,
Laurent
Hi,
Quoted 21 lines · Laurent Vivier
Le 14/03/2018 à 16:31, James Cowgill a écrit :
Quoted 20 lines
Add support for the two currently defined HWCAP bits on MIPS - R6 and MSA.
Signed-off-by James Cowgill <[email protected]>---
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(+)linux-user/elfload.c +0
-0@@ -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
Quoted 3 lines
linux-user/elfload.c static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMIPSState *e · line 953
Quoted 1 line
linux-user/elfload.c +1
-0+/* See arch/mips/include/uapi/hwcap.h. */ in fact
arch/mips/include/uapi/asm/hwcap.h
Woops.
Quoted 9 lines
linux-user/elfload.c static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMIPSState *e · line 957
Quoted 4 lines
linux-user/elfload.c +4
-0+enum { +HWCAP_MIPS_R6 = (1 <<0 ), +HWCAP_MIPS_MSA = (1 <<1 ), +};We have this for ARM only in
elfload.csince:
afce2927aaArmAT_HWCAPAUXV entry (Paul Brook) [2005]
Quoted 7 lines
but they have been added in
include/elf.hsince:
41d9ea80actcg-arm: Useqemu_getauxval[Richard Henderson, 2013]and I think we should remove them (they are prefixed by
ARM_)So the MIPS ones should be in
include/elf.h(with the #define form).
I can do that, although I think it's a bit unusual. The HWCAP bits are specific to the Linux kernel and not to "the MIPS ELF format" so it doesn't make sense to me to put them in elf.h.
James
Le 15/03/2018 à 11:52, James Cowgill a écrit :
Quoted 43 lines
Hi,
Quoted 21 lines · Laurent Vivier
Le 14/03/2018 à 16:31, James Cowgill a écrit :
Quoted 20 lines
Add support for the two currently defined HWCAP bits on MIPS - R6 and MSA.
Signed-off-by James Cowgill <[email protected]>---
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(+)linux-user/elfload.c +0
-0@@ -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 4096Quoted 3 lines
linux-user/elfload.c static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMIPSState *e · line 953
Quoted 1 line
linux-user/elfload.c +1
-0+/* See arch/mips/include/uapi/hwcap.h. */ in fact
arch/mips/include/uapi/asm/hwcap.hWoops.
Quoted 13 lines
linux-user/elfload.c static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMIPSState *e · line 957
Quoted 4 lines
linux-user/elfload.c +4
-0+enum { +HWCAP_MIPS_R6 = (1 <<0 ), +HWCAP_MIPS_MSA = (1 <<1 ), +};We have this for ARM only in
elfload.csince:
afce2927aaArmAT_HWCAPAUXV entry (Paul Brook) [2005]but they have been added in
include/elf.hsince:
41d9ea80actcg-arm: Useqemu_getauxval[Richard Henderson, 2013]
Quoted 7 lines
Quoted 3 lines
and I think we should remove them (they are prefixed by
ARM_)So the MIPS ones should be in
include/elf.h(with the #define form).I can do that, although I think it's a bit unusual. The HWCAP bits are specific to the Linux kernel and not to "the MIPS ELF format" so it doesn't make sense to me to put them in
elf.h.
In fact, in a system, they come with the glibc <sys/auxv.h>. auxv.h includes <elf.h> and <bits/hwcap.h>. They are both part of glibc.
They can be used with qemu_getauxval() so it's better to have them in a header file. elfoad.c or elf.h, it's in both cases an ELF file.
Thanks,
Laurent
Hi,
Quoted 20 lines · Laurent Vivier
Le 15/03/2018 à 11:52, James Cowgill a écrit :
Quoted 19 lines
Hi,
Quoted 16 lines · Laurent Vivier
Le 14/03/2018 à 16:31, James Cowgill a écrit :
linux-user/elfload.c static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMIPSState *e · line 957
Quoted 4 lines
linux-user/elfload.c +4
-0+enum { +HWCAP_MIPS_R6 = (1 <<0 ), +HWCAP_MIPS_MSA = (1 <<1 ), +};We have this for ARM only in
elfload.csince:
afce2927aaArmAT_HWCAPAUXV entry (Paul Brook) [2005]but they have been added in
include/elf.hsince:
41d9ea80actcg-arm: Useqemu_getauxval[Richard Henderson, 2013]and I think we should remove them (they are prefixed by
ARM_)
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
So the MIPS ones should be in
include/elf.h(with the #define form).I can do that, although I think it's a bit unusual. The HWCAP bits are specific to the Linux kernel and not to "the MIPS ELF format" so it doesn't make sense to me to put them in
elf.h.In fact, in a system, they come with the glibc <
sys/auxv.h>.auxv.hincludes <elf.h> and <bits/hwcap.h>. They are both part of glibc.
None of the headers you mention contain hwcap bits. They are usually provided in an arch specific kernel header - on MIPS they are in <asm/hwcap.h> which must be included separately.
Quoted 2 lines
They can be used with
qemu_getauxval()so it's better to have them in a header file.elfoad.corelf.h, it's in both cases an ELF file.
I agree with that.
I tried to move them to elf.h but hit a slight problem. In elfload.c, elf.h is included after all the target specific stuff so the get_elf_hwcap function cannot use anything from elf.h. I think this has lead to all architectures replicating the list of hwcap bits in both elf.h and elfload.c. You mentioned arm before, but I can also see aarch64, powerpc and sh4 do this. Some of these architectures also have their bits (with different constant names) in elf.h and some do not.
James
Le 15/03/2018 à 15:19, James Cowgill a écrit :
Quoted 41 lines
Hi,
Quoted 20 lines · Laurent Vivier
Le 15/03/2018 à 11:52, James Cowgill a écrit :
Quoted 19 lines
Hi,
Quoted 16 lines · Laurent Vivier
Le 14/03/2018 à 16:31, James Cowgill a écrit :
linux-user/elfload.c static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMIPSState *e · line 957
Quoted 4 lines
linux-user/elfload.c +4
-0+enum { +HWCAP_MIPS_R6 = (1 <<0 ), +HWCAP_MIPS_MSA = (1 <<1 ), +};We have this for ARM only in
elfload.csince:
afce2927aaArmAT_HWCAPAUXV entry (Paul Brook) [2005]but they have been added in
include/elf.hsince:
41d9ea80actcg-arm: Useqemu_getauxval[Richard Henderson, 2013]and I think we should remove them (they are prefixed by
ARM_)Quoted 8 lines
Quoted 5 lines
Quoted 1 line
So the MIPS ones should be in
include/elf.h(with the #define form).I can do that, although I think it's a bit unusual. The HWCAP bits are specific to the Linux kernel and not to "the MIPS ELF format" so it doesn't make sense to me to put them in
elf.h.In fact, in a system, they come with the glibc <
sys/auxv.h>.auxv.hincludes <elf.h> and <bits/hwcap.h>. They are both part of glibc.None of the headers you mention contain hwcap bits. They are usually provided in an arch specific kernel header - on MIPS they are in <
asm/hwcap.h> which must be included separately.Quoted 2 lines
They can be used with
qemu_getauxval()so it's better to have them in a header file.elfoad.corelf.h, it's in both cases an ELF file.I agree with that.
Quoted 7 lines
I tried to move them to
elf.hbut hit a slight problem. Inelfload.c,elf.his included after all the target specific stuff so theget_elf_hwcapfunction cannot use anything fromelf.h. I think this has lead to all architectures replicating the list of hwcap bits in bothelf.handelfload.c. You mentioned arm before, but I can also see aarch64, powerpc and sh4 do this. Some of these architectures also have their bits (with different constant names) inelf.hand some do not.
OK, you're right. That's sad to have duplicated values...
So your patch is correct. Perhaps just fix the typo in the path name for hwcap.h.
Thanks,
Laurent
PATCH v2 1/1 linux-user: implement HWCAP bits on MIPS
In reply to James CowgillAdd support for the two currently defined HWCAP bits on MIPS - R6 and MSA.
---
v2 changes:
- Fix kernel hwcap.h path.
linux-user/elfload.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
linux-user/elfload.c +24 -0
@@ -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
Signature · 1 line
2.16.2
Le 15/03/2018 à 16:13, James Cowgill a écrit :
Quoted 12 lines
Add support for the two currently defined HWCAP bits on MIPS - R6 and MSA.
Signed-off-by James Cowgill <[email protected]>---
v2 changes:
- Fix kernelhwcap.hpath.linux-user/elfload.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
Quoted 10 lines · Laurent Vivier
Quoted 9 lines · James Cowgill
Add support for the two currently defined HWCAP bits on MIPS - R6 and MSA.
Signed-off-by James Cowgill <[email protected]>---
v2 changes:
- Fix kernelhwcap.hpath.
Quoted 5 lines
Quoted 3 lines
linux-user/elfload.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)Reviewed-by Laurent Vivier <[email protected]>
Hi Laurent -- did this MIPS HWCAP fix get lost somewhere? I can't see it in master or your latest pullreq.
thanks
-- PMM
Le 10/04/2018 à 15:53, Peter Maydell a écrit :
Quoted 11 lines · Laurent Vivier
Quoted 10 lines · James Cowgill
Quoted 9 lines
Add support for the two currently defined HWCAP bits on MIPS - R6 and MSA.
Signed-off-by James Cowgill <[email protected]>---
v2 changes:
- Fix kernelhwcap.hpath.
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
linux-user/elfload.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)Reviewed-by Laurent Vivier <[email protected]>
Hi Peter,
Quoted 2 lines
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
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
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/[email protected] -> patchew/[email protected] * [new tag] patchew/[email protected] -> patchew/[email protected]
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 [email protected]