All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu: Backport a patch to solve SSE2 instruction emulation issues
@ 2012-04-19  7:44 Richard Purdie
  2012-04-19  7:49 ` Ni Qingliang
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2012-04-19  7:44 UTC (permalink / raw)
  To: openembedded-core

This fix addresses various issues seen in qemux86-64 images:
 * scroll bars in matchbox-terminal not working
 * files not appearing in pcmanfm
 * warnings on the console from glib/gobject about invalid gdouble values

Its due to an emulation issue in qemu which the backported patch fixes.

I managed to debug it to a specific function, Khem found the qemu patch
to backport, thanks Khem!

[YOCTO #1906]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/meta/recipes-devtools/qemu/qemu-0.15.1/a4d1f142542935b90d2eb30f3aead4edcf455fe6.patch b/meta/recipes-devtools/qemu/qemu-0.15.1/a4d1f142542935b90d2eb30f3aead4edcf455fe6.patch
new file mode 100644
index 0000000..405d557
--- a/dev/null
+++ b/meta/recipes-devtools/qemu/qemu-0.15.1/a4d1f142542935b90d2eb30f3aead4edcf455fe6.patch
@@ -0,0 +1,66 @@
+From a4d1f142542935b90d2eb30f3aead4edcf455fe6 Mon Sep 17 00:00:00 2001
+From: Aurelien Jarno <aurelien@aurel32.net>
+Date: Sat, 7 Jan 2012 15:20:11 +0100
+Subject: [PATCH 1/1] target-i386: fix {min,max}{pd,ps,sd,ss} SSE2 instructions
+
+minpd, minps, minsd, minss and maxpd, maxps, maxsd, maxss SSE2
+instructions have been broken when switching target-i386 to softfloat.
+It's not possible to use comparison instructions on float types anymore
+to softfloat, so use the floatXX_lt function instead, as the
+float_XX_min and float_XX_max functions can't be used due to the Intel
+specific behaviour.
+
+As it implements the correct NaNs behaviour, let's remove the
+corresponding entry from the TODO.
+
+It fixes GDM screen display on Debian Lenny.
+
+Thanks to Peter Maydell and Jason Wessel for their analysis of the
+problem.
+
+Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
+---
+ target-i386/TODO      |    1 -
+ target-i386/ops_sse.h |    9 +++++++--
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+This fixes scrollbar issues in matchbox-terminal/vte on qemux86-64 and
+files not appearing in pcmanfm, as well as glib/gobject errors to do with gdoubles
+on the console [YOCTO #1906]
+
+Upstream-Status: Backport
+
+Index: qemu-0.15.1/target-i386/TODO
+===================================================================
+--- qemu-0.15.1.orig/target-i386/TODO	2011-10-12 16:41:43.000000000 +0000
++++ qemu-0.15.1/target-i386/TODO	2012-04-19 07:30:38.704073075 +0000
+@@ -15,7 +15,6 @@
+ - DRx register support
+ - CR0.AC emulation
+ - SSE alignment checks
+-- fix SSE min/max with nans
+ 
+ Optimizations/Features:
+ 
+Index: qemu-0.15.1/target-i386/ops_sse.h
+===================================================================
+--- qemu-0.15.1.orig/target-i386/ops_sse.h	2011-10-12 16:41:43.000000000 +0000
++++ qemu-0.15.1/target-i386/ops_sse.h	2012-04-19 07:30:38.712073076 +0000
+@@ -584,10 +584,15 @@
+ #define FPU_SUB(size, a, b) float ## size ## _sub(a, b, &env->sse_status)
+ #define FPU_MUL(size, a, b) float ## size ## _mul(a, b, &env->sse_status)
+ #define FPU_DIV(size, a, b) float ## size ## _div(a, b, &env->sse_status)
+-#define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b)
+-#define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b)
+ #define FPU_SQRT(size, a, b) float ## size ## _sqrt(b, &env->sse_status)
+ 
++/* Note that the choice of comparison op here is important to get the
++ * special cases right: for min and max Intel specifies that (-0,0),
++ * (NaN, anything) and (anything, NaN) return the second argument.
++ */
++#define FPU_MIN(size, a, b) float ## size ## _lt(a, b, &env->sse_status) ? (a) : (b)
++#define FPU_MAX(size, a, b) float ## size ## _lt(b, a, &env->sse_status) ? (a) : (b)
++
+ SSE_HELPER_S(add, FPU_ADD)
+ SSE_HELPER_S(sub, FPU_SUB)
+ SSE_HELPER_S(mul, FPU_MUL)
diff --git a/meta/recipes-devtools/qemu/qemu_0.15.1.bb b/meta/recipes-devtools/qemu/qemu_0.15.1.bb
index 05ea5f8..e90f339 100644
--- a/meta/recipes-devtools/qemu/qemu_0.15.1.bb
+++ b/meta/recipes-devtools/qemu/qemu_0.15.1.bb
@@ -3,7 +3,7 @@ require qemu.inc
 LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
                     file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913"
 
-PR = "r5"
+PR = "r6"
 
 FILESPATH = "${FILE_DIRNAME}/qemu-${PV}"
 FILESDIR = "${WORKDIR}"
@@ -18,6 +18,7 @@ SRC_URI = "\
     file://fallback-to-safe-mmap_min_addr.patch \
     file://larger_default_ram_size.patch \
     file://arm-bgr.patch \
+    file://a4d1f142542935b90d2eb30f3aead4edcf455fe6.patch \
     "
 
 # Only use the GL passthrough patches for native/nativesdk versions





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

* Re: [PATCH] qemu: Backport a patch to solve SSE2 instruction emulation issues
  2012-04-19  7:44 [PATCH] qemu: Backport a patch to solve SSE2 instruction emulation issues Richard Purdie
@ 2012-04-19  7:49 ` Ni Qingliang
  2012-04-19 10:29   ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Ni Qingliang @ 2012-04-19  7:49 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

why not update to qemu-1.0.1 ?

On Thu, 2012-04-19 at 15:44 +0800, Richard Purdie wrote:
> This fix addresses various issues seen in qemux86-64 images:
>  * scroll bars in matchbox-terminal not working
>  * files not appearing in pcmanfm
>  * warnings on the console from glib/gobject about invalid gdouble values
> 
> Its due to an emulation issue in qemu which the backported patch fixes.
> 
> I managed to debug it to a specific function, Khem found the qemu patch
> to backport, thanks Khem!
> 
> [YOCTO #1906]
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> diff --git a/meta/recipes-devtools/qemu/qemu-0.15.1/a4d1f142542935b90d2eb30f3aead4edcf455fe6.patch b/meta/recipes-devtools/qemu/qemu-0.15.1/a4d1f142542935b90d2eb30f3aead4edcf455fe6.patch
> new file mode 100644
> index 0000000..405d557
> --- a/dev/null
> +++ b/meta/recipes-devtools/qemu/qemu-0.15.1/a4d1f142542935b90d2eb30f3aead4edcf455fe6.patch
> @@ -0,0 +1,66 @@
> +From a4d1f142542935b90d2eb30f3aead4edcf455fe6 Mon Sep 17 00:00:00 2001
> +From: Aurelien Jarno <aurelien@aurel32.net>
> +Date: Sat, 7 Jan 2012 15:20:11 +0100
> +Subject: [PATCH 1/1] target-i386: fix {min,max}{pd,ps,sd,ss} SSE2 instructions
> +
> +minpd, minps, minsd, minss and maxpd, maxps, maxsd, maxss SSE2
> +instructions have been broken when switching target-i386 to softfloat.
> +It's not possible to use comparison instructions on float types anymore
> +to softfloat, so use the floatXX_lt function instead, as the
> +float_XX_min and float_XX_max functions can't be used due to the Intel
> +specific behaviour.
> +
> +As it implements the correct NaNs behaviour, let's remove the
> +corresponding entry from the TODO.
> +
> +It fixes GDM screen display on Debian Lenny.
> +
> +Thanks to Peter Maydell and Jason Wessel for their analysis of the
> +problem.
> +
> +Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> +---
> + target-i386/TODO      |    1 -
> + target-i386/ops_sse.h |    9 +++++++--
> + 2 files changed, 7 insertions(+), 3 deletions(-)
> +
> +This fixes scrollbar issues in matchbox-terminal/vte on qemux86-64 and
> +files not appearing in pcmanfm, as well as glib/gobject errors to do with gdoubles
> +on the console [YOCTO #1906]
> +
> +Upstream-Status: Backport
> +
> +Index: qemu-0.15.1/target-i386/TODO
> +===================================================================
> +--- qemu-0.15.1.orig/target-i386/TODO	2011-10-12 16:41:43.000000000 +0000
> ++++ qemu-0.15.1/target-i386/TODO	2012-04-19 07:30:38.704073075 +0000
> +@@ -15,7 +15,6 @@
> + - DRx register support
> + - CR0.AC emulation
> + - SSE alignment checks
> +-- fix SSE min/max with nans
> + 
> + Optimizations/Features:
> + 
> +Index: qemu-0.15.1/target-i386/ops_sse.h
> +===================================================================
> +--- qemu-0.15.1.orig/target-i386/ops_sse.h	2011-10-12 16:41:43.000000000 +0000
> ++++ qemu-0.15.1/target-i386/ops_sse.h	2012-04-19 07:30:38.712073076 +0000
> +@@ -584,10 +584,15 @@
> + #define FPU_SUB(size, a, b) float ## size ## _sub(a, b, &env->sse_status)
> + #define FPU_MUL(size, a, b) float ## size ## _mul(a, b, &env->sse_status)
> + #define FPU_DIV(size, a, b) float ## size ## _div(a, b, &env->sse_status)
> +-#define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b)
> +-#define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b)
> + #define FPU_SQRT(size, a, b) float ## size ## _sqrt(b, &env->sse_status)
> + 
> ++/* Note that the choice of comparison op here is important to get the
> ++ * special cases right: for min and max Intel specifies that (-0,0),
> ++ * (NaN, anything) and (anything, NaN) return the second argument.
> ++ */
> ++#define FPU_MIN(size, a, b) float ## size ## _lt(a, b, &env->sse_status) ? (a) : (b)
> ++#define FPU_MAX(size, a, b) float ## size ## _lt(b, a, &env->sse_status) ? (a) : (b)
> ++
> + SSE_HELPER_S(add, FPU_ADD)
> + SSE_HELPER_S(sub, FPU_SUB)
> + SSE_HELPER_S(mul, FPU_MUL)
> diff --git a/meta/recipes-devtools/qemu/qemu_0.15.1.bb b/meta/recipes-devtools/qemu/qemu_0.15.1.bb
> index 05ea5f8..e90f339 100644
> --- a/meta/recipes-devtools/qemu/qemu_0.15.1.bb
> +++ b/meta/recipes-devtools/qemu/qemu_0.15.1.bb
> @@ -3,7 +3,7 @@ require qemu.inc
>  LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
>                      file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913"
>  
> -PR = "r5"
> +PR = "r6"
>  
>  FILESPATH = "${FILE_DIRNAME}/qemu-${PV}"
>  FILESDIR = "${WORKDIR}"
> @@ -18,6 +18,7 @@ SRC_URI = "\
>      file://fallback-to-safe-mmap_min_addr.patch \
>      file://larger_default_ram_size.patch \
>      file://arm-bgr.patch \
> +    file://a4d1f142542935b90d2eb30f3aead4edcf455fe6.patch \
>      "
>  
>  # Only use the GL passthrough patches for native/nativesdk versions
> 
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

-- 
Yi Qingliang
niqingliang@insigma.com.cn
https://niqingliang2003.wordpress.com




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

* Re: [PATCH] qemu: Backport a patch to solve SSE2 instruction emulation issues
  2012-04-19  7:49 ` Ni Qingliang
@ 2012-04-19 10:29   ` Richard Purdie
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2012-04-19 10:29 UTC (permalink / raw)
  To: niqingliang, Patches and discussions about the oe-core layer

On Thu, 2012-04-19 at 15:49 +0800, Ni Qingliang wrote:
> why not update to qemu-1.0.1 ?

That requires a bit more work and is not suitable for a point release.
We do need to update in the 1.3 cycle but that is a lot more work and
will happen later. I think this is therefore a reasonable way to fix the
bug in question.

Cheers,

Richard




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

end of thread, other threads:[~2012-04-19 10:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19  7:44 [PATCH] qemu: Backport a patch to solve SSE2 instruction emulation issues Richard Purdie
2012-04-19  7:49 ` Ni Qingliang
2012-04-19 10:29   ` Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.