Skip to content

Commit 116f43d

Browse files
michalsimeknashif
authored andcommitted
meta-zephyr-sdk: xilinx_qemu: Fix qemu WFI behavior
As has been described by Stephanos in the commit message tests/kernel/context is broken when these two patches are not applied that's why get them back to have clean CI loop. Issue can be replicated by running west twister -v -p qemu_cortex_r5 -O /tmp/twister -T tests/kernel/context/ Signed-off-by: Michal Simek <michal.simek@amd.com>
1 parent fce61c3 commit 116f43d

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
From ab42d46c10d4e24cd19fb3339fc2738ba7b4a45e Mon Sep 17 00:00:00 2001
2+
Message-ID: <ab42d46c10d4e24cd19fb3339fc2738ba7b4a45e.1747662482.git.michal.simek@amd.com>
3+
From: Stephanos Ioannidis <root@stephanos.io>
4+
Date: Wed, 8 Jan 2020 17:47:05 +0900
5+
Subject: [PATCH] Revert "target/arm: Revert back to YIELD for WFI"
6+
7+
This reverts commit 5f38ea92fb697b94ad43f01fe162f3ed6e6b0e16.
8+
9+
The commit 5f38ea92fb697b94ad43f01fe162f3ed6e6b0e16 was probably
10+
introduced in order to improve emulation performance, as well as to
11+
address the stability issue when running co-simulations (refer to the
12+
commit 708639f72be2a9425992ae9dc4b9a098dc804c94).
13+
14+
This, unfortunately, breaks the WFI instruction; i.e. CPU is not halted
15+
and keeps running regardless of whether an interrupt occurs, and this
16+
is a problem for the Zephyr CI tests that expect the WFI instruction to
17+
do its job (in particular, tests/kernel/context is broken because of
18+
this change).
19+
20+
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
21+
---
22+
target/arm/tcg/op_helper.c | 2 +-
23+
1 file changed, 1 insertion(+), 1 deletion(-)
24+
25+
diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c
26+
index 1e9ff35f0c30..67add5c6973c 100644
27+
--- a/target/arm/tcg/op_helper.c
28+
+++ b/target/arm/tcg/op_helper.c
29+
@@ -353,7 +353,7 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len)
30+
}
31+
32+
qemu_mutex_lock_iothread();
33+
- if (use_icount || 1) {
34+
+ if (use_icount) {
35+
cs->exception_index = EXCP_YIELD;
36+
} else {
37+
cs->halted = 1;
38+
--
39+
2.43.0
40+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From 393c4e5f40fb4592b3cf8247feee73538f541437 Mon Sep 17 00:00:00 2001
2+
Message-ID: <393c4e5f40fb4592b3cf8247feee73538f541437.1747662482.git.michal.simek@amd.com>
3+
From: Stephanos Ioannidis <root@stephanos.io>
4+
Date: Wed, 26 Feb 2020 12:30:55 +0900
5+
Subject: [PATCH] Enable WFI CPU halting in icount mode
6+
7+
This commit enables CPU halting via the WFI instruction in the
8+
icount mode.
9+
10+
The PetaLinux patch initially disabled WFI CPU halting, possibly for
11+
performance reasons.
12+
13+
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
14+
---
15+
target/arm/tcg/op_helper.c | 8 ++------
16+
1 file changed, 2 insertions(+), 6 deletions(-)
17+
18+
diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c
19+
index 67add5c6973c..f76c6eb5484e 100644
20+
--- a/target/arm/tcg/op_helper.c
21+
+++ b/target/arm/tcg/op_helper.c
22+
@@ -353,12 +353,8 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len)
23+
}
24+
25+
qemu_mutex_lock_iothread();
26+
- if (use_icount) {
27+
- cs->exception_index = EXCP_YIELD;
28+
- } else {
29+
- cs->halted = 1;
30+
- cs->exception_index = EXCP_HLT;
31+
- }
32+
+ cs->halted = 1;
33+
+ cs->exception_index = EXCP_HLT;
34+
35+
/* Drive STANDBYWFI only if cpu reset-pin is inactive */
36+
if (cs->reset_pin == false) {
37+
--
38+
2.43.0
39+

meta-zephyr-sdk/recipes-devtools/qemu_xilinx/qemu-xilinx_git.bb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ SRCREV_FORMAT = "qemu"
1212
SRC_URI += "gitsm://github.com/Xilinx/qemu.git;protocol=https;nobranch=1;name=qemu \
1313
file://cross.patch \
1414
file://0004-configure-Add-pkg-config-handling-for-libgcrypt.patch \
15+
file://0001-Revert-target-arm-Revert-back-to-YIELD-for-WFI.patch \
16+
file://0002-Enable-WFI-CPU-halting-in-icount-mode.patch \
1517
file://0008-tests-meson.build-use-relative-path-to-refer-to-file.patch \
1618
file://fixedmeson.patch \
1719
file://no-pip.patch \

0 commit comments

Comments
 (0)