diff mbox

[1/2] target-ppc: Change default cpu for ppc64le-linux-user

Message ID 1403973928-9717-2-git-send-email-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson June 28, 2014, 4:45 p.m. UTC
The default, 970fx, doesn't support MSR_LE.  So even though we set LE in
ppc_cpu_reset, it gets cleared again in hreg_store_msr.  Error out if a
user-selected cpu model doesn't support LE.

Cc: Aldy Hernandez <aldyh@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
The warning one gets from the unimplemented insns from tcg
is perhaps unfortunate, but it's better than silently dropping
the MSR_LE bit and interpreting the first few insns with the
wrong endianness and generating SIGILL.

One could, perhaps, simply return false from need_byteswap.
But then the value of MSR would still be wrong, and I can imagine
that would affect gdb's interpretation of the current mode.


r~
---
 linux-user/main.c           | 10 +++++++---
 target-ppc/translate_init.c |  4 ++++
 2 files changed, 11 insertions(+), 3 deletions(-)

Comments

Alexander Graf June 28, 2014, 4:50 p.m. UTC | #1
> Am 28.06.2014 um 18:45 schrieb Richard Henderson <rth@twiddle.net>:
> 
> The default, 970fx, doesn't support MSR_LE.  So even though we set LE in
> ppc_cpu_reset, it gets cleared again in hreg_store_msr.  Error out if a
> user-selected cpu model doesn't support LE.
> 
> Cc: Aldy Hernandez <aldyh@redhat.com>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
> The warning one gets from the unimplemented insns from tcg
> is perhaps unfortunate, but it's better than silently dropping
> the MSR_LE bit and interpreting the first few insns with the
> wrong endianness and generating SIGILL.
> 
> One could, perhaps, simply return false from need_byteswap.
> But then the value of MSR would still be wrong, and I can imagine
> that would affect gdb's interpretation of the current mode.
> 
> 
> r~
> ---
> linux-user/main.c           | 10 +++++++---
> target-ppc/translate_init.c |  4 ++++
> 2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/linux-user/main.c b/linux-user/main.c
> index 900a17f..058b08c 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -3901,11 +3901,15 @@ int main(int argc, char **argv, char **envp)
> #elif defined TARGET_OPENRISC
>         cpu_model = "or1200";
> #elif defined(TARGET_PPC)
> -#ifdef TARGET_PPC64
> +# ifdef TARGET_PPC64
> +#  ifdef TARGET_WORDS_BIGENDIAN
>         cpu_model = "970fx";
> -#else
> +#  else
> +        cpu_model = "POWER7";

How about we switch to p7 for BE top?

Alex

> +#  endif
> +# else
>         cpu_model = "750";
> -#endif
> +# endif
> #else
>         cpu_model = "any";
> #endif
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 85581c9..72128d8 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -9538,6 +9538,10 @@ static void ppc_cpu_reset(CPUState *s)
> #endif
> #if !defined(TARGET_WORDS_BIGENDIAN)
>     msr |= (target_ulong)1 << MSR_LE; /* Little-endian user mode */
> +    if (!((env->msr_mask >> MSR_LE) & 1)) {
> +        fprintf(stderr, "Selected CPU does not support little-endian.\n");
> +        exit(1);
> +    }
> #endif
> #endif
> 
> -- 
> 1.9.3
>
Richard Henderson June 28, 2014, 6:42 p.m. UTC | #2
On 06/28/2014 09:50 AM, Alexander Graf wrote:
> How about we switch to p7 for BE top?

Not ideal until we implement all of p7's insns in TCG:

Warning: Disabling some instructions which are not emulated by TCG (0x0, 0x4)


r~
Tom Musta June 30, 2014, 12:08 p.m. UTC | #3
On 6/28/2014 1:42 PM, Richard Henderson wrote:
> On 06/28/2014 09:50 AM, Alexander Graf wrote:
>> How about we switch to p7 for BE top?
> 
> Not ideal until we implement all of p7's insns in TCG:
> 
> Warning: Disabling some instructions which are not emulated by TCG (0x0, 0x4)
> 
> 
> r~
> 

That was dealt with in this patch: http://lists.nongnu.org/archive/html/qemu-ppc/2014-06/msg00479.html and has now made its way into HEAD.
Alexander Graf June 30, 2014, 12:17 p.m. UTC | #4
On 30.06.14 14:08, Tom Musta wrote:
> On 6/28/2014 1:42 PM, Richard Henderson wrote:
>> On 06/28/2014 09:50 AM, Alexander Graf wrote:
>>> How about we switch to p7 for BE top?
>> Not ideal until we implement all of p7's insns in TCG:
>>
>> Warning: Disabling some instructions which are not emulated by TCG (0x0, 0x4)
>>
>>
>> r~
>>
> That was dealt with in this patch: http://lists.nongnu.org/archive/html/qemu-ppc/2014-06/msg00479.html and has now made its way into HEAD.
>

Yup, I'll change the default for BE to POWER7 too while applying.


Alex
diff mbox

Patch

diff --git a/linux-user/main.c b/linux-user/main.c
index 900a17f..058b08c 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3901,11 +3901,15 @@  int main(int argc, char **argv, char **envp)
 #elif defined TARGET_OPENRISC
         cpu_model = "or1200";
 #elif defined(TARGET_PPC)
-#ifdef TARGET_PPC64
+# ifdef TARGET_PPC64
+#  ifdef TARGET_WORDS_BIGENDIAN
         cpu_model = "970fx";
-#else
+#  else
+        cpu_model = "POWER7";
+#  endif
+# else
         cpu_model = "750";
-#endif
+# endif
 #else
         cpu_model = "any";
 #endif
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 85581c9..72128d8 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -9538,6 +9538,10 @@  static void ppc_cpu_reset(CPUState *s)
 #endif
 #if !defined(TARGET_WORDS_BIGENDIAN)
     msr |= (target_ulong)1 << MSR_LE; /* Little-endian user mode */
+    if (!((env->msr_mask >> MSR_LE) & 1)) {
+        fprintf(stderr, "Selected CPU does not support little-endian.\n");
+        exit(1);
+    }
 #endif
 #endif