qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target/arm: Allow to switch from MON->HYP on AArch32
@ 2019-01-09 15:24 Alexander Graf
  2019-01-09 16:10 ` Alex Bennée
  2019-01-09 16:52 ` [Qemu-devel] " Peter Maydell
  0 siblings, 2 replies; 11+ messages in thread
From: Alexander Graf @ 2019-01-09 15:24 UTC (permalink / raw)
  To: qemu-arm; +Cc: qemu-devel, Stephen Warren, Tom Rini, Michal Simek

In U-boot, we switch from S-SVC -> MON -> HYP when we want to enter
HYP mode. This dance seems to work ok (hence it's there in the code
base), but breaks with current QEMU.

The reason seems to be that we try to see whether we are entering
HYP mode from the NS side. However, MON is always considered secure,
so we always fall into an error case when going MON->HYP and never
manage to actually do the switch.

Fix this by not using a different helper function that does not bork
when we're in MON state, as that switch is supposed to work.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target/arm/helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index f00c141ef9..9bf8fbd8f9 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -6297,7 +6297,7 @@ static int bad_mode_switch(CPUARMState *env, int mode, CPSRWriteType write_type)
         return 0;
     case ARM_CPU_MODE_HYP:
         return !arm_feature(env, ARM_FEATURE_EL2)
-            || arm_current_el(env) < 2 || arm_is_secure(env);
+            || arm_current_el(env) < 2 || arm_is_secure_below_el3(env);
     case ARM_CPU_MODE_MON:
         return arm_current_el(env) < 3;
     default:
-- 
2.12.3

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

end of thread, other threads:[~2019-01-17 18:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-09 15:24 [Qemu-devel] [PATCH] target/arm: Allow to switch from MON->HYP on AArch32 Alexander Graf
2019-01-09 16:10 ` Alex Bennée
2019-01-09 16:19   ` Alexander Graf
2019-01-09 16:35   ` [Qemu-devel] [Qemu-arm] " Peter Maydell
2019-01-09 16:52 ` [Qemu-devel] " Peter Maydell
2019-01-09 16:59   ` Peter Maydell
2019-01-09 17:14     ` Alexander Graf
2019-01-09 23:08       ` Peter Maydell
2019-01-10  6:43         ` Alexander Graf
2019-01-10 10:34           ` Peter Maydell
2019-01-17 18:43             ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).