[PATCH 17/17] board: xen: De-initialize before jumping to Linux

Anastasiia Lukianenko vicooodin at gmail.com
Wed Jul 1 18:29:59 CEST 2020


From: Oleksandr Andrushchenko <oleksandr_andrushchenko at epam.com>

Free resources used by Xen board before jumping to Linux kernel.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko at epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko at epam.com>
---
 board/xen/xenguest_arm64/xenguest_arm64.c | 6 ++++++
 drivers/xen/hypervisor.c                  | 8 ++++++++
 include/xen.h                             | 1 +
 3 files changed, 15 insertions(+)

diff --git a/board/xen/xenguest_arm64/xenguest_arm64.c b/board/xen/xenguest_arm64/xenguest_arm64.c
index b4e1650f99..76a18bea8b 100644
--- a/board/xen/xenguest_arm64/xenguest_arm64.c
+++ b/board/xen/xenguest_arm64/xenguest_arm64.c
@@ -13,6 +13,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <malloc.h>
+#include <xen.h>
 
 #include <asm/io.h>
 #include <asm/armv8/mmu.h>
@@ -195,3 +196,8 @@ int print_cpuinfo(void)
 	return 0;
 }
 
+void board_cleanup_before_linux(void)
+{
+	xen_fini();
+}
+
diff --git a/drivers/xen/hypervisor.c b/drivers/xen/hypervisor.c
index f3c2504d72..8d7d320839 100644
--- a/drivers/xen/hypervisor.c
+++ b/drivers/xen/hypervisor.c
@@ -279,3 +279,11 @@ void xen_init(void)
 	init_gnttab();
 }
 
+void xen_fini(void)
+{
+	debug("%s\n", __func__);
+
+	fini_gnttab();
+	fini_xenbus();
+	fini_events();
+}
diff --git a/include/xen.h b/include/xen.h
index 1d6f74cc92..327d7e132b 100644
--- a/include/xen.h
+++ b/include/xen.h
@@ -7,5 +7,6 @@
 #define __XEN_H__
 
 void xen_init(void);
+void xen_fini(void);
 
 #endif /* __XEN_H__ */
-- 
2.17.1



More information about the U-Boot mailing list