Skip to content

Commit de00f18

Browse files
stephanosiogalak
authored andcommitted
xilinx_qemu: Fix WFI instruction for icount mode
The Xilinx QEMU deliberately breaks the WFI (wake up from interrupt) instruction when icount mode is used, possibly for performance and cosimulation stability reasons, and this causes the Zephyr CI tests, that expect the WFI instruction to function properly, to fail. This commit adds a patch to enable the CPU halt behaviour of the WFI instruction in the icount mode, since accurate simulation behaviour takes precedence over performance for CI testing, and the Zephyr will not use the cosimulation feature. Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent 9c24353 commit de00f18

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

meta-zephyr-sdk/recipes-devtools/xilinx_qemu/files/0001-Revert-target-arm-Revert-back-to-YIELD-for-WFI.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 4bde2c46a979ba1539c05ffa6d4fc22ab6a2a9c2 Mon Sep 17 00:00:00 2001
1+
From ef1724e0a558a0f6bc93530114173955bf67cf30 Mon Sep 17 00:00:00 2001
22
From: Stephanos Ioannidis <[email protected]>
33
Date: Wed, 8 Jan 2020 17:47:05 +0900
4-
Subject: [PATCH] Revert "target/arm: Revert back to YIELD for WFI"
4+
Subject: [PATCH 1/2] Revert "target/arm: Revert back to YIELD for WFI"
55

66
This reverts commit 5f38ea92fb697b94ad43f01fe162f3ed6e6b0e16.
77

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From 6d7ce4d6e5ab8d4222bb41b4e09e3437d534481a Mon Sep 17 00:00:00 2001
2+
From: Stephanos Ioannidis <[email protected]>
3+
Date: Wed, 26 Feb 2020 12:30:55 +0900
4+
Subject: [PATCH 2/2] Enable WFI CPU halting in icount mode
5+
6+
This commit enables CPU halting via the WFI instruction in the
7+
icount mode.
8+
9+
The PetaLinux patch initially disabled WFI CPU halting, possibly for
10+
performance reasons.
11+
12+
Signed-off-by: Stephanos Ioannidis <[email protected]>
13+
---
14+
target/arm/op_helper.c | 9 +++------
15+
1 file changed, 3 insertions(+), 6 deletions(-)
16+
17+
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
18+
index 6ab3a75a76..1199288fdd 100644
19+
--- a/target/arm/op_helper.c
20+
+++ b/target/arm/op_helper.c
21+
@@ -304,12 +304,9 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len)
22+
}
23+
24+
qemu_mutex_lock_iothread();
25+
- if (use_icount) {
26+
- cs->exception_index = EXCP_YIELD;
27+
- } else {
28+
- cs->halted = 1;
29+
- cs->exception_index = EXCP_HLT;
30+
- }
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.17.1
39+

meta-zephyr-sdk/recipes-devtools/xilinx_qemu/xilinx-qemu_git.bb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
88
SRCREV = "293badb9e42930393d2246cbc4d0eb78409243ba"
99
SRC_URI = "git://github.com/Xilinx/qemu.git;protocol=https \
1010
file://0001-Revert-target-arm-Revert-back-to-YIELD-for-WFI.patch \
11+
file://0002-Enable-WFI-CPU-halting-in-icount-mode.patch \
1112
"
1213

1314
BBCLASSEXTEND = "native nativesdk"

0 commit comments

Comments
 (0)