summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-05-04 11:39:58 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-05-04 12:14:57 +0100
commit12e2d10541b0b7b1cc6bd601d8b2519a104cc29f (patch)
treeab129b6ecce65ab2ae6038c18c2d288b35228514 /meta/recipes-devtools/qemu
parent90aefeb6a016b518324cfbd03700f44f6f17a29f (diff)
downloadpoky-12e2d10541b0b7b1cc6bd601d8b2519a104cc29f.tar.gz
qemu: Add fix for powerpc instruction fallback issue
See the patch for more details, fixes a regression in qemu causing illegal instructions in libm on powerpc, triggered by a libinput upgrade. https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=f1c56cdff09f650ad721fae026eb6a3651631f3d was the glibc code generating the instruction and triggering the issue. (From OE-Core rev: bf0e4c8bb6ba22274d17d74c1df69a78f8aa157c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/qemu')
-rw-r--r--meta/recipes-devtools/qemu/qemu.inc1
-rw-r--r--meta/recipes-devtools/qemu/qemu/ppc.patch70
2 files changed, 71 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index e2453dd8bc..29bc34d743 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -35,6 +35,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
35 file://0001-tracetool-use-relative-paths-for-line-preprocessor-d.patch \ 35 file://0001-tracetool-use-relative-paths-for-line-preprocessor-d.patch \
36 file://qemu-guest-agent.init \ 36 file://qemu-guest-agent.init \
37 file://qemu-guest-agent.udev \ 37 file://qemu-guest-agent.udev \
38 file://ppc.patch \
38 " 39 "
39UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" 40UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
40 41
diff --git a/meta/recipes-devtools/qemu/qemu/ppc.patch b/meta/recipes-devtools/qemu/qemu/ppc.patch
new file mode 100644
index 0000000000..ade1daf61f
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/ppc.patch
@@ -0,0 +1,70 @@
1target/ppc: Fix fallback to MFSS for MFFSCRN, MFFSCRNI, MFFSCE and MFFSL
2
3The following commits changed the code such that these instructions became invalid
4on pre 3.0 ISAs:
5
6 bf8adfd88b547680aa857c46098f3a1e94373160 - target/ppc: Move mffscrn[i] to decodetree
7 394c2e2fda70da722f20fb60412d6c0ca4bfaa03 - target/ppc: Move mffsce to decodetree
8 3e5bce70efe6bd1f684efbb21fd2a316cbf0657e - target/ppc: Move mffsl to decodetree
9
10The hardware will handle them as a MFFS instruction as the code did previously.
11Restore that behaviour. This means applications that were segfaulting under qemu
12when encountering these instructions now operate correctly. The instruction
13is used in glibc libm functions for example.
14
15Upstream-Status: Submitted [https://lore.kernel.org/qemu-devel/20230504110150.3044402-1-richard.purdie@linuxfoundation.org/]
16
17Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
18
19Index: qemu-8.0.0/target/ppc/translate/fp-impl.c.inc
20===================================================================
21--- qemu-8.0.0.orig/target/ppc/translate/fp-impl.c.inc
22+++ qemu-8.0.0/target/ppc/translate/fp-impl.c.inc
23@@ -584,7 +584,10 @@ static bool trans_MFFSCE(DisasContext *c
24 {
25 TCGv_i64 fpscr;
26
27- REQUIRE_INSNS_FLAGS2(ctx, ISA300);
28+ if (unlikely(!(ctx->insns_flags2 & PPC2_ISA300))) {
29+ return trans_MFFS(ctx, a);
30+ }
31+
32 REQUIRE_FPU(ctx);
33
34 gen_reset_fpstatus();
35@@ -597,7 +600,10 @@ static bool trans_MFFSCRN(DisasContext *
36 {
37 TCGv_i64 t1, fpscr;
38
39- REQUIRE_INSNS_FLAGS2(ctx, ISA300);
40+ if (unlikely(!(ctx->insns_flags2 & PPC2_ISA300))) {
41+ return trans_MFFS(ctx, a);
42+ }
43+
44 REQUIRE_FPU(ctx);
45
46 t1 = tcg_temp_new_i64();
47@@ -631,7 +637,10 @@ static bool trans_MFFSCRNI(DisasContext
48 {
49 TCGv_i64 t1, fpscr;
50
51- REQUIRE_INSNS_FLAGS2(ctx, ISA300);
52+ if (unlikely(!(ctx->insns_flags2 & PPC2_ISA300))) {
53+ return trans_MFFS(ctx, a);
54+ }
55+
56 REQUIRE_FPU(ctx);
57
58 t1 = tcg_temp_new_i64();
59@@ -661,7 +670,10 @@ static bool trans_MFFSCDRNI(DisasContext
60
61 static bool trans_MFFSL(DisasContext *ctx, arg_X_t *a)
62 {
63- REQUIRE_INSNS_FLAGS2(ctx, ISA300);
64+ if (unlikely(!(ctx->insns_flags2 & PPC2_ISA300))) {
65+ return trans_MFFS(ctx, a);
66+ }
67+
68 REQUIRE_FPU(ctx);
69
70 gen_reset_fpstatus();