Skip to contentSkip to conversation

ARM: tegra: add cpu_disable for hotplug

PATCH New Joseph Lo 3 participants 5 messages May 21, 2013 – May 23, 2013

Subsystems (3)
lore
Share & tools
lore

Joseph Lo

author
#0 lore raw

PATCH 1/1 ARM: tegra: add cpu_disable for hotplug

The Tegra114 could hotplug the CPU0, but the common cpu_disable didn't support that. Adding a Tegra specific cpu_disable function for it.

---
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(+)
arch/arm/mach-tegra/common.h +1 -0
index 5900cc4..32f8eb3 100644
@@ -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);
arch/arm/mach-tegra/hotplug.c +10 -0
index d07f152..9695b63 100644
@@ -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))
arch/arm/mach-tegra/platsmp.c +1 -0
index 554aedc..24db4ac 100644
@@ -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
 };
Signature · 1 line
1.8.2.2
#1 lore raw

PATCH 1/1 ARM: tegra: add cpu_disable for hotplug

Quoted 6 lines · Joseph Lo

The Tegra114 could hotplug the CPU0, but the common cpu_disable didn't support that. Adding a Tegra specific cpu_disable function for it.

arch/arm/mach-tegra/hotplug.c void __ref tegra_cpu_die(unsigned int cpu) · line 57

Quoted 10 lines
arch/arm/mach-tegra/hotplug.c +9 -0
 
+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;

?

#2 lore raw

PATCH 1/1 ARM: tegra: add cpu_disable for hotplug

Quoted 8 lines · Stephen Warren
Quoted 6 lines · Joseph Lo

The Tegra114 could hotplug the CPU0, but the common cpu_disable didn't support that. Adding a Tegra specific cpu_disable function for it.

arch/arm/mach-tegra/hotplug.c +0 -0
Quoted 12 lines

arch/arm/mach-tegra/hotplug.c void __ref tegra_cpu_die(unsigned int cpu) · line 57

Quoted 9 lines
arch/arm/mach-tegra/hotplug.c +9 -0
+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.

Quoted 5 lines

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.

#3 lore raw

PATCH 1/1 ARM: tegra: add cpu_disable for hotplug

Quoted 24 lines · Peter De Schrijver
Quoted 8 lines · Stephen Warren
Quoted 6 lines · Joseph Lo

The Tegra114 could hotplug the CPU0, but the common cpu_disable didn't support that. Adding a Tegra specific cpu_disable function for it.

arch/arm/mach-tegra/hotplug.c +0 -0
Quoted 12 lines

arch/arm/mach-tegra/hotplug.c void __ref tegra_cpu_die(unsigned int cpu) · line 57

Quoted 9 lines
arch/arm/mach-tegra/hotplug.c +9 -0
+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.

Quoted 7 lines
Quoted 5 lines

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;
	}
author
#4 lore raw

PATCH 1/1 ARM: tegra: add cpu_disable for hotplug

Quoted 36 lines · Stephen Warren
Quoted 24 lines · Peter De Schrijver
Quoted 8 lines · Stephen Warren
Quoted 6 lines · Joseph Lo

The Tegra114 could hotplug the CPU0, but the common cpu_disable didn't support that. Adding a Tegra specific cpu_disable function for it.

arch/arm/mach-tegra/hotplug.c +0 -0
Quoted 12 lines

arch/arm/mach-tegra/hotplug.c void __ref tegra_cpu_die(unsigned int cpu) · line 57

Quoted 9 lines
arch/arm/mach-tegra/hotplug.c +9 -0
+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.

Quoted 7 lines
Quoted 5 lines

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:

Quoted 8 lines
	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