[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] mini-os: Add suspend stubs for ARM



Costin Lupu, le mer. 19 août 2020 19:41:08 +0300, a ecrit:
> This patch introduces the missing suspend-related stubs for ARM. It also
> introduces the new arch_suspend() function in order to keep the logic in
> kernel_suspend() arch independent.
> 
> Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>

Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

> ---
>  arch/arm/setup.c | 15 +++++++++++++++
>  arch/x86/setup.c |  9 +++++++++
>  include/x86/os.h |  1 +
>  shutdown.c       | 10 +---------
>  4 files changed, 26 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/setup.c b/arch/arm/setup.c
> index b65023c..3d112fa 100644
> --- a/arch/arm/setup.c
> +++ b/arch/arm/setup.c
> @@ -53,6 +53,21 @@ arch_fini(void)
>  {
>  }
>  
> +void arch_pre_suspend(void)
> +{
> +}
> +
> +int arch_suspend(void)
> +{
> +    printk("Suspend not supported on ARM. Aborting.");
> +    do_exit();
> +    return 1;
> +}
> +
> +void arch_post_suspend(int canceled)
> +{
> +}
> +
>  void
>  arch_do_exit(void)
>  {
> diff --git a/arch/x86/setup.c b/arch/x86/setup.c
> index 64b22c5..1ec68d3 100644
> --- a/arch/x86/setup.c
> +++ b/arch/x86/setup.c
> @@ -249,6 +249,15 @@ void arch_pre_suspend(void)
>      arch_mm_pre_suspend();
>  }
>  
> +int arch_suspend(void)
> +{
> +    /*
> +     * This hypercall returns 1 if the suspend
> +     * was cancelled and 0 if resuming in a new domain
> +     */
> +    return HYPERVISOR_suspend(virt_to_mfn(start_info_ptr));
> +}
> +
>  void arch_post_suspend(int canceled)
>  {
>  #if CONFIG_PARAVIRT
> diff --git a/include/x86/os.h b/include/x86/os.h
> index 46a824d..ee34d78 100644
> --- a/include/x86/os.h
> +++ b/include/x86/os.h
> @@ -73,6 +73,7 @@ void xen_callback_vector(void);
>  #endif
>  
>  void arch_pre_suspend(void);
> +int  arch_suspend(void);
>  void arch_post_suspend(int canceled);
>  void arch_fini(void);
>  
> diff --git a/shutdown.c b/shutdown.c
> index 0854670..bb2c6f1 100644
> --- a/shutdown.c
> +++ b/shutdown.c
> @@ -46,8 +46,6 @@
>  #include <mini-os/xmalloc.h>
>  
>  
> -extern start_info_t *start_info_ptr;
> -
>  #ifdef CONFIG_XENBUS
>  static const char *path = "control/shutdown";
>  static const char *token = "control/shutdown";
> @@ -140,13 +138,7 @@ void kernel_suspend(void)
>      pre_suspend();
>      arch_pre_suspend();
>  
> -    /*
> -     * This hypercall returns 1 if the suspend
> -     * was cancelled and 0 if resuming in a new domain
> -     *
> -     * TODO Fix this for ARM
> -     */
> -    rc = HYPERVISOR_suspend(virt_to_mfn(start_info_ptr));
> +    rc = arch_suspend();
>  
>      arch_post_suspend(rc);
>      post_suspend(rc);
> -- 
> 2.20.1
> 

-- 
Samuel
--- christ gives channel operator status to Dieu
 -+- #ens-mim and hell -+-



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.