[PATCH 2/2] xen: Limit execution to EL1 only

Michal Simek michal.simek at amd.com
Tue Apr 11 13:23:07 CEST 2023


Xen core_init() is calling HVC which should be called from EL1 level that's
why do Xen initialization only when U-Boot runs in EL1.

Signed-off-by: Michal Simek <michal.simek at amd.com>
---

 drivers/xen/hypervisor.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/xen/hypervisor.c b/drivers/xen/hypervisor.c
index 16c7c96c94e0..0b2311ba2675 100644
--- a/drivers/xen/hypervisor.c
+++ b/drivers/xen/hypervisor.c
@@ -264,8 +264,15 @@ void clear_evtchn(uint32_t port)
 
 int xen_init(void)
 {
+	int el = current_el();
+
 	debug("%s\n", __func__);
 
+	if (el != 1) {
+		puts("XEN:\tnot running from EL1\n");
+		return 0;
+	}
+
 	map_shared_info(NULL);
 	init_events();
 	init_xenbus();
-- 
2.36.1



More information about the U-Boot mailing list