Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels
@ 2017-02-16 12:39 James Hogan
  2017-02-16 12:39 ` James Hogan
  2017-02-17 18:29 ` Paul Burton
  0 siblings, 2 replies; 6+ messages in thread
From: James Hogan @ 2017-02-16 12:39 UTC (permalink / raw)
  To: Paul Burton, Ralf Baechle; +Cc: linux-mips, stable, James Hogan

When a 32-bit kernel is configured to support MIPS64r6 (CPU_MIPS64_R6),
MIPS_O32_FP64_SUPPORT won't be selected as it should be because
MIPS32_O32 is disabled (o32 is already the default ABI available on
32-bit kernels).

This results in userland FP breakage as CP0_Status.FR is read-only 1
since r6 (when an FPU is present) but CP0_Config5.FRE won't be set to
emulate FR=0.

Force o32 fp64 support in this case by also selecting
MIPS_O32_FP64_SUPPORT from CPU_MIPS64_R6 if 32BIT.

Fixes: 4e9d324d4288 ("MIPS: Require O32 FP64 support for MIPS64 with O32 compat")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 4.0.x-
---
 arch/mips/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b969522feb97..e2890002d6d1 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1531,7 +1531,7 @@ config CPU_MIPS64_R6
 	select CPU_SUPPORTS_HIGHMEM
 	select CPU_SUPPORTS_MSA
 	select GENERIC_CSUM
-	select MIPS_O32_FP64_SUPPORT if MIPS32_O32
+	select MIPS_O32_FP64_SUPPORT if 32BIT || MIPS32_O32
 	select HAVE_KVM
 	help
 	  Choose this option to build a kernel for release 6 or later of the
-- 
git-series 0.8.10

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

* [PATCH] MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels
  2017-02-16 12:39 [PATCH] MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels James Hogan
@ 2017-02-16 12:39 ` James Hogan
  2017-02-17 18:29 ` Paul Burton
  1 sibling, 0 replies; 6+ messages in thread
From: James Hogan @ 2017-02-16 12:39 UTC (permalink / raw)
  To: Paul Burton, Ralf Baechle; +Cc: linux-mips, stable, James Hogan

When a 32-bit kernel is configured to support MIPS64r6 (CPU_MIPS64_R6),
MIPS_O32_FP64_SUPPORT won't be selected as it should be because
MIPS32_O32 is disabled (o32 is already the default ABI available on
32-bit kernels).

This results in userland FP breakage as CP0_Status.FR is read-only 1
since r6 (when an FPU is present) but CP0_Config5.FRE won't be set to
emulate FR=0.

Force o32 fp64 support in this case by also selecting
MIPS_O32_FP64_SUPPORT from CPU_MIPS64_R6 if 32BIT.

Fixes: 4e9d324d4288 ("MIPS: Require O32 FP64 support for MIPS64 with O32 compat")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 4.0.x-
---
 arch/mips/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b969522feb97..e2890002d6d1 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1531,7 +1531,7 @@ config CPU_MIPS64_R6
 	select CPU_SUPPORTS_HIGHMEM
 	select CPU_SUPPORTS_MSA
 	select GENERIC_CSUM
-	select MIPS_O32_FP64_SUPPORT if MIPS32_O32
+	select MIPS_O32_FP64_SUPPORT if 32BIT || MIPS32_O32
 	select HAVE_KVM
 	help
 	  Choose this option to build a kernel for release 6 or later of the
-- 
git-series 0.8.10

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

* Re: [PATCH] MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels
  2017-02-16 12:39 [PATCH] MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels James Hogan
  2017-02-16 12:39 ` James Hogan
@ 2017-02-17 18:29 ` Paul Burton
  2017-02-17 18:29   ` Paul Burton
  2017-02-23 12:52   ` James Hogan
  1 sibling, 2 replies; 6+ messages in thread
From: Paul Burton @ 2017-02-17 18:29 UTC (permalink / raw)
  To: James Hogan; +Cc: Ralf Baechle, linux-mips, stable

[-- Attachment #1: Type: text/plain, Size: 1935 bytes --]

Hi James,

On Thursday, 16 February 2017 04:39:01 PST James Hogan wrote:
> When a 32-bit kernel is configured to support MIPS64r6 (CPU_MIPS64_R6),
> MIPS_O32_FP64_SUPPORT won't be selected as it should be because
> MIPS32_O32 is disabled (o32 is already the default ABI available on
> 32-bit kernels).

Nice catch!

> This results in userland FP breakage as CP0_Status.FR is read-only 1
> since r6 (when an FPU is present) but CP0_Config5.FRE won't be set to
> emulate FR=0.

Perhaps it would be worth clarifying that what it breaks is FPU emulation or 
pre-r6 FP code running atop MIPS32r6 kernels. Since FR=1 context switching 
should work fine for r6 user code, and it would only be impacted if it 
requires emulation for some reason (which is probably why we haven't hit this 
earlier in our CI testing).

> Force o32 fp64 support in this case by also selecting
> MIPS_O32_FP64_SUPPORT from CPU_MIPS64_R6 if 32BIT.
> 
> Fixes: 4e9d324d4288 ("MIPS: Require O32 FP64 support for MIPS64 with O32
> compat") Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Paul Burton <paul.burton@imgtec.com>
> Cc: linux-mips@linux-mips.org
> Cc: <stable@vger.kernel.org> # 4.0.x-
> ---
>  arch/mips/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index b969522feb97..e2890002d6d1 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -1531,7 +1531,7 @@ config CPU_MIPS64_R6
>  	select CPU_SUPPORTS_HIGHMEM
>  	select CPU_SUPPORTS_MSA
>  	select GENERIC_CSUM
> -	select MIPS_O32_FP64_SUPPORT if MIPS32_O32
> +	select MIPS_O32_FP64_SUPPORT if 32BIT || MIPS32_O32
>  	select HAVE_KVM
>  	help
>  	  Choose this option to build a kernel for release 6 or later of the

Besides possibly clarifying the commit message above this looks good to me so:

    Reviewed-by: Paul Burton <paul.burton@imgtec.com>

Thanks,
    Paul

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels
  2017-02-17 18:29 ` Paul Burton
@ 2017-02-17 18:29   ` Paul Burton
  2017-02-23 12:52   ` James Hogan
  1 sibling, 0 replies; 6+ messages in thread
From: Paul Burton @ 2017-02-17 18:29 UTC (permalink / raw)
  To: James Hogan; +Cc: Ralf Baechle, linux-mips, stable

[-- Attachment #1: Type: text/plain, Size: 1935 bytes --]

Hi James,

On Thursday, 16 February 2017 04:39:01 PST James Hogan wrote:
> When a 32-bit kernel is configured to support MIPS64r6 (CPU_MIPS64_R6),
> MIPS_O32_FP64_SUPPORT won't be selected as it should be because
> MIPS32_O32 is disabled (o32 is already the default ABI available on
> 32-bit kernels).

Nice catch!

> This results in userland FP breakage as CP0_Status.FR is read-only 1
> since r6 (when an FPU is present) but CP0_Config5.FRE won't be set to
> emulate FR=0.

Perhaps it would be worth clarifying that what it breaks is FPU emulation or 
pre-r6 FP code running atop MIPS32r6 kernels. Since FR=1 context switching 
should work fine for r6 user code, and it would only be impacted if it 
requires emulation for some reason (which is probably why we haven't hit this 
earlier in our CI testing).

> Force o32 fp64 support in this case by also selecting
> MIPS_O32_FP64_SUPPORT from CPU_MIPS64_R6 if 32BIT.
> 
> Fixes: 4e9d324d4288 ("MIPS: Require O32 FP64 support for MIPS64 with O32
> compat") Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Paul Burton <paul.burton@imgtec.com>
> Cc: linux-mips@linux-mips.org
> Cc: <stable@vger.kernel.org> # 4.0.x-
> ---
>  arch/mips/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index b969522feb97..e2890002d6d1 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -1531,7 +1531,7 @@ config CPU_MIPS64_R6
>  	select CPU_SUPPORTS_HIGHMEM
>  	select CPU_SUPPORTS_MSA
>  	select GENERIC_CSUM
> -	select MIPS_O32_FP64_SUPPORT if MIPS32_O32
> +	select MIPS_O32_FP64_SUPPORT if 32BIT || MIPS32_O32
>  	select HAVE_KVM
>  	help
>  	  Choose this option to build a kernel for release 6 or later of the

Besides possibly clarifying the commit message above this looks good to me so:

    Reviewed-by: Paul Burton <paul.burton@imgtec.com>

Thanks,
    Paul

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels
  2017-02-17 18:29 ` Paul Burton
  2017-02-17 18:29   ` Paul Burton
@ 2017-02-23 12:52   ` James Hogan
  2017-02-23 12:52     ` James Hogan
  1 sibling, 1 reply; 6+ messages in thread
From: James Hogan @ 2017-02-23 12:52 UTC (permalink / raw)
  To: Paul Burton; +Cc: Ralf Baechle, linux-mips, stable

[-- Attachment #1: Type: text/plain, Size: 1129 bytes --]

Hi Paul,

On Fri, Feb 17, 2017 at 10:29:11AM -0800, Paul Burton wrote:
> > This results in userland FP breakage as CP0_Status.FR is read-only 1
> > since r6 (when an FPU is present) but CP0_Config5.FRE won't be set to
> > emulate FR=0.
> 
> Perhaps it would be worth clarifying that what it breaks is FPU emulation or 
> pre-r6 FP code running atop MIPS32r6 kernels. Since FR=1 context switching 
> should work fine for r6 user code, and it would only be impacted if it 
> requires emulation for some reason (which is probably why we haven't hit this 
> earlier in our CI testing).

Thanks Paul, it does indeed invoke the FPU emulator as it fails to set
FR=0. I'll update that paragraph to say this:
> This results in userland FP breakage as CP0_Status.FR is read-only 1
> since r6 (when an FPU is present) so __enable_fpu() will fail to clear
> FR. This causes the FPU emulator to get used which will incorrectly
> emulate 32-bit FPU registers.


> Besides possibly clarifying the commit message above this looks good to me so:
> 
>     Reviewed-by: Paul Burton <paul.burton@imgtec.com>

Thanks
James

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: [PATCH] MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels
  2017-02-23 12:52   ` James Hogan
@ 2017-02-23 12:52     ` James Hogan
  0 siblings, 0 replies; 6+ messages in thread
From: James Hogan @ 2017-02-23 12:52 UTC (permalink / raw)
  To: Paul Burton; +Cc: Ralf Baechle, linux-mips, stable

[-- Attachment #1: Type: text/plain, Size: 1129 bytes --]

Hi Paul,

On Fri, Feb 17, 2017 at 10:29:11AM -0800, Paul Burton wrote:
> > This results in userland FP breakage as CP0_Status.FR is read-only 1
> > since r6 (when an FPU is present) but CP0_Config5.FRE won't be set to
> > emulate FR=0.
> 
> Perhaps it would be worth clarifying that what it breaks is FPU emulation or 
> pre-r6 FP code running atop MIPS32r6 kernels. Since FR=1 context switching 
> should work fine for r6 user code, and it would only be impacted if it 
> requires emulation for some reason (which is probably why we haven't hit this 
> earlier in our CI testing).

Thanks Paul, it does indeed invoke the FPU emulator as it fails to set
FR=0. I'll update that paragraph to say this:
> This results in userland FP breakage as CP0_Status.FR is read-only 1
> since r6 (when an FPU is present) so __enable_fpu() will fail to clear
> FR. This causes the FPU emulator to get used which will incorrectly
> emulate 32-bit FPU registers.


> Besides possibly clarifying the commit message above this looks good to me so:
> 
>     Reviewed-by: Paul Burton <paul.burton@imgtec.com>

Thanks
James

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

end of thread, other threads:[~2017-02-23 12:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-16 12:39 [PATCH] MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels James Hogan
2017-02-16 12:39 ` James Hogan
2017-02-17 18:29 ` Paul Burton
2017-02-17 18:29   ` Paul Burton
2017-02-23 12:52   ` James Hogan
2017-02-23 12:52     ` James Hogan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox