All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: julien.grall@linaro.org, xen-devel@lists.xen.org,
	ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH 3/4] xen/arm: Add PSCI system_off and system_reset support
Date: Wed, 1 Oct 2014 11:07:03 +0100	[thread overview]
Message-ID: <alpine.DEB.2.02.1410011101570.17038@kaball.uk.xensource.com> (raw)
In-Reply-To: <1412150877-4090-4-git-send-email-suravee.suthikulpanit@amd.com>

On Wed, 1 Oct 2014, suravee.suthikulpanit@amd.com wrote:
> From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> 
> This patch adds SMC calls to suport PSCI-0.2 system_off and system_reset,
> It also adds a call to platform_power_off in machine_halt(). This would
> allow platform, which implements PSCI-0.2 to properly handle system off
> and reset.
> 
> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> ---
>  xen/arch/arm/psci.c        | 10 ++++++++++
>  xen/arch/arm/shutdown.c    | 16 ++++++++++------
>  xen/include/asm-arm/psci.h |  2 ++
>  3 files changed, 22 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c
> index b6360d5..b0d94a8 100644
> --- a/xen/arch/arm/psci.c
> +++ b/xen/arch/arm/psci.c
> @@ -58,6 +58,16 @@ int call_psci_cpu_on(int cpu)
>                                  cpu_logical_map(cpu), __pa(init_secondary), 0);
>  }
>  
> +void call_psci_system_off(void)
> +{
> +    __invoke_psci_fn_smc(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
> +}
> +
> +void call_psci_system_reset(void)
> +{
> +    __invoke_psci_fn_smc(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
> +}

This assumes PSCI 0.2 but actually the cpu_on function is still reading
the id from device tree.
Could you please change that too for uniformity?


>  int __init psci_init(void)
>  {
>      const struct dt_device_node *psci;
> diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c
> index adc0529..2f63674 100644
> --- a/xen/arch/arm/shutdown.c
> +++ b/xen/arch/arm/shutdown.c
> @@ -6,11 +6,6 @@
>  #include <xen/smp.h>
>  #include <asm/platform.h>
>  
> -static void raw_machine_reset(void)
> -{
> -    platform_reset();
> -}

Please mention this change in the commit message.


>  static void noreturn halt_this_cpu(void *arg)
>  {
>      stop_cpu();
> @@ -18,10 +13,19 @@ static void noreturn halt_this_cpu(void *arg)
>  
>  void machine_halt(void)
>  {
> +    int timeout = 10;
> +
>      watchdog_disable();
>      console_start_sync();
>      local_irq_enable();
>      smp_call_function(halt_this_cpu, NULL, 0);
> +    local_irq_disable();
> +
> +    /* Wait at most another 10ms for all other CPUs to go offline. */
> +    while ( (num_online_cpus() > 1) && (timeout-- > 0) )
> +        mdelay(1);
> +
> +    platform_poweroff();
>      halt_this_cpu(NULL);
>  }
>  
> @@ -41,7 +45,7 @@ void machine_restart(unsigned int delay_millisecs)
>  
>      while ( 1 )
>      {
> -        raw_machine_reset();
> +        platform_reset();
>          mdelay(100);
>      }
>  }
> diff --git a/xen/include/asm-arm/psci.h b/xen/include/asm-arm/psci.h
> index 9777c03..de00ee2 100644
> --- a/xen/include/asm-arm/psci.h
> +++ b/xen/include/asm-arm/psci.h
> @@ -17,6 +17,8 @@ extern bool_t psci_available;
>  
>  int psci_init(void);
>  int call_psci_cpu_on(int cpu);
> +void call_psci_system_off(void);
> +void call_psci_system_reset(void);
>  
>  /* functions to handle guest PSCI requests */
>  int32_t do_psci_cpu_on(uint32_t vcpuid, register_t entry_point);
> -- 
> 1.9.3
> 

  reply	other threads:[~2014-10-01 10:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-01  8:07 [PATCH 0/4] Introduce AMD Seattle platform support suravee.suthikulpanit
2014-10-01  8:07 ` [PATCH 1/4] gicv2: Add compatibility id for gic-400 suravee.suthikulpanit
2014-10-01  9:54   ` Stefano Stabellini
2014-10-01 14:41   ` Julien Grall
2014-10-01  8:07 ` [PATCH 2/4] amd/seattle: Add early printk message for the platform suravee.suthikulpanit
2014-10-01  9:55   ` Stefano Stabellini
2014-10-01 14:43   ` Julien Grall
2014-10-01  8:07 ` [PATCH 3/4] xen/arm: Add PSCI system_off and system_reset support suravee.suthikulpanit
2014-10-01 10:07   ` Stefano Stabellini [this message]
2014-10-01 10:26     ` Ian Campbell
2014-10-01 14:15       ` Suravee Suthikulpanit
2014-10-01 14:46         ` Ian Campbell
2014-10-01 17:58           ` Suravee Suthikulanit
2014-10-02  8:28             ` Ian Campbell
2014-10-01 14:04     ` Ian Campbell
2014-10-01  8:07 ` [PATCH 4/4] amd/seattle: Initial revision of AMD Seattle support suravee.suthikulpanit
2014-10-01 10:10   ` Stefano Stabellini
2014-10-01 19:21     ` Suravee Suthikulanit
2014-10-02  9:10       ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1410011101570.17038@kaball.uk.xensource.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.