Merge ~paelzer/ubuntu/+source/qemu:lp-1981339-s390x-emulation-JAMMY into ubuntu/+source/qemu:ubuntu/jammy-devel

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: 3da73bb6f85f018d5a23b2973e65bca2b89d184a
Proposed branch: ~paelzer/ubuntu/+source/qemu:lp-1981339-s390x-emulation-JAMMY
Merge into: ubuntu/+source/qemu:ubuntu/jammy-devel
Diff against target: 343 lines (+303/-0)
6 files modified
debian/changelog (+6/-0)
debian/patches/series (+4/-0)
debian/patches/ubuntu/lp-1981339-target-s390x-Exit-tb-after-executing-ex_value.patch (+39/-0)
debian/patches/ubuntu/lp-1981339-target-s390x-Remove-DISAS_GOTO_TB.patch (+62/-0)
debian/patches/ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE.patch (+79/-0)
debian/patches/ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE_NOCHAIN.patch (+113/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Andreas Hasenack Approve
Canonical Server Reporter Pending
Review via email: mp+429809@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Taking a look.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Same change as in kinetic
ppa built fine
changelog fine, incorporates the change from current package in jammy-proposed
dep8 tests will be run once it lands in proposed
SRU test case is for the s390x-initiated people ;)

+1

review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: paelzer, ahasenack
Uploaders: paelzer, ahasenack
MP auto-approved

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote (last edit ):

Thanks, uploaded as outlined in both SRU templates

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index e796655..e20390e 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,9 @@
6+qemu (1:6.2+dfsg-2ubuntu6.5) jammy; urgency=medium
7+
8+ * d/p/u/lp-1981339-*: Fix s390x emulation of newer kernels (LP: #1981339)
9+
10+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Tue, 13 Sep 2022 10:23:19 +0200
11+
12 qemu (1:6.2+dfsg-2ubuntu6.4) jammy; urgency=medium
13
14 * Fix ppc64le: fatal: Tried to call a TRAP (LP: #1980896)
15diff --git a/debian/patches/series b/debian/patches/series
16index c42b34b..78ce2d0 100644
17--- a/debian/patches/series
18+++ b/debian/patches/series
19@@ -42,3 +42,7 @@ ubuntu/lp1970737-linux-aio-explain-why-max-batch-is-checked-in-laio_i.patch
20 ubuntu/lp-1980896-0001-linux-user-ppc-Use-force_sig_fault.patch
21 ubuntu/lp-1980896-0002-linux-user-ppc-deliver-SIGTRAP-on-POWERPC_EXCP_TRAP.patch
22 ubuntu/lp-1980896-0003-tests-tcg-ppc64le-change-signal_save_restore_xer-to-.patch
23+ubuntu/lp-1981339-target-s390x-Remove-DISAS_GOTO_TB.patch
24+ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE.patch
25+ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE_NOCHAIN.patch
26+ubuntu/lp-1981339-target-s390x-Exit-tb-after-executing-ex_value.patch
27diff --git a/debian/patches/ubuntu/lp-1981339-target-s390x-Exit-tb-after-executing-ex_value.patch b/debian/patches/ubuntu/lp-1981339-target-s390x-Exit-tb-after-executing-ex_value.patch
28new file mode 100644
29index 0000000..8d3ea8c
30--- /dev/null
31+++ b/debian/patches/ubuntu/lp-1981339-target-s390x-Exit-tb-after-executing-ex_value.patch
32@@ -0,0 +1,39 @@
33+From 3d8111fd3bf7298486bcf1a72013b44c9044104e Mon Sep 17 00:00:00 2001
34+From: Richard Henderson <richard.henderson@linaro.org>
35+Date: Sat, 2 Jul 2022 11:32:28 +0530
36+Subject: [PATCH] target/s390x: Exit tb after executing ex_value
37+
38+When EXECUTE sets ex_value to interrupt the constructed instruction,
39+we implicitly disable interrupts so that the value is not corrupted.
40+Exit to the main loop after execution, so that we re-evaluate any
41+pending interrupts.
42+
43+Reported-by: Sven Schnelle <svens@linux.ibm.com>
44+Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
45+Message-Id: <20220702060228.420454-5-richard.henderson@linaro.org>
46+Signed-off-by: Thomas Huth <thuth@redhat.com>
47+
48+Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=3d8111fd3bf7298486bcf1a72013
49+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1981339
50+Last-Update: 2022-09-13
51+
52+---
53+ target/s390x/tcg/translate.c | 2 +-
54+ 1 file changed, 1 insertion(+), 1 deletion(-)
55+
56+diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
57+index eac59c3dd1..e2ee005671 100644
58+--- a/target/s390x/tcg/translate.c
59++++ b/target/s390x/tcg/translate.c
60+@@ -6593,7 +6593,7 @@ static void s390x_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
61+
62+ dc->cc_op = CC_OP_DYNAMIC;
63+ dc->ex_value = dc->base.tb->cs_base;
64+- dc->exit_to_mainloop = (dc->base.tb->flags & FLAG_MASK_PER);
65++ dc->exit_to_mainloop = (dc->base.tb->flags & FLAG_MASK_PER) || dc->ex_value;
66+ }
67+
68+ static void s390x_tr_tb_start(DisasContextBase *db, CPUState *cs)
69+--
70+2.37.3
71+
72diff --git a/debian/patches/ubuntu/lp-1981339-target-s390x-Remove-DISAS_GOTO_TB.patch b/debian/patches/ubuntu/lp-1981339-target-s390x-Remove-DISAS_GOTO_TB.patch
73new file mode 100644
74index 0000000..150f0f6
75--- /dev/null
76+++ b/debian/patches/ubuntu/lp-1981339-target-s390x-Remove-DISAS_GOTO_TB.patch
77@@ -0,0 +1,62 @@
78+From b67b6c7ce4d56bb76a523eb63feb4a1978b05351 Mon Sep 17 00:00:00 2001
79+From: Richard Henderson <richard.henderson@linaro.org>
80+Date: Sat, 2 Jul 2022 11:32:25 +0530
81+Subject: [PATCH] target/s390x: Remove DISAS_GOTO_TB
82+
83+There is nothing to distinguish this from DISAS_NORETURN.
84+
85+Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
86+Message-Id: <20220702060228.420454-2-richard.henderson@linaro.org>
87+Signed-off-by: Thomas Huth <thuth@redhat.com>
88+
89+Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=b67b6c7ce4d56bb76a523eb63feb
90+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1981339
91+Last-Update: 2022-09-13
92+
93+---
94+ target/s390x/tcg/translate.c | 8 ++------
95+ 1 file changed, 2 insertions(+), 6 deletions(-)
96+
97+diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
98+index fd2433d625..e38ae9ce09 100644
99+--- a/target/s390x/tcg/translate.c
100++++ b/target/s390x/tcg/translate.c
101+@@ -1123,9 +1123,6 @@ typedef struct {
102+ exiting the TB. */
103+ #define DISAS_PC_UPDATED DISAS_TARGET_0
104+
105+-/* We have emitted one or more goto_tb. No fixup required. */
106+-#define DISAS_GOTO_TB DISAS_TARGET_1
107+-
108+ /* We have updated the PC and CC values. */
109+ #define DISAS_PC_CC_UPDATED DISAS_TARGET_2
110+
111+@@ -1189,7 +1186,7 @@ static DisasJumpType help_goto_direct(DisasContext *s, uint64_t dest)
112+ tcg_gen_goto_tb(0);
113+ tcg_gen_movi_i64(psw_addr, dest);
114+ tcg_gen_exit_tb(s->base.tb, 0);
115+- return DISAS_GOTO_TB;
116++ return DISAS_NORETURN;
117+ } else {
118+ tcg_gen_movi_i64(psw_addr, dest);
119+ per_branch(s, false);
120+@@ -1258,7 +1255,7 @@ static DisasJumpType help_branch(DisasContext *s, DisasCompare *c,
121+ tcg_gen_movi_i64(psw_addr, dest);
122+ tcg_gen_exit_tb(s->base.tb, 1);
123+
124+- ret = DISAS_GOTO_TB;
125++ ret = DISAS_NORETURN;
126+ } else {
127+ /* Fallthru can use goto_tb, but taken branch cannot. */
128+ /* Store taken branch destination before the brcond. This
129+@@ -6634,7 +6631,6 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
130+ DisasContext *dc = container_of(dcbase, DisasContext, base);
131+
132+ switch (dc->base.is_jmp) {
133+- case DISAS_GOTO_TB:
134+ case DISAS_NORETURN:
135+ break;
136+ case DISAS_TOO_MANY:
137+--
138+2.37.3
139+
140diff --git a/debian/patches/ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE.patch b/debian/patches/ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE.patch
141new file mode 100644
142index 0000000..be9e61f
143--- /dev/null
144+++ b/debian/patches/ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE.patch
145@@ -0,0 +1,79 @@
146+From 8ec2edac5f32117b523620a216638704d80bbed9 Mon Sep 17 00:00:00 2001
147+From: Richard Henderson <richard.henderson@linaro.org>
148+Date: Sat, 2 Jul 2022 11:32:26 +0530
149+Subject: [PATCH] target/s390x: Remove DISAS_PC_STALE
150+
151+There is nothing to distinguish this from DISAS_TOO_MANY.
152+
153+Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
154+Message-Id: <20220702060228.420454-3-richard.henderson@linaro.org>
155+Signed-off-by: Thomas Huth <thuth@redhat.com>
156+
157+Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=8ec2edac5f32117b523620a21663
158+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1981339
159+Last-Update: 2022-09-13
160+
161+---
162+ target/s390x/tcg/translate.c | 13 ++++---------
163+ 1 file changed, 4 insertions(+), 9 deletions(-)
164+
165+diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
166+index e38ae9ce09..a3422c0eb0 100644
167+--- a/target/s390x/tcg/translate.c
168++++ b/target/s390x/tcg/translate.c
169+@@ -1126,10 +1126,6 @@ typedef struct {
170+ /* We have updated the PC and CC values. */
171+ #define DISAS_PC_CC_UPDATED DISAS_TARGET_2
172+
173+-/* We are exiting the TB, but have neither emitted a goto_tb, nor
174+- updated the PC for the next instruction to be executed. */
175+-#define DISAS_PC_STALE DISAS_TARGET_3
176+-
177+ /* We are exiting the TB to the main loop. */
178+ #define DISAS_PC_STALE_NOCHAIN DISAS_TARGET_4
179+
180+@@ -3993,7 +3989,7 @@ static DisasJumpType op_sacf(DisasContext *s, DisasOps *o)
181+ {
182+ gen_helper_sacf(cpu_env, o->in2);
183+ /* Addressing mode has changed, so end the block. */
184+- return DISAS_PC_STALE;
185++ return DISAS_TOO_MANY;
186+ }
187+ #endif
188+
189+@@ -4029,7 +4025,7 @@ static DisasJumpType op_sam(DisasContext *s, DisasOps *o)
190+ tcg_temp_free_i64(tsam);
191+
192+ /* Always exit the TB, since we (may have) changed execution mode. */
193+- return DISAS_PC_STALE;
194++ return DISAS_TOO_MANY;
195+ }
196+
197+ static DisasJumpType op_sar(DisasContext *s, DisasOps *o)
198+@@ -6562,13 +6558,13 @@ static DisasJumpType translate_one(CPUS390XState *env, DisasContext *s)
199+
200+ /* io should be the last instruction in tb when icount is enabled */
201+ if (unlikely(icount && ret == DISAS_NEXT)) {
202+- ret = DISAS_PC_STALE;
203++ ret = DISAS_TOO_MANY;
204+ }
205+
206+ #ifndef CONFIG_USER_ONLY
207+ if (s->base.tb->flags & FLAG_MASK_PER) {
208+ /* An exception might be triggered, save PSW if not already done. */
209+- if (ret == DISAS_NEXT || ret == DISAS_PC_STALE) {
210++ if (ret == DISAS_NEXT || ret == DISAS_TOO_MANY) {
211+ tcg_gen_movi_i64(psw_addr, s->pc_tmp);
212+ }
213+
214+@@ -6634,7 +6630,6 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
215+ case DISAS_NORETURN:
216+ break;
217+ case DISAS_TOO_MANY:
218+- case DISAS_PC_STALE:
219+ case DISAS_PC_STALE_NOCHAIN:
220+ update_psw_addr(dc);
221+ /* FALLTHRU */
222+--
223+2.37.3
224+
225diff --git a/debian/patches/ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE_NOCHAIN.patch b/debian/patches/ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE_NOCHAIN.patch
226new file mode 100644
227index 0000000..8c73c4d
228--- /dev/null
229+++ b/debian/patches/ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE_NOCHAIN.patch
230@@ -0,0 +1,113 @@
231+From 872e13796f732cfd65c4dc62bd2e4bbdbb4fa848 Mon Sep 17 00:00:00 2001
232+From: Richard Henderson <richard.henderson@linaro.org>
233+Date: Sat, 2 Jul 2022 11:32:27 +0530
234+Subject: [PATCH] target/s390x: Remove DISAS_PC_STALE_NOCHAIN
235+
236+Replace this with a flag: exit_to_mainloop.
237+We can now control the exit for each of DISAS_TOO_MANY,
238+DISAS_PC_UPDATED, and DISAS_PC_CC_UPDATED, and fold in
239+the check for PER.
240+
241+Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
242+Message-Id: <20220702060228.420454-4-richard.henderson@linaro.org>
243+Signed-off-by: Thomas Huth <thuth@redhat.com>
244+
245+Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=872e13796f732cfd65c4dc62bd2e
246+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1981339
247+Last-Update: 2022-09-13
248+
249+---
250+ target/s390x/tcg/translate.c | 21 +++++++++++----------
251+ 1 file changed, 11 insertions(+), 10 deletions(-)
252+
253+diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
254+index a3422c0eb0..eac59c3dd1 100644
255+--- a/target/s390x/tcg/translate.c
256++++ b/target/s390x/tcg/translate.c
257+@@ -149,6 +149,7 @@ struct DisasContext {
258+ uint64_t pc_tmp;
259+ uint32_t ilen;
260+ enum cc_op cc_op;
261++ bool exit_to_mainloop;
262+ };
263+
264+ /* Information carried about a condition to be evaluated. */
265+@@ -1126,9 +1127,6 @@ typedef struct {
266+ /* We have updated the PC and CC values. */
267+ #define DISAS_PC_CC_UPDATED DISAS_TARGET_2
268+
269+-/* We are exiting the TB to the main loop. */
270+-#define DISAS_PC_STALE_NOCHAIN DISAS_TARGET_4
271+-
272+
273+ /* Instruction flags */
274+ #define IF_AFP1 0x0001 /* r1 is a fp reg for HFP/FPS instructions */
275+@@ -3022,7 +3020,8 @@ static DisasJumpType op_lctl(DisasContext *s, DisasOps *o)
276+ tcg_temp_free_i32(r1);
277+ tcg_temp_free_i32(r3);
278+ /* Exit to main loop to reevaluate s390_cpu_exec_interrupt. */
279+- return DISAS_PC_STALE_NOCHAIN;
280++ s->exit_to_mainloop = true;
281++ return DISAS_TOO_MANY;
282+ }
283+
284+ static DisasJumpType op_lctlg(DisasContext *s, DisasOps *o)
285+@@ -3033,7 +3032,8 @@ static DisasJumpType op_lctlg(DisasContext *s, DisasOps *o)
286+ tcg_temp_free_i32(r1);
287+ tcg_temp_free_i32(r3);
288+ /* Exit to main loop to reevaluate s390_cpu_exec_interrupt. */
289+- return DISAS_PC_STALE_NOCHAIN;
290++ s->exit_to_mainloop = true;
291++ return DISAS_TOO_MANY;
292+ }
293+
294+ static DisasJumpType op_lra(DisasContext *s, DisasOps *o)
295+@@ -4283,7 +4283,8 @@ static DisasJumpType op_ssm(DisasContext *s, DisasOps *o)
296+ {
297+ tcg_gen_deposit_i64(psw_mask, psw_mask, o->in2, 56, 8);
298+ /* Exit to main loop to reevaluate s390_cpu_exec_interrupt. */
299+- return DISAS_PC_STALE_NOCHAIN;
300++ s->exit_to_mainloop = true;
301++ return DISAS_TOO_MANY;
302+ }
303+
304+ static DisasJumpType op_stap(DisasContext *s, DisasOps *o)
305+@@ -4548,7 +4549,8 @@ static DisasJumpType op_stnosm(DisasContext *s, DisasOps *o)
306+ }
307+
308+ /* Exit to main loop to reevaluate s390_cpu_exec_interrupt. */
309+- return DISAS_PC_STALE_NOCHAIN;
310++ s->exit_to_mainloop = true;
311++ return DISAS_TOO_MANY;
312+ }
313+
314+ static DisasJumpType op_stura(DisasContext *s, DisasOps *o)
315+@@ -6591,6 +6593,7 @@ static void s390x_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
316+
317+ dc->cc_op = CC_OP_DYNAMIC;
318+ dc->ex_value = dc->base.tb->cs_base;
319++ dc->exit_to_mainloop = (dc->base.tb->flags & FLAG_MASK_PER);
320+ }
321+
322+ static void s390x_tr_tb_start(DisasContextBase *db, CPUState *cs)
323+@@ -6630,7 +6633,6 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
324+ case DISAS_NORETURN:
325+ break;
326+ case DISAS_TOO_MANY:
327+- case DISAS_PC_STALE_NOCHAIN:
328+ update_psw_addr(dc);
329+ /* FALLTHRU */
330+ case DISAS_PC_UPDATED:
331+@@ -6640,8 +6642,7 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
332+ /* FALLTHRU */
333+ case DISAS_PC_CC_UPDATED:
334+ /* Exit the TB, either by raising a debug exception or by return. */
335+- if ((dc->base.tb->flags & FLAG_MASK_PER) ||
336+- dc->base.is_jmp == DISAS_PC_STALE_NOCHAIN) {
337++ if (dc->exit_to_mainloop) {
338+ tcg_gen_exit_tb(NULL, 0);
339+ } else {
340+ tcg_gen_lookup_and_goto_ptr();
341+--
342+2.37.3
343+

Subscribers

People subscribed via source and target branches