Re: [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user

2018-10-09 Thread Peter Maydell
On 8 October 2018 at 17:16, Cornelia Huck  wrote:
> On Mon,  8 Oct 2018 17:32:04 +0200
> David Hildenbrand  wrote:
>
>> linux-user should always enable AFP, otherwise our emulated binary
>> might crash once it tries to make use of additional floating-point
>> registers or instructions.
>>
>> Cc: Peter Maydell 
>> Cc: Alex Bennée 
>> Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data 
>> exceptions")
>> Reported-by: Alex Bennée 
>> Signed-off-by: David Hildenbrand 
>> ---
>>  target/s390x/cpu.c | 5 +
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
>> index 8ed4823d6e..18ba7f85a5 100644
>> --- a/target/s390x/cpu.c
>> +++ b/target/s390x/cpu.c
>> @@ -145,6 +145,11 @@ static void s390_cpu_full_reset(CPUState *s)
>>  env->cregs[0] = CR0_RESET;
>>  env->cregs[14] = CR14_RESET;
>>
>> +#if defined(CONFIG_USER_ONLY)
>> +/* user mode should always be allowed to use the full FPU */
>> +env->cregs[0] |= CR0_AFP;
>> +#endif
>> +
>>  /* architectured initial value for Breaking-Event-Address register */
>>  env->gbea = 1;
>>
>
> In case this is applied directly:
>
> Reviewed-by: Cornelia Huck 
> Tested-by: Cornelia Huck 

Thanks; I've applied it to master, and also added 'make check-tcg'
to my set of things I run as part of a merge, which should catch
this kind of bug in future.

-- PMM



Re: [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user

2018-10-08 Thread Cornelia Huck
On Mon,  8 Oct 2018 17:32:04 +0200
David Hildenbrand  wrote:

> linux-user should always enable AFP, otherwise our emulated binary
> might crash once it tries to make use of additional floating-point
> registers or instructions.
> 
> Cc: Peter Maydell 
> Cc: Alex Bennée 
> Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data 
> exceptions")
> Reported-by: Alex Bennée 
> Signed-off-by: David Hildenbrand 
> ---
>  target/s390x/cpu.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index 8ed4823d6e..18ba7f85a5 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -145,6 +145,11 @@ static void s390_cpu_full_reset(CPUState *s)
>  env->cregs[0] = CR0_RESET;
>  env->cregs[14] = CR14_RESET;
>  
> +#if defined(CONFIG_USER_ONLY)
> +/* user mode should always be allowed to use the full FPU */
> +env->cregs[0] |= CR0_AFP;
> +#endif
> +
>  /* architectured initial value for Breaking-Event-Address register */
>  env->gbea = 1;
>  

In case this is applied directly:

Reviewed-by: Cornelia Huck 
Tested-by: Cornelia Huck 



Re: [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user

2018-10-08 Thread Alex Bennée


David Hildenbrand  writes:

> linux-user should always enable AFP, otherwise our emulated binary
> might crash once it tries to make use of additional floating-point
> registers or instructions.
>
> Cc: Peter Maydell 
> Cc: Alex Bennée 
> Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data 
> exceptions")
> Reported-by: Alex Bennée 
> Signed-off-by: David Hildenbrand 
> ---
>  target/s390x/cpu.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index 8ed4823d6e..18ba7f85a5 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -145,6 +145,11 @@ static void s390_cpu_full_reset(CPUState *s)
>  env->cregs[0] = CR0_RESET;
>  env->cregs[14] = CR14_RESET;
>
> +#if defined(CONFIG_USER_ONLY)
> +/* user mode should always be allowed to use the full FPU */
> +env->cregs[0] |= CR0_AFP;
> +#endif
> +

Reviewed-by: Alex Bennée 
Tested-by: Alex Bennée 


>  /* architectured initial value for Breaking-Event-Address register */
>  env->gbea = 1;


--
Alex Bennée



Re: [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user

2018-10-08 Thread Cornelia Huck
On Mon,  8 Oct 2018 17:32:04 +0200
David Hildenbrand  wrote:

> linux-user should always enable AFP, otherwise our emulated binary
> might crash once it tries to make use of additional floating-point
> registers or instructions.
> 
> Cc: Peter Maydell 
> Cc: Alex Bennée 
> Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data 
> exceptions")
> Reported-by: Alex Bennée 
> Signed-off-by: David Hildenbrand 
> ---
>  target/s390x/cpu.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index 8ed4823d6e..18ba7f85a5 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -145,6 +145,11 @@ static void s390_cpu_full_reset(CPUState *s)
>  env->cregs[0] = CR0_RESET;
>  env->cregs[14] = CR14_RESET;
>  
> +#if defined(CONFIG_USER_ONLY)
> +/* user mode should always be allowed to use the full FPU */
> +env->cregs[0] |= CR0_AFP;
> +#endif
> +
>  /* architectured initial value for Breaking-Event-Address register */
>  env->gbea = 1;
>  

I've reproduced the crash via make check-tcg, and this patch fixes it.

Thanks, applied.



Re: [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user

2018-10-08 Thread Richard Henderson
On 10/8/18 8:32 AM, David Hildenbrand wrote:
> linux-user should always enable AFP, otherwise our emulated binary
> might crash once it tries to make use of additional floating-point
> registers or instructions.
> 
> Cc: Peter Maydell 
> Cc: Alex Bennée 
> Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data 
> exceptions")
> Reported-by: Alex Bennée 
> Signed-off-by: David Hildenbrand 
> ---
>  target/s390x/cpu.c | 5 +
>  1 file changed, 5 insertions(+)

Reviewed-by: Richard Henderson 


r~



Re: [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user

2018-10-08 Thread Thomas Huth
On 2018-10-08 17:32, David Hildenbrand wrote:
> linux-user should always enable AFP, otherwise our emulated binary
> might crash once it tries to make use of additional floating-point
> registers or instructions.
> 
> Cc: Peter Maydell 
> Cc: Alex Bennée 
> Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data 
> exceptions")
> Reported-by: Alex Bennée 
> Signed-off-by: David Hildenbrand 
> ---
>  target/s390x/cpu.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index 8ed4823d6e..18ba7f85a5 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -145,6 +145,11 @@ static void s390_cpu_full_reset(CPUState *s)
>  env->cregs[0] = CR0_RESET;
>  env->cregs[14] = CR14_RESET;
>  
> +#if defined(CONFIG_USER_ONLY)
> +/* user mode should always be allowed to use the full FPU */
> +env->cregs[0] |= CR0_AFP;
> +#endif
> +
>  /* architectured initial value for Breaking-Event-Address register */
>  env->gbea = 1;
>  
> 

Reviewed-by: Thomas Huth 



[Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user

2018-10-08 Thread David Hildenbrand
linux-user should always enable AFP, otherwise our emulated binary
might crash once it tries to make use of additional floating-point
registers or instructions.

Cc: Peter Maydell 
Cc: Alex Bennée 
Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data 
exceptions")
Reported-by: Alex Bennée 
Signed-off-by: David Hildenbrand 
---
 target/s390x/cpu.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 8ed4823d6e..18ba7f85a5 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -145,6 +145,11 @@ static void s390_cpu_full_reset(CPUState *s)
 env->cregs[0] = CR0_RESET;
 env->cregs[14] = CR14_RESET;
 
+#if defined(CONFIG_USER_ONLY)
+/* user mode should always be allowed to use the full FPU */
+env->cregs[0] |= CR0_AFP;
+#endif
+
 /* architectured initial value for Breaking-Event-Address register */
 env->gbea = 1;
 
-- 
2.17.1