diff mbox

ARM: tegra: add cpu_disable for hotplug

Message ID 1369131215-2920-1-git-send-email-josephl@nvidia.com
State Superseded, archived
Headers show

Commit Message

Joseph Lo May 21, 2013, 10:13 a.m. UTC
The Tegra114 could hotplug the CPU0, but the common cpu_disable didn't
support that. Adding a Tegra specific cpu_disable function for it.

Signed-off-by: Joseph Lo <josephl@nvidia.com>
---
This patch depends on the series of "ARM: tegra114: add CPU hotplug support".
---
 arch/arm/mach-tegra/common.h  |  1 +
 arch/arm/mach-tegra/hotplug.c | 10 ++++++++++
 arch/arm/mach-tegra/platsmp.c |  1 +
 3 files changed, 12 insertions(+)

Comments

Stephen Warren May 21, 2013, 4:15 p.m. UTC | #1
On 05/21/2013 04:13 AM, Joseph Lo wrote:
> The Tegra114 could hotplug the CPU0, but the common cpu_disable didn't
> support that. Adding a Tegra specific cpu_disable function for it.
> 
> Signed-off-by: Joseph Lo <josephl@nvidia.com>

> diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c

> +int tegra_cpu_disable(unsigned int cpu)
> +{
> +	switch (tegra_chip_id) {
> +	case TEGRA114:
> +		return 0;
> +	default:
> +		return cpu == 0 ? -EPERM : 0;
> +	}
> +}

Do we expect all/most future chips to support hotplug of CPU0? Or at
least, fewer chips to have the restriction than not? If so, it might be
more forward-looking to write that as:

if (tegra_chip_id == TEGRA30)
    return cpu == 0 ? -EPERM : 0;

return 0;

?
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Peter De Schrijver May 22, 2013, 9:03 a.m. UTC | #2
On Tue, May 21, 2013 at 06:15:48PM +0200, Stephen Warren wrote:
> On 05/21/2013 04:13 AM, Joseph Lo wrote:
> > The Tegra114 could hotplug the CPU0, but the common cpu_disable didn't
> > support that. Adding a Tegra specific cpu_disable function for it.
> > 
> > Signed-off-by: Joseph Lo <josephl@nvidia.com>
> 
> > diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
> 
> > +int tegra_cpu_disable(unsigned int cpu)
> > +{
> > +	switch (tegra_chip_id) {
> > +	case TEGRA114:
> > +		return 0;
> > +	default:
> > +		return cpu == 0 ? -EPERM : 0;
> > +	}
> > +}
> 
> Do we expect all/most future chips to support hotplug of CPU0? Or at
> least, fewer chips to have the restriction than not? If so, it might be

Yes. I think we can safely assume future chips will support hotplugging CPU0.

> more forward-looking to write that as:
> 
> if (tegra_chip_id == TEGRA30)
>     return cpu == 0 ? -EPERM : 0;
> 

Also Tegra20 doesn't support hotplugging CPU0?

Cheers,

Peter.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Warren May 22, 2013, 9:18 p.m. UTC | #3
On 05/22/2013 03:03 AM, Peter De Schrijver wrote:
> On Tue, May 21, 2013 at 06:15:48PM +0200, Stephen Warren wrote:
>> On 05/21/2013 04:13 AM, Joseph Lo wrote:
>>> The Tegra114 could hotplug the CPU0, but the common cpu_disable didn't
>>> support that. Adding a Tegra specific cpu_disable function for it.
>>>
>>> Signed-off-by: Joseph Lo <josephl@nvidia.com>
>>
>>> diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
>>
>>> +int tegra_cpu_disable(unsigned int cpu)
>>> +{
>>> +	switch (tegra_chip_id) {
>>> +	case TEGRA114:
>>> +		return 0;
>>> +	default:
>>> +		return cpu == 0 ? -EPERM : 0;
>>> +	}
>>> +}
>>
>> Do we expect all/most future chips to support hotplug of CPU0? Or at
>> least, fewer chips to have the restriction than not? If so, it might be
> 
> Yes. I think we can safely assume future chips will support hotplugging CPU0.
> 
>> more forward-looking to write that as:
>>
>> if (tegra_chip_id == TEGRA30)
>>     return cpu == 0 ? -EPERM : 0;
>>
> 
> Also Tegra20 doesn't support hotplugging CPU0?

Oh right, this isn't a Tegra30+ file. How about just inverting the
switch so it doesn't need to change later:

	switch (tegra_chip_id) {
	case TEGRA20:
	case TEGRA30:
		return cpu == 0 ? -EPERM : 0;
	default:
		return 0;
	}

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joseph Lo May 23, 2013, 10:03 a.m. UTC | #4
On Thu, 2013-05-23 at 05:18 +0800, Stephen Warren wrote:
> On 05/22/2013 03:03 AM, Peter De Schrijver wrote:
> > On Tue, May 21, 2013 at 06:15:48PM +0200, Stephen Warren wrote:
> >> On 05/21/2013 04:13 AM, Joseph Lo wrote:
> >>> The Tegra114 could hotplug the CPU0, but the common cpu_disable didn't
> >>> support that. Adding a Tegra specific cpu_disable function for it.
> >>>
> >>> Signed-off-by: Joseph Lo <josephl@nvidia.com>
> >>
> >>> diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
> >>
> >>> +int tegra_cpu_disable(unsigned int cpu)
> >>> +{
> >>> +	switch (tegra_chip_id) {
> >>> +	case TEGRA114:
> >>> +		return 0;
> >>> +	default:
> >>> +		return cpu == 0 ? -EPERM : 0;
> >>> +	}
> >>> +}
> >>
> >> Do we expect all/most future chips to support hotplug of CPU0? Or at
> >> least, fewer chips to have the restriction than not? If so, it might be
> > 
> > Yes. I think we can safely assume future chips will support hotplugging CPU0.
> > 
> >> more forward-looking to write that as:
> >>
> >> if (tegra_chip_id == TEGRA30)
> >>     return cpu == 0 ? -EPERM : 0;
> >>
> > 
> > Also Tegra20 doesn't support hotplugging CPU0?
> 
> Oh right, this isn't a Tegra30+ file. How about just inverting the
> switch so it doesn't need to change later:
> 
> 	switch (tegra_chip_id) {
> 	case TEGRA20:
> 	case TEGRA30:
> 		return cpu == 0 ? -EPERM : 0;
> 	default:
> 		return 0;
> 	}
> 
OK. Will update a newer version later.

Thanks,
Joseph


--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-tegra/common.h b/arch/arm/mach-tegra/common.h
index 5900cc4..32f8eb3 100644
--- a/arch/arm/mach-tegra/common.h
+++ b/arch/arm/mach-tegra/common.h
@@ -2,3 +2,4 @@  extern struct smp_operations tegra_smp_ops;
 
 extern int tegra_cpu_kill(unsigned int cpu);
 extern void tegra_cpu_die(unsigned int cpu);
+extern int tegra_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
index d07f152..9695b63 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -46,6 +46,16 @@  void __ref tegra_cpu_die(unsigned int cpu)
 	BUG();
 }
 
+int tegra_cpu_disable(unsigned int cpu)
+{
+	switch (tegra_chip_id) {
+	case TEGRA114:
+		return 0;
+	default:
+		return cpu == 0 ? -EPERM : 0;
+	}
+}
+
 void __init tegra_hotplug_init(void)
 {
 	if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 554aedc..24db4ac 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -196,5 +196,6 @@  struct smp_operations tegra_smp_ops __initdata = {
 #ifdef CONFIG_HOTPLUG_CPU
 	.cpu_kill		= tegra_cpu_kill,
 	.cpu_die		= tegra_cpu_die,
+	.cpu_disable		= tegra_cpu_disable,
 #endif
 };