sh4 linux-user cpu and hwcap
cover sh4 linux-user cpu and hwcap
As reported by Rich the other day. As I don't have a user-land binary that depends on this, I merely note that it still runs the linux-user-test sh4 binary. And gdb confirms that the LLSC bit does get set.
Rich, can you confirm that this is good enough for your musl test?
r~
Richard Henderson (2):
linux-user: Default sh4 to sh7785
linux-user: Add HWCAP for SH4
linux-user/elfload.c | 29 +++++++++++++++++++++++++++++ linux-user/main.c | 2 ++ 2 files changed, 31 insertions(+)
Signature · 1 line
2.1.0
PATCH 1/2 linux-user: Default sh4 to sh7785
--- linux-user/main.c | 2 ++ 1 file changed, 2 insertions(+)
linux-user/main.c +2 -0
@@ -3929,6 +3929,8 @@ int main(int argc, char **argv, char **envp)# else cpu_model ="750" ;# endif +#elif definedTARGET_SH4 + cpu_model =TYPE_SH7785_CPU ;#else cpu_model ="any" ;#endif
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCH 1/2] linux-user: Default sh4 to sh7785
Quoted 10 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- linux-user/main.c | 2 ++ 1 file changed, 2 insertions(+)linux-user/main.c +0
-0
linux-user/main.c int main(int argc, char **argv, char **envp) · line 3936
Quoted 8 lines
linux-user/main.c +2
-0@@ -3929,6 +3929,8 @@ int main(int argc, char **argv, char **envp)# else cpu_model ="750" ;# endif +#elif definedTARGET_SH4 + cpu_model =TYPE_SH7785_CPU ;#else cpu_model ="any" ;#endif
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
PATCH 2/2 linux-user: Add HWCAP for SH4
In reply to Richard HendersonOnly exposing FPU and LLSC as the only features
supported by the translator.
--- linux-user/elfload.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
linux-user/elfload.c +29 -0
@@ -1075,6 +1075,35 @@ static inline void elf_core_copy_regs(target_elf_gregset_t *regs,#define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 +enum { +SH_CPU_HAS_FPU =0x0001 ,/* Hardware FPU support */ +SH_CPU_HAS_P2_FLUSH_BUG =0x0002 ,/* Need to flush the cache in P2 area */ +SH_CPU_HAS_MMU_PAGE_ASSOC =0x0004 ,/* SH3: TLB way selection bit support */ +SH_CPU_HAS_DSP =0x0008 ,/* SH-DSP: DSP support */ +SH_CPU_HAS_PERF_COUNTER =0x0010 ,/* Hardware performance counters */ +SH_CPU_HAS_PTEA =0x0020 ,/* PTEA register */ +SH_CPU_HAS_LLSC =0x0040 ,/* movli.l/movco.l */ +SH_CPU_HAS_L2_CACHE =0x0080 ,/* Secondary cache / URAM */ +SH_CPU_HAS_OP32 =0x0100 ,/* 32-bit instruction support */ +SH_CPU_HAS_PTEAEX =0x0200 ,/* PTE ASID Extension support */ +}; + +#define ELF_HWCAP get_elf_hwcap() + +static uint32_t get_elf_hwcap (void ) +{ +SuperHCPU *cpu =SUPERH_CPU (thread_cpu); +uint32_t hwcap =0 ; + + hwcap |=SH_CPU_HAS_FPU ; + +if (cpu->env.features &SH_FEATURE_SH4A ) { + hwcap |=SH_CPU_HAS_LLSC ; + } + +return hwcap; +} +#endif #ifdef TARGET_CRIS
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCH 2/2] linux-user: Add HWCAP for SH4
Quoted 38 lines · Richard Henderson
Only exposing FPU and LLSC as the only features
supported by the translator.Signed-off-by Richard Henderson <[email protected]>--- linux-user/elfload.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)linux-user/elfload.c +22
-0@@ -1075,6 +1075,35 @@ static inline void elf_core_copy_regs(target_elf_gregset_t *regs,#define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 +enum { +SH_CPU_HAS_FPU =0x0001 ,/* Hardware FPU support */ +SH_CPU_HAS_P2_FLUSH_BUG =0x0002 ,/* Need to flush the cache in P2 area */ +SH_CPU_HAS_MMU_PAGE_ASSOC =0x0004 ,/* SH3: TLB way selection bit support */ +SH_CPU_HAS_DSP =0x0008 ,/* SH-DSP: DSP support */ +SH_CPU_HAS_PERF_COUNTER =0x0010 ,/* Hardware performance counters */ +SH_CPU_HAS_PTEA =0x0020 ,/* PTEA register */ +SH_CPU_HAS_LLSC =0x0040 ,/* movli.l/movco.l */ +SH_CPU_HAS_L2_CACHE =0x0080 ,/* Secondary cache / URAM */ +SH_CPU_HAS_OP32 =0x0100 ,/* 32-bit instruction support */ +SH_CPU_HAS_PTEAEX =0x0200 ,/* PTE ASID Extension support */ +}; + +#define ELF_HWCAP get_elf_hwcap() + +static uint32_t get_elf_hwcap (void ) +{ +SuperHCPU *cpu =SUPERH_CPU (thread_cpu); +uint32_t hwcap =0 ; + + hwcap |=SH_CPU_HAS_FPU ; +
linux-user/elfload.c static inline void elf_core_copy_regs(target_elf_gregset_t *regs, · line 1109
Quoted 10 lines
linux-user/elfload.c +7
-0+if (cpu->env.features &SH_FEATURE_SH4A ) { + hwcap |=SH_CPU_HAS_LLSC ; + } + + return hwcap; +} +#endif #ifdef TARGET_CRIS
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
Quoted 4 lines · Richard Henderson
As reported by Rich the other day. As I don't have a user-land binary that depends on this, I merely note that it still runs the linux-user-test sh4 binary. And gdb confirms that the LLSC bit does get set.
How would you like to see this patches merged? As they basically touch linux-user code only, I think they should go through Riku.
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
Quoted 9 lines · Aurelien Jarno
Quoted 4 lines · Richard Henderson
As reported by Rich the other day. As I don't have a user-land binary that depends on this, I merely note that it still runs the linux-user-test sh4 binary. And gdb confirms that the LLSC bit does get set.
How would you like to see this patches merged? As they basically touch linux-user code only, I think they should go through Riku.
Ideally, but maybe just easier to generate a pull.
r~
Quoted 7 lines · Richard Henderson
Quoted 6 lines · Aurelien Jarno
Quoted 4 lines · Richard Henderson
As reported by Rich the other day. As I don't have a user-land binary that depends on this, I merely note that it still runs the linux-user-test sh4 binary. And gdb confirms that the LLSC bit does get set.
Quoted 5 lines
Quoted 3 lines
How would you like to see this patches merged? As they basically touch linux-user code only, I think they should go through Riku.
Ideally, but maybe just easier to generate a pull.
I have added them in my sh4-next branch [1], they will be in the next pull request.
[1] http://git.aurel32.net/?p=qemu.git;a=shortlog;h=refs/heads/sh4-next
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
Riku Voipio
Acked-byQuoted 7 lines · Aurelien Jarno
Quoted 1 line · Richard Henderson
On 05/24/2015 03:51 PM, Aurelien Jarno wrote: ...
I have added them in my sh4-next branch [1], they will be in the next pull request.
[1] http://git.aurel32.net/?p=qemu.git;a=shortlog;h=refs/heads/sh4-next
A bit late, but I'm ok for merging these patches via sh4 tree. If you still going to edit branch, you can add my
Riku
Quoted 7 lines · Riku Voipio
Quoted 5 lines · Aurelien Jarno
Quoted 1 line · Richard Henderson
On 05/24/2015 03:51 PM, Aurelien Jarno wrote: ...
I have added them in my sh4-next branch [1], they will be in the next pull request.
Quoted 6 lines
Quoted 1 line
[1] http://git.aurel32.net/?p=qemu.git;a=shortlog;h=refs/heads/sh4-next
A bit late, but I'm ok for merging these patches via sh4 tree. If you still going to edit branch, you can add my
Acked-by Riku Voipio <[email protected]>
It looks like it's too late, sorry about that.
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
Quoted 6 lines · Richard Henderson
As reported by Rich the other day. As I don't have a user-land binary that depends on this, I merely note that it still runs the linux-user-test sh4 binary. And gdb confirms that the LLSC bit does get set.
Rich, can you confirm that this is good enough for your musl test?
I haven't had a chance to build qemu from source with them applied, but in principle they look correct, and they should be fine as long as they do what they claim to (changing cpu default for user, and adding hwcap with the LLSC cap set).
Rich