qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user
@ 2018-10-08 15:32 David Hildenbrand
  2018-10-08 15:39 ` Thomas Huth
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: David Hildenbrand @ 2018-10-08 15:32 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-s390x, Thomas Huth, Christian Borntraeger, Cornelia Huck,
	Richard Henderson, Alexander Graf, David Hildenbrand,
	Peter Maydell, Alex Bennée

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 <peter.maydell@linaro.org>
Cc: Alex Bennée <alex.bennee@linaro.org>
Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")
Reported-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user
  2018-10-08 15:32 [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user David Hildenbrand
@ 2018-10-08 15:39 ` Thomas Huth
  2018-10-08 16:04 ` Cornelia Huck
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2018-10-08 15:39 UTC (permalink / raw)
  To: David Hildenbrand, qemu-devel
  Cc: qemu-s390x, Christian Borntraeger, Cornelia Huck,
	Richard Henderson, Alexander Graf, Peter Maydell,
	Alex Bennée

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 <peter.maydell@linaro.org>
> Cc: Alex Bennée <alex.bennee@linaro.org>
> Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")
> Reported-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  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 <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user
  2018-10-08 15:32 [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user David Hildenbrand
  2018-10-08 15:39 ` Thomas Huth
@ 2018-10-08 16:04 ` Cornelia Huck
  2018-10-08 16:04 ` Richard Henderson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Cornelia Huck @ 2018-10-08 16:04 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: qemu-devel, qemu-s390x, Thomas Huth, Christian Borntraeger,
	Richard Henderson, Alexander Graf, Peter Maydell,
	Alex Bennée

On Mon,  8 Oct 2018 17:32:04 +0200
David Hildenbrand <david@redhat.com> 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 <peter.maydell@linaro.org>
> Cc: Alex Bennée <alex.bennee@linaro.org>
> Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")
> Reported-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user
  2018-10-08 15:32 [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user David Hildenbrand
  2018-10-08 15:39 ` Thomas Huth
  2018-10-08 16:04 ` Cornelia Huck
@ 2018-10-08 16:04 ` Richard Henderson
  2018-10-08 16:11 ` Alex Bennée
  2018-10-08 16:16 ` Cornelia Huck
  4 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2018-10-08 16:04 UTC (permalink / raw)
  To: David Hildenbrand, qemu-devel
  Cc: qemu-s390x, Thomas Huth, Christian Borntraeger, Cornelia Huck,
	Alexander Graf, Peter Maydell, Alex Bennée

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 <peter.maydell@linaro.org>
> Cc: Alex Bennée <alex.bennee@linaro.org>
> Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")
> Reported-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  target/s390x/cpu.c | 5 +++++
>  1 file changed, 5 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user
  2018-10-08 15:32 [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user David Hildenbrand
                   ` (2 preceding siblings ...)
  2018-10-08 16:04 ` Richard Henderson
@ 2018-10-08 16:11 ` Alex Bennée
  2018-10-08 16:16 ` Cornelia Huck
  4 siblings, 0 replies; 7+ messages in thread
From: Alex Bennée @ 2018-10-08 16:11 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: qemu-devel, qemu-s390x, Thomas Huth, Christian Borntraeger,
	Cornelia Huck, Richard Henderson, Alexander Graf, Peter Maydell


David Hildenbrand <david@redhat.com> 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 <peter.maydell@linaro.org>
> Cc: Alex Bennée <alex.bennee@linaro.org>
> Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")
> Reported-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  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 <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>


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


--
Alex Bennée

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user
  2018-10-08 15:32 [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user David Hildenbrand
                   ` (3 preceding siblings ...)
  2018-10-08 16:11 ` Alex Bennée
@ 2018-10-08 16:16 ` Cornelia Huck
  2018-10-09 10:31   ` Peter Maydell
  4 siblings, 1 reply; 7+ messages in thread
From: Cornelia Huck @ 2018-10-08 16:16 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: qemu-devel, qemu-s390x, Thomas Huth, Christian Borntraeger,
	Richard Henderson, Alexander Graf, Peter Maydell,
	Alex Bennée

On Mon,  8 Oct 2018 17:32:04 +0200
David Hildenbrand <david@redhat.com> 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 <peter.maydell@linaro.org>
> Cc: Alex Bennée <alex.bennee@linaro.org>
> Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")
> Reported-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  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 <cohuck@redhat.com>
Tested-by: Cornelia Huck <cohuck@redhat.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user
  2018-10-08 16:16 ` Cornelia Huck
@ 2018-10-09 10:31   ` Peter Maydell
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2018-10-09 10:31 UTC (permalink / raw)
  To: Cornelia Huck
  Cc: David Hildenbrand, QEMU Developers, qemu-s390x, Thomas Huth,
	Christian Borntraeger, Richard Henderson, Alexander Graf,
	Alex Bennée

On 8 October 2018 at 17:16, Cornelia Huck <cohuck@redhat.com> wrote:
> On Mon,  8 Oct 2018 17:32:04 +0200
> David Hildenbrand <david@redhat.com> 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 <peter.maydell@linaro.org>
>> Cc: Alex Bennée <alex.bennee@linaro.org>
>> Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")
>> Reported-by: Alex Bennée <alex.bennee@linaro.org>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>  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 <cohuck@redhat.com>
> Tested-by: Cornelia Huck <cohuck@redhat.com>

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-10-09 10:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-08 15:32 [Qemu-devel] [PATCH] s390x/tcg: always enable AFP for linux-user David Hildenbrand
2018-10-08 15:39 ` Thomas Huth
2018-10-08 16:04 ` Cornelia Huck
2018-10-08 16:04 ` Richard Henderson
2018-10-08 16:11 ` Alex Bennée
2018-10-08 16:16 ` Cornelia Huck
2018-10-09 10:31   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).