All of lore.kernel.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] keystone: psci: adds cpu_die implementation
Date: Thu, 25 Jun 2015 15:45:11 +0100	[thread overview]
Message-ID: <20150625144511.GA6844@leverpostej> (raw)
In-Reply-To: <1435240970-30869-1-git-send-email-vitalya@ti.com>

Hi,

On Thu, Jun 25, 2015 at 03:02:50PM +0100, Vitaly Andrianov wrote:
> This commit add cpu_die implementation using psci api

I don't understand. If you have a PSCI implementation, it should be
sufficient to have a PSCI node (and enable-method) in your DT, and the
generic code will be used. Nothing should be required in your board
code.

You should also use CPU_ON to bring secondaries online rather than
mixing up PSCI and platform-specific mechanisms.

> 
> Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
> ---
>  arch/arm/mach-keystone/platsmp.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/arch/arm/mach-keystone/platsmp.c b/arch/arm/mach-keystone/platsmp.c
> index 5f46a7c..2c40cc0 100644
> --- a/arch/arm/mach-keystone/platsmp.c
> +++ b/arch/arm/mach-keystone/platsmp.c
> @@ -20,6 +20,7 @@
>  #include <asm/prom.h>
>  #include <asm/tlbflush.h>
>  #include <asm/pgtable.h>
> +#include <asm/psci.h>
>  
>  #include "keystone.h"
>  
> @@ -51,7 +52,38 @@ static inline void __cpuinit keystone_smp_secondary_initmem(unsigned int cpu)
>  {}
>  #endif
>  
> +
> +#ifdef CONFIG_HOTPLUG_CPU
> +static void keystone_cpu_die(unsigned int cpu)
> +{
> +#ifdef CONFIG_ARM_PSCI
> +	struct psci_power_state pwr_state = {0, 0, 0};
> +
> +	pr_info("keystone_cpu_die(%d) from %d using PSCI\n", cpu,
> +	       smp_processor_id());
> +
> +	if (psci_ops.cpu_off)
> +		psci_ops.cpu_off(pwr_state);
> +#else
> +	/*
> +	 * We may want to add here a direct smc call to monitor
> +	 * if the kernel doesn't support PSCI API
> +	 */
> +#endif

You should determine this from your DT. Your FW/bootloader can patch in
the relevant nodes and properties when support is present, so the
presence of such nodes should guarantee that PSCI is available.

> +
> +	/*
> +	 * we shouldn't come here. But in case something went
> +	 * wrong the code below prevents kernel from crush
> +	 */
> +	while (1)
> +		cpu_do_idle();

This will make kexec appear to work, yet it won't. 

Thanks,
Mark.

> +}
> +#endif
> +
>  struct smp_operations keystone_smp_ops __initdata = {
>  	.smp_boot_secondary	= keystone_smp_boot_secondary,
>  	.smp_secondary_init     = keystone_smp_secondary_initmem,
> +#ifdef CONFIG_HOTPLUG_CPU
> +	.cpu_die		= keystone_cpu_die,
> +#endif
>  };
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com>
To: Vitaly Andrianov <vitalya@ti.com>
Cc: "ssantosh@kernel.org" <ssantosh@kernel.org>,
	"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	lorenzo.pieralisi@arm.com
Subject: Re: [PATCH] keystone: psci: adds cpu_die implementation
Date: Thu, 25 Jun 2015 15:45:11 +0100	[thread overview]
Message-ID: <20150625144511.GA6844@leverpostej> (raw)
In-Reply-To: <1435240970-30869-1-git-send-email-vitalya@ti.com>

Hi,

On Thu, Jun 25, 2015 at 03:02:50PM +0100, Vitaly Andrianov wrote:
> This commit add cpu_die implementation using psci api

I don't understand. If you have a PSCI implementation, it should be
sufficient to have a PSCI node (and enable-method) in your DT, and the
generic code will be used. Nothing should be required in your board
code.

You should also use CPU_ON to bring secondaries online rather than
mixing up PSCI and platform-specific mechanisms.

> 
> Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
> ---
>  arch/arm/mach-keystone/platsmp.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/arch/arm/mach-keystone/platsmp.c b/arch/arm/mach-keystone/platsmp.c
> index 5f46a7c..2c40cc0 100644
> --- a/arch/arm/mach-keystone/platsmp.c
> +++ b/arch/arm/mach-keystone/platsmp.c
> @@ -20,6 +20,7 @@
>  #include <asm/prom.h>
>  #include <asm/tlbflush.h>
>  #include <asm/pgtable.h>
> +#include <asm/psci.h>
>  
>  #include "keystone.h"
>  
> @@ -51,7 +52,38 @@ static inline void __cpuinit keystone_smp_secondary_initmem(unsigned int cpu)
>  {}
>  #endif
>  
> +
> +#ifdef CONFIG_HOTPLUG_CPU
> +static void keystone_cpu_die(unsigned int cpu)
> +{
> +#ifdef CONFIG_ARM_PSCI
> +	struct psci_power_state pwr_state = {0, 0, 0};
> +
> +	pr_info("keystone_cpu_die(%d) from %d using PSCI\n", cpu,
> +	       smp_processor_id());
> +
> +	if (psci_ops.cpu_off)
> +		psci_ops.cpu_off(pwr_state);
> +#else
> +	/*
> +	 * We may want to add here a direct smc call to monitor
> +	 * if the kernel doesn't support PSCI API
> +	 */
> +#endif

You should determine this from your DT. Your FW/bootloader can patch in
the relevant nodes and properties when support is present, so the
presence of such nodes should guarantee that PSCI is available.

> +
> +	/*
> +	 * we shouldn't come here. But in case something went
> +	 * wrong the code below prevents kernel from crush
> +	 */
> +	while (1)
> +		cpu_do_idle();

This will make kexec appear to work, yet it won't. 

Thanks,
Mark.

> +}
> +#endif
> +
>  struct smp_operations keystone_smp_ops __initdata = {
>  	.smp_boot_secondary	= keystone_smp_boot_secondary,
>  	.smp_secondary_init     = keystone_smp_secondary_initmem,
> +#ifdef CONFIG_HOTPLUG_CPU
> +	.cpu_die		= keystone_cpu_die,
> +#endif
>  };
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

  reply	other threads:[~2015-06-25 14:45 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 14:02 [PATCH] keystone: psci: adds cpu_die implementation Vitaly Andrianov
2015-06-25 14:02 ` Vitaly Andrianov
2015-06-25 14:45 ` Mark Rutland [this message]
2015-06-25 14:45   ` Mark Rutland
2015-06-25 14:59   ` santosh shilimkar
2015-06-25 14:59     ` santosh shilimkar
2015-06-25 16:01     ` Vitaly Andrianov
2015-06-25 16:01       ` Vitaly Andrianov
2015-06-25 16:13       ` Mark Rutland
2015-06-25 16:13         ` Mark Rutland
2015-06-25 16:55         ` Vitaly Andrianov
2015-06-25 16:55           ` Vitaly Andrianov
2015-06-25 16:57           ` Mark Rutland
2015-06-25 16:57             ` Mark Rutland
2015-06-25 17:20             ` Mark Rutland
2015-06-25 17:20               ` Mark Rutland
2015-06-25 18:42               ` santosh shilimkar
2015-06-25 18:42                 ` santosh shilimkar
2015-06-26 16:57                 ` Vitaly Andrianov
2015-06-26 16:57                   ` Vitaly Andrianov
2015-06-26 16:59                   ` Mark Rutland
2015-06-26 16:59                     ` Mark Rutland
2015-06-26 17:47                   ` Grygorii Strashko
2015-06-26 17:47                     ` Grygorii Strashko
2015-06-26 18:06                     ` Vitaly Andrianov
2015-06-26 18:06                       ` Vitaly Andrianov
2015-06-26 18:41                     ` santosh shilimkar
2015-06-26 18:41                       ` santosh shilimkar
2015-06-25 14:54 ` santosh shilimkar
2015-06-25 14:54   ` santosh shilimkar

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=20150625144511.GA6844@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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.