From: Alexandru Elisei At EL2, hvc would target the current EL, use smc so that it targets EL3. Signed-off-by: Alexandru Elisei Signed-off-by: Joey Gouly --- arm/micro-bench.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/arm/micro-bench.c b/arm/micro-bench.c index f47c5fc1..32029c5a 100644 --- a/arm/micro-bench.c +++ b/arm/micro-bench.c @@ -282,6 +282,11 @@ static bool mmio_read_user_prep(void) return true; } +static void smc_exec(void) +{ + asm volatile("mov w0, #0x4b000000; smc #0" ::: "w0"); +} + static void mmio_read_user_exec(void) { readl(userspace_emulated_addr); @@ -300,6 +305,8 @@ static void eoi_exec(void) write_eoir(spurious_id); } +static bool exec_select(void); + struct exit_test { const char *name; bool (*prep)(void); @@ -310,7 +317,7 @@ struct exit_test { }; static struct exit_test tests[] = { - {"hvc", NULL, hvc_exec, NULL, 65536, true}, + {"hyp_call", exec_select, hvc_exec, NULL, 65536, true}, {"mmio_read_user", mmio_read_user_prep, mmio_read_user_exec, NULL, 65536, true}, {"mmio_read_vgic", NULL, mmio_read_vgic_exec, NULL, 65536, true}, {"eoi", NULL, eoi_exec, NULL, 65536, true}, @@ -320,6 +327,15 @@ static struct exit_test tests[] = { {"timer_10ms", timer_prep, timer_exec, timer_post, 256, true}, }; +static bool exec_select(void) +{ + if (current_level() == CurrentEL_EL2) + tests[0].exec = &smc_exec; + else + tests[0].exec = &hvc_exec; + return true; +} + struct ns_time { uint64_t ns; uint64_t ns_frac; -- 2.25.1