From patchwork Wed Jul 1 16:29:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nastya Vicodin X-Patchwork-Id: 240635 List-Id: U-Boot discussion From: vicooodin at gmail.com (Anastasiia Lukianenko) Date: Wed, 1 Jul 2020 19:29:59 +0300 Subject: [PATCH 17/17] board: xen: De-initialize before jumping to Linux In-Reply-To: <20200701162959.9814-1-vicooodin@gmail.com> References: <20200701162959.9814-1-vicooodin@gmail.com> Message-ID: <20200701162959.9814-18-vicooodin@gmail.com> From: Oleksandr Andrushchenko Free resources used by Xen board before jumping to Linux kernel. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Anastasiia Lukianenko Reviewed-by: Simon Glass --- 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 #include #include +#include #include #include @@ -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__ */