diff mbox series

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

Message ID 20200701162959.9814-18-vicooodin@gmail.com
State New
Headers show
Series Add new board: Xen guest for ARM64 | expand

Commit Message

Nastya Vicodin July 1, 2020, 4:29 p.m. UTC
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(+)

Comments

Simon Glass July 3, 2020, 3:50 a.m. UTC | #1
On Wed, 1 Jul 2020 at 10:30, Anastasiia Lukianenko <vicooodin at gmail.com> wrote:
>
> 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(+)

Reviewed-by: Simon Glass <sjg at chromium.org>



>
> 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);

Comment? What does this do?


>
>  #endif /* __XEN_H__ */
> --
> 2.17.1
>

- SImon
Anastasiia Lukianenko July 6, 2020, 9:13 a.m. UTC | #2
On Thu, 2020-07-02 at 21:50 -0600, Simon Glass wrote:
> On Wed, 1 Jul 2020 at 10:30, Anastasiia Lukianenko <
> vicooodin at gmail.com> wrote:
> > 
> > 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(+)
> 
> Reviewed-by: Simon Glass <sjg at chromium.org>
> 
> 
> 
> > 
> > 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);
> 
> Comment? What does this do?
> 
Ok, will add.
> 
> > 
> >  #endif /* __XEN_H__ */
> > --
> > 2.17.1
> > 
> 
> - SImon

Regards,
Anastasiia
diff mbox series

Patch

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__ */