* [PATCH v6 00/15] Per SoC descriptor
@ 2012-02-08 0:30 Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 01/15] ARM: SoC: Introduce per " Marc Zyngier
` (15 more replies)
0 siblings, 16 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
This patch series introduces a per-soc descriptor which should, in the
end, contain most of the SoC specific operations.
This first patch series introduces the arm_soc_desc structure, adds
per-soc SMP and CPU hotplug operations, and converts all SMP platform
to this new scheme.
The last three patches consolidate some of the most commonly duplicated
hotplug code and move it to a common location.
Patches against v3.3-rc2. Tested on VExpress (A5 and A15), RealView EB-11MP,
OMAP4 (Panda) and Tegra2 (Harmony).
Changelog:
>From v5:
- Added support for highbank and imx6q
- Added support for new shmobile SMP platform
- Add dummy_cpu_kill, dummy_cpu_disable and cpu_lowpower
>From v4:
- Added an SMP registration interface and moved all SMP structures to
smp.c. The end result is much cleaner.
- Cleaned up patch 2 (left overse from a previous rework)
- NVIDIA/EXYNOS4 naming cleanup.
>From v3:
- Converted all SMP platforms
- Added some cleanup as a last patch
>From v2:
- Split the SMP ops between init and runtime operations in order to
have separate lifetimes for the different structures. This is not
perfect though, as it still allows an __init function to make it to
a runtime structure (all smp_*_ops structures are __initdata in
order to be able to discard them). Thanks to Nico for pointing this
out.
- Use macros to hide the #ifdef-ery in the SoC descriptor init,
courtesy of Arnd.
>From v1:
- Move the SMP ops out of the descriptor, which makes the structure
init a bit cleaner (thanks to Arnd).
- Mark all structures __initdata and keep a copy of the used ones.
- Keep a global pointer for the SMP ops.
Marc Zyngier (15):
ARM: SoC: Introduce per SoC descriptor
ARM: SoC: Add per SoC SMP and CPU hotplug operations
ARM: SoC: convert VExpress/RealView to SoC descriptor
ARM: SoC: convert OMAP4 to SoC descriptor
ARM: SoC: convert Tegra to SoC descriptor
ARM: SoC: convert Exynos4 to SoC descriptor
ARM: SoC: convert MSM SMP to SoC descriptor
ARM: SoC: convert ux500 to SoC descriptor
ARM: SoC: convert shmobile SMP to SoC descriptor
ARM: SoC: convert highbank to SoC descriptor
ARM: SoC: convert imx6q to SoC descriptor
ARM: smp: Make SoC descriptor mandatory for SMP platforms
ARM: hotplug: Introduce dummy_cpu_kill
ARM: hotplug: Introduce dummy_cpu_disable
ARM: hotplug: add cpu_lowpower as an alternative to cpu_die
arch/arm/include/asm/mach/arch.h | 2 +
arch/arm/include/asm/smp.h | 15 ----
arch/arm/include/asm/smp_plat.h | 4 +
arch/arm/include/asm/soc.h | 65 ++++++++++++++++
arch/arm/kernel/setup.c | 8 ++
arch/arm/kernel/smp.c | 99 +++++++++++++++++++++++-
arch/arm/mach-exynos/common.c | 6 ++
arch/arm/mach-exynos/common.h | 8 ++
arch/arm/mach-exynos/hotplug.c | 43 +---------
arch/arm/mach-exynos/mach-armlex4210.c | 1 +
arch/arm/mach-exynos/mach-nuri.c | 1 +
arch/arm/mach-exynos/mach-origen.c | 1 +
arch/arm/mach-exynos/mach-smdk4x12.c | 2 +
arch/arm/mach-exynos/mach-smdkv310.c | 2 +
arch/arm/mach-exynos/mach-universal_c210.c | 1 +
arch/arm/mach-exynos/platsmp.c | 25 +++++-
arch/arm/mach-highbank/core.h | 6 ++
arch/arm/mach-highbank/highbank.c | 7 ++
arch/arm/mach-highbank/hotplug.c | 16 +----
arch/arm/mach-highbank/platsmp.c | 24 +++++-
arch/arm/mach-imx/hotplug.c | 16 +----
arch/arm/mach-imx/mach-imx6q.c | 8 ++
arch/arm/mach-imx/platsmp.c | 25 +++++-
arch/arm/mach-msm/Makefile | 2 +-
arch/arm/mach-msm/board-msm8960.c | 3 +
arch/arm/mach-msm/board-msm8x60.c | 9 ++
arch/arm/mach-msm/core.c | 17 ++++
arch/arm/mach-msm/core.h | 7 ++
arch/arm/mach-msm/hotplug.c | 38 +--------
arch/arm/mach-msm/platsmp.c | 24 +++++-
arch/arm/mach-omap2/board-4430sdp.c | 1 +
arch/arm/mach-omap2/board-omap4panda.c | 1 +
arch/arm/mach-omap2/common.h | 11 +++
arch/arm/mach-omap2/omap-hotplug.c | 16 +----
arch/arm/mach-omap2/omap-smp.c | 25 +++++-
arch/arm/mach-omap2/omap4-common.c | 7 ++
arch/arm/mach-realview/core.c | 7 ++
arch/arm/mach-realview/core.h | 7 ++
arch/arm/mach-realview/hotplug.c | 41 +---------
arch/arm/mach-realview/platsmp.c | 25 +++++-
arch/arm/mach-realview/realview_eb.c | 1 +
arch/arm/mach-realview/realview_pb1176.c | 1 +
arch/arm/mach-realview/realview_pb11mp.c | 1 +
arch/arm/mach-realview/realview_pba8.c | 1 +
arch/arm/mach-realview/realview_pbx.c | 1 +
arch/arm/mach-shmobile/Makefile | 2 +-
arch/arm/mach-shmobile/board-ag5evm.c | 1 +
arch/arm/mach-shmobile/board-kota2.c | 1 +
arch/arm/mach-shmobile/board-marzen.c | 1 +
arch/arm/mach-shmobile/hotplug.c | 13 ++-
arch/arm/mach-shmobile/include/mach/common.h | 14 +---
arch/arm/mach-shmobile/include/mach/r8a7779.h | 6 ++
arch/arm/mach-shmobile/include/mach/sh73a0.h | 6 ++
arch/arm/mach-shmobile/platsmp.c | 97 -----------------------
arch/arm/mach-shmobile/setup-r8a7779.c | 6 ++
arch/arm/mach-shmobile/setup-sh73a0.c | 6 ++
arch/arm/mach-shmobile/smp-r8a7779.c | 40 +++++++++-
arch/arm/mach-shmobile/smp-sh73a0.c | 41 +++++++++-
arch/arm/mach-tegra/board-dt-tegra20.c | 2 +
arch/arm/mach-tegra/board-dt-tegra30.c | 1 +
arch/arm/mach-tegra/board-harmony.c | 2 +
arch/arm/mach-tegra/board-paz00.c | 2 +
arch/arm/mach-tegra/board-seaboard.c | 4 +
arch/arm/mach-tegra/board-trimslice.c | 2 +
arch/arm/mach-tegra/common.c | 8 ++
arch/arm/mach-tegra/common.h | 9 ++
arch/arm/mach-tegra/hotplug.c | 67 ++--------------
arch/arm/mach-tegra/platsmp.c | 27 ++++++-
arch/arm/mach-ux500/board-mop500.c | 3 +
arch/arm/mach-ux500/board-u5500.c | 1 +
arch/arm/mach-ux500/cpu.c | 7 ++-
arch/arm/mach-ux500/hotplug.c | 30 +------
arch/arm/mach-ux500/include/mach/setup.h | 7 ++
arch/arm/mach-ux500/platsmp.c | 23 +++++-
arch/arm/mach-vexpress/core.h | 8 ++
arch/arm/mach-vexpress/hotplug.c | 41 +---------
arch/arm/mach-vexpress/platsmp.c | 26 +++++-
arch/arm/mach-vexpress/v2m.c | 9 ++
arch/arm/plat-mxc/include/mach/common.h | 8 ++
arch/arm/plat-versatile/include/plat/platsmp.h | 14 ++++
arch/arm/plat-versatile/platsmp.c | 4 +-
81 files changed, 711 insertions(+), 459 deletions(-)
create mode 100644 arch/arm/include/asm/soc.h
create mode 100644 arch/arm/mach-msm/core.c
create mode 100644 arch/arm/mach-msm/core.h
delete mode 100644 arch/arm/mach-shmobile/platsmp.c
create mode 100644 arch/arm/mach-tegra/common.h
create mode 100644 arch/arm/plat-versatile/include/plat/platsmp.h
--
1.7.3.4
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 01/15] ARM: SoC: Introduce per SoC descriptor
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-08 23:59 ` Nicolas Pitre
2012-02-08 0:30 ` [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations Marc Zyngier
` (14 subsequent siblings)
15 siblings, 1 reply; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
The ARM core code expects the various SoCs to hide their
implementation differences behind a well established API.
The various sub-arch-specific bit are often either at
the machine descriptor level, or provided at link time
by the sub-arch code.
The SoC descriptor is a container that holds the SoC
specific bits that can be moved away from the machine
descriptor as well as an indirection point for the
global symbols (SMP and CPU hotplug support, for example).
This patch introduce this SoC descriptor, with the only field
being the name of the SoC.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/include/asm/mach/arch.h | 2 ++
arch/arm/include/asm/soc.h | 19 +++++++++++++++++++
arch/arm/kernel/setup.c | 7 +++++++
3 files changed, 28 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/include/asm/soc.h
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index d7692ca..cf7ef91 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -14,6 +14,7 @@ struct tag;
struct meminfo;
struct sys_timer;
struct pt_regs;
+struct arm_soc_desc;
struct machine_desc {
unsigned int nr; /* architecture number */
@@ -35,6 +36,7 @@ struct machine_desc {
unsigned char reserve_lp1 :1; /* never has lp1 */
unsigned char reserve_lp2 :1; /* never has lp2 */
char restart_mode; /* default restart mode */
+ struct arm_soc_desc *soc; /* SoC descriptor */
void (*fixup)(struct tag *, char **,
struct meminfo *);
void (*reserve)(void);/* reserve mem blocks */
diff --git a/arch/arm/include/asm/soc.h b/arch/arm/include/asm/soc.h
new file mode 100644
index 0000000..2d73e35
--- /dev/null
+++ b/arch/arm/include/asm/soc.h
@@ -0,0 +1,19 @@
+/*
+ * linux/arch/arm/include/asm/soc.h
+ *
+ * Copyright (C) 2011 ARM Ltd.
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ASM_ARM_SOC_H
+#define __ASM_ARM_SOC_H
+
+struct arm_soc_desc {
+ const char *name;
+};
+
+#endif /* __ASM_ARM_SOC_H */
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index a255c39..69ac002 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -45,6 +45,7 @@
#include <asm/cachetype.h>
#include <asm/tlbflush.h>
#include <asm/system.h>
+#include <asm/soc.h>
#include <asm/prom.h>
#include <asm/mach/arch.h>
@@ -141,6 +142,7 @@ static const char *cpu_name;
static const char *machine_name;
static char __initdata cmd_line[COMMAND_LINE_SIZE];
struct machine_desc *machine_desc __initdata;
+static const struct arm_soc_desc *soc_desc __initdata;
static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } };
@@ -922,6 +924,11 @@ void __init setup_arch(char **cmdline_p)
mdesc = setup_machine_tags(machine_arch_type);
machine_desc = mdesc;
machine_name = mdesc->name;
+ if (mdesc->soc) {
+ soc_desc = mdesc->soc;
+ pr_info("SoC: %s\n", soc_desc->name);
+ } else
+ soc_desc = NULL;
#ifdef CONFIG_ZONE_DMA
if (mdesc->dma_zone_size) {
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 01/15] ARM: SoC: Introduce per " Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-08 23:42 ` David Brown
` (2 more replies)
2012-02-08 0:30 ` [PATCH v6 03/15] ARM: SoC: convert VExpress/RealView to SoC descriptor Marc Zyngier
` (13 subsequent siblings)
15 siblings, 3 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Populate the SoC descriptor structure with the SMP and CPU hotplug
operations. To allow the kernel to continue building, the platform
hooks are defined as weak symbols which are overrided by the
platform code. Once all platforms are converted, the "weak" attribute
will be removed and the function made static.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/include/asm/soc.h | 45 ++++++++++++++++++++++++++++
arch/arm/kernel/setup.c | 1 +
arch/arm/kernel/smp.c | 69 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 115 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/soc.h b/arch/arm/include/asm/soc.h
index 2d73e35..1bcc58c 100644
--- a/arch/arm/include/asm/soc.h
+++ b/arch/arm/include/asm/soc.h
@@ -12,8 +12,53 @@
#ifndef __ASM_ARM_SOC_H
#define __ASM_ARM_SOC_H
+struct task_struct;
+
+struct arm_soc_smp_init_ops {
+ /*
+ * Setup the set of possible CPUs (via set_cpu_possible)
+ */
+ void (*smp_init_cpus)(void);
+ /*
+ * Initialize cpu_possible map, and enable coherency
+ */
+ void (*smp_prepare_cpus)(unsigned int max_cpus);
+};
+
+struct arm_soc_smp_ops {
+ /*
+ * Perform platform specific initialisation of the specified CPU.
+ */
+ void (*smp_secondary_init)(unsigned int cpu);
+ /*
+ * Boot a secondary CPU, and assign it the specified idle task.
+ * This also gives us the initial stack to use for this CPU.
+ */
+ int (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle);
+#ifdef CONFIG_HOTPLUG_CPU
+ int (*cpu_kill)(unsigned int cpu);
+ void (*cpu_die)(unsigned int cpu);
+ int (*cpu_disable)(unsigned int cpu);
+#endif
+};
+
struct arm_soc_desc {
const char *name;
+#ifdef CONFIG_SMP
+ struct arm_soc_smp_init_ops *smp_init_ops;
+ struct arm_soc_smp_ops *smp_ops;
+#endif
};
+#ifdef CONFIG_SMP
+#define soc_smp_init_ops(ops) .smp_init_ops = &(ops),
+#define soc_smp_ops(ops) .smp_ops = &(ops),
+extern void soc_smp_ops_register(struct arm_soc_smp_init_ops *,
+ struct arm_soc_smp_ops *);
+#else
+#define soc_smp_init_ops(ops) /* empty */
+#define soc_smp_ops(ops) /* empty */
+#define soc_smp_ops_register(a,b) do {} while(0)
+#endif
+
#endif /* __ASM_ARM_SOC_H */
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 69ac002..bf30274 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -927,6 +927,7 @@ void __init setup_arch(char **cmdline_p)
if (mdesc->soc) {
soc_desc = mdesc->soc;
pr_info("SoC: %s\n", soc_desc->name);
+ soc_smp_ops_register(soc_desc->smp_init_ops, soc_desc->smp_ops);
} else
soc_desc = NULL;
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index cdeb727..49a904d 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -27,6 +27,7 @@
#include <linux/completion.h>
#include <linux/atomic.h>
+#include <asm/soc.h>
#include <asm/cacheflush.h>
#include <asm/cpu.h>
#include <asm/cputype.h>
@@ -127,9 +128,77 @@ int __cpuinit __cpu_up(unsigned int cpu)
return ret;
}
+/* SoC helpers */
+static const struct arm_soc_smp_init_ops *soc_smp_init_ops __initdata;
+static const struct arm_soc_smp_ops *soc_smp_ops __cpuinitdata;
+static struct arm_soc_smp_ops __soc_smp_ops __cpuinitdata;
+
+void __init soc_smp_ops_register(struct arm_soc_smp_init_ops *smp_init_ops,
+ struct arm_soc_smp_ops *smp_ops)
+{
+ if (smp_init_ops)
+ soc_smp_init_ops = smp_init_ops;
+
+ /*
+ * Warning: we're copying an __initdata structure into a
+ * __cpuinitdata structure. We *know* it is valid because only
+ * __cpuinit (or more persistant) functions should be pointed
+ * to by soc_smp_ops. Still, this is borderline ugly.
+ */
+ if (smp_ops) {
+ __soc_smp_ops = *smp_ops;
+ soc_smp_ops = &__soc_smp_ops;
+ }
+}
+
+void __attribute__((weak)) __init smp_init_cpus(void)
+{
+ if (soc_smp_init_ops && soc_smp_init_ops->smp_init_cpus)
+ soc_smp_init_ops->smp_init_cpus();
+}
+
+void __attribute__((weak)) __init platform_smp_prepare_cpus(unsigned int max_cpus)
+{
+ if (soc_smp_ops && soc_smp_init_ops->smp_prepare_cpus)
+ soc_smp_init_ops->smp_prepare_cpus(max_cpus);
+}
+
+void __attribute__((weak)) __cpuinit platform_secondary_init(unsigned int cpu)
+{
+ if (soc_smp_ops && soc_smp_ops->smp_secondary_init)
+ soc_smp_ops->smp_secondary_init(cpu);
+}
+
+int __attribute__((weak)) __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+ if (soc_smp_ops && soc_smp_ops->smp_boot_secondary)
+ return soc_smp_ops->smp_boot_secondary(cpu, idle);
+ return -ENOSYS;
+}
+
#ifdef CONFIG_HOTPLUG_CPU
static void percpu_timer_stop(void);
+int __attribute__((weak)) __cpuinit platform_cpu_kill(unsigned int cpu)
+{
+ if (soc_smp_ops && soc_smp_ops->cpu_kill)
+ return soc_smp_ops->cpu_kill(cpu);
+ return 0;
+}
+
+void __attribute__((weak)) __cpuinit platform_cpu_die(unsigned int cpu)
+{
+ if (soc_smp_ops && soc_smp_ops->cpu_die)
+ soc_smp_ops->cpu_die(cpu);
+}
+
+int __attribute__((weak)) __cpuinit platform_cpu_disable(unsigned int cpu)
+{
+ if (soc_smp_ops && soc_smp_ops->cpu_disable)
+ return soc_smp_ops->cpu_disable(cpu);
+ return -EPERM;
+}
+
/*
* __cpu_disable runs on the processor to be shutdown.
*/
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 03/15] ARM: SoC: convert VExpress/RealView to SoC descriptor
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 01/15] ARM: SoC: Introduce per " Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 04/15] ARM: SoC: convert OMAP4 " Marc Zyngier
` (12 subsequent siblings)
15 siblings, 0 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Convert both Realview and VExpress to use the SoC descriptor to
provide their SMP and CPU hotplug operation.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-realview/core.c | 7 ++++++
arch/arm/mach-realview/core.h | 9 ++++++++
arch/arm/mach-realview/hotplug.c | 6 ++--
arch/arm/mach-realview/platsmp.c | 24 +++++++++++++++++++---
arch/arm/mach-realview/realview_eb.c | 1 +
arch/arm/mach-realview/realview_pb1176.c | 1 +
arch/arm/mach-realview/realview_pb11mp.c | 1 +
arch/arm/mach-realview/realview_pba8.c | 1 +
arch/arm/mach-realview/realview_pbx.c | 1 +
arch/arm/mach-vexpress/core.h | 10 +++++++++
arch/arm/mach-vexpress/hotplug.c | 6 ++--
arch/arm/mach-vexpress/platsmp.c | 25 ++++++++++++++++++++---
arch/arm/mach-vexpress/v2m.c | 9 ++++++++
arch/arm/plat-versatile/include/plat/platsmp.h | 14 +++++++++++++
arch/arm/plat-versatile/platsmp.c | 4 +-
15 files changed, 103 insertions(+), 16 deletions(-)
create mode 100644 arch/arm/plat-versatile/include/plat/platsmp.h
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index acd329a..0d4b633 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -33,6 +33,7 @@
#include <linux/clkdev.h>
#include <linux/mtd/physmap.h>
+#include <asm/soc.h>
#include <asm/system.h>
#include <mach/hardware.h>
#include <asm/irq.h>
@@ -533,3 +534,9 @@ void realview_fixup(struct tag *tags, char **from, struct meminfo *meminfo)
meminfo->nr_banks = 1;
#endif
}
+
+struct arm_soc_desc realview_soc_desc __initdata = {
+ .name = "ARM RealView Platform",
+ soc_smp_init_ops(realview_soc_smp_init_ops)
+ soc_smp_ops(realview_soc_smp_ops)
+};
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 735b57a..a23caa3 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -27,6 +27,7 @@
#include <asm/setup.h>
#include <asm/leds.h>
+#include <asm/soc.h>
#define AMBA_DEVICE(name,busid,base,plat) \
static struct amba_device name##_device = { \
@@ -66,4 +67,12 @@ extern void realview_init_early(void);
extern void realview_fixup(struct tag *tags, char **from,
struct meminfo *meminfo);
+extern struct arm_soc_desc realview_soc_desc;
+extern struct arm_soc_smp_init_ops realview_soc_smp_init_ops;
+extern struct arm_soc_smp_ops realview_soc_smp_ops;
+
+extern int realview_cpu_kill(unsigned int cpu);
+extern void realview_cpu_die(unsigned int cpu);
+extern int realview_cpu_disable(unsigned int cpu);
+
#endif
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
index eb55f05..ba4e2a86 100644
--- a/arch/arm/mach-realview/hotplug.c
+++ b/arch/arm/mach-realview/hotplug.c
@@ -88,7 +88,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
}
}
-int platform_cpu_kill(unsigned int cpu)
+int realview_cpu_kill(unsigned int cpu)
{
return 1;
}
@@ -98,7 +98,7 @@ int platform_cpu_kill(unsigned int cpu)
*
* Called with IRQs disabled
*/
-void platform_cpu_die(unsigned int cpu)
+void realview_cpu_die(unsigned int cpu)
{
int spurious = 0;
@@ -118,7 +118,7 @@ void platform_cpu_die(unsigned int cpu)
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
}
-int platform_cpu_disable(unsigned int cpu)
+int realview_cpu_disable(unsigned int cpu)
{
/*
* we don't allow CPU 0 to be shutdown (it is still too special
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index 17c878d..8e4a865 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -17,14 +17,15 @@
#include <asm/hardware/gic.h>
#include <asm/mach-types.h>
#include <asm/smp_scu.h>
+#include <asm/soc.h>
#include <mach/board-eb.h>
#include <mach/board-pb11mp.h>
#include <mach/board-pbx.h>
-#include "core.h"
+#include <plat/platsmp.h>
-extern void versatile_secondary_startup(void);
+#include "core.h"
static void __iomem *scu_base_addr(void)
{
@@ -43,7 +44,7 @@ static void __iomem *scu_base_addr(void)
* Initialise the CPU possible map early - this describes the CPUs
* which may be present or become present in the system.
*/
-void __init smp_init_cpus(void)
+static void __init realview_smp_init_cpus(void)
{
void __iomem *scu_base = scu_base_addr();
unsigned int i, ncores;
@@ -63,7 +64,7 @@ void __init smp_init_cpus(void)
set_smp_cross_call(gic_raise_softirq);
}
-void __init platform_smp_prepare_cpus(unsigned int max_cpus)
+static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
{
scu_enable(scu_base_addr());
@@ -77,3 +78,18 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
__raw_writel(virt_to_phys(versatile_secondary_startup),
__io_address(REALVIEW_SYS_FLAGSSET));
}
+
+struct arm_soc_smp_init_ops realview_soc_smp_init_ops __initdata = {
+ .smp_init_cpus = realview_smp_init_cpus,
+ .smp_prepare_cpus = realview_smp_prepare_cpus,
+};
+
+struct arm_soc_smp_ops realview_soc_smp_ops __initdata = {
+ .smp_secondary_init = versatile_secondary_init,
+ .smp_boot_secondary = versatile_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_kill = realview_cpu_kill,
+ .cpu_die = realview_cpu_die,
+ .cpu_disable = realview_cpu_disable,
+#endif
+};
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 9578145..9218cae 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -456,6 +456,7 @@ static void __init realview_eb_init(void)
MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
.atag_offset = 0x100,
+ .soc = &realview_soc_desc,
.fixup = realview_fixup,
.map_io = realview_eb_map_io,
.init_early = realview_init_early,
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index e4abe94..710230f 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -384,6 +384,7 @@ static void __init realview_pb1176_init(void)
MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176")
/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
.atag_offset = 0x100,
+ .soc = &realview_soc_desc,
.fixup = realview_pb1176_fixup,
.map_io = realview_pb1176_map_io,
.init_early = realview_init_early,
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 2147335..fc9e278 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -353,6 +353,7 @@ static void __init realview_pb11mp_init(void)
MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore")
/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
.atag_offset = 0x100,
+ .soc = &realview_soc_desc,
.fixup = realview_fixup,
.map_io = realview_pb11mp_map_io,
.init_early = realview_init_early,
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index 25b2e59..8c6f8ca 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -308,6 +308,7 @@ static void __init realview_pba8_init(void)
MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8")
/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
.atag_offset = 0x100,
+ .soc = &realview_soc_desc,
.fixup = realview_fixup,
.map_io = realview_pba8_map_io,
.init_early = realview_init_early,
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index ac71564..61369b0 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -391,6 +391,7 @@ static void __init realview_pbx_init(void)
MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX")
/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
.atag_offset = 0x100,
+ .soc = &realview_soc_desc,
.fixup = realview_pbx_fixup,
.map_io = realview_pbx_map_io,
.init_early = realview_init_early,
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
index f439715..bd9065a 100644
--- a/arch/arm/mach-vexpress/core.h
+++ b/arch/arm/mach-vexpress/core.h
@@ -17,3 +17,13 @@ struct amba_device name##_device = { \
.irq = IRQ_##base, \
/* .dma = DMA_##base,*/ \
}
+
+struct arm_soc_smp_init_ops;
+struct arm_soc_smp_ops;
+
+extern struct arm_soc_smp_init_ops vexpress_soc_smp_init_ops;
+extern struct arm_soc_smp_ops vexpress_soc_smp_ops;
+
+extern int vexpress_cpu_kill(unsigned int cpu);
+extern void vexpress_cpu_die(unsigned int cpu);
+extern int vexpress_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
index 3034a4d..ac6d034 100644
--- a/arch/arm/mach-vexpress/hotplug.c
+++ b/arch/arm/mach-vexpress/hotplug.c
@@ -84,7 +84,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
}
}
-int platform_cpu_kill(unsigned int cpu)
+int vexpress_cpu_kill(unsigned int cpu)
{
return 1;
}
@@ -94,7 +94,7 @@ int platform_cpu_kill(unsigned int cpu)
*
* Called with IRQs disabled
*/
-void platform_cpu_die(unsigned int cpu)
+void vexpress_cpu_die(unsigned int cpu)
{
int spurious = 0;
@@ -114,7 +114,7 @@ void platform_cpu_die(unsigned int cpu)
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
}
-int platform_cpu_disable(unsigned int cpu)
+int vexpress_cpu_disable(unsigned int cpu)
{
/*
* we don't allow CPU 0 to be shutdown (it is still too special
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index 124ffb1..aba765b 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -13,23 +13,25 @@
#include <linux/smp.h>
#include <linux/io.h>
+#include <asm/soc.h>
+
#include <mach/motherboard.h>
#define V2M_PA_CS7 0x10000000
-#include "core.h"
+#include <plat/platsmp.h>
-extern void versatile_secondary_startup(void);
+#include "core.h"
/*
* Initialise the CPU possible map early - this describes the CPUs
* which may be present or become present in the system.
*/
-void __init smp_init_cpus(void)
+static void __init vexpress_smp_init_cpus(void)
{
ct_desc->init_cpu_map();
}
-void __init platform_smp_prepare_cpus(unsigned int max_cpus)
+static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus)
{
/*
* Initialise the present map, which describes the set of CPUs
@@ -47,3 +49,18 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
writel(virt_to_phys(versatile_secondary_startup),
MMIO_P2V(V2M_SYS_FLAGSSET));
}
+
+struct arm_soc_smp_init_ops vexpress_soc_smp_init_ops __initdata = {
+ .smp_init_cpus = vexpress_smp_init_cpus,
+ .smp_prepare_cpus = vexpress_smp_prepare_cpus,
+};
+
+struct arm_soc_smp_ops vexpress_soc_smp_ops __initdata = {
+ .smp_secondary_init = versatile_secondary_init,
+ .smp_boot_secondary = versatile_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_kill = vexpress_cpu_kill,
+ .cpu_die = vexpress_cpu_die,
+ .cpu_disable = vexpress_cpu_disable,
+#endif
+};
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index b4a28ca..ffeac90 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -16,6 +16,7 @@
#include <linux/mtd/physmap.h>
#include <asm/mach-types.h>
+#include <asm/soc.h>
#include <asm/sizes.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -29,6 +30,7 @@
#include <mach/motherboard.h>
#include <plat/sched_clock.h>
+#include <plat/platsmp.h>
#include "core.h"
@@ -442,8 +444,15 @@ static void __init v2m_init(void)
ct_desc->init_tile();
}
+static struct arm_soc_desc vexpress_soc_desc __initdata = {
+ .name = "ARM VE Platform",
+ soc_smp_init_ops(vexpress_soc_smp_init_ops)
+ soc_smp_ops(vexpress_soc_smp_ops)
+};
+
MACHINE_START(VEXPRESS, "ARM-Versatile Express")
.atag_offset = 0x100,
+ .soc = &vexpress_soc_desc,
.map_io = v2m_map_io,
.init_early = v2m_init_early,
.init_irq = v2m_init_irq,
diff --git a/arch/arm/plat-versatile/include/plat/platsmp.h b/arch/arm/plat-versatile/include/plat/platsmp.h
new file mode 100644
index 0000000..50fb830
--- /dev/null
+++ b/arch/arm/plat-versatile/include/plat/platsmp.h
@@ -0,0 +1,14 @@
+/*
+ * linux/arch/arm/plat-versatile/include/plat/platsmp.h
+ *
+ * Copyright (C) 2011 ARM Ltd.
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+extern void versatile_secondary_startup(void);
+extern void versatile_secondary_init(unsigned int cpu);
+extern int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle);
diff --git a/arch/arm/plat-versatile/platsmp.c b/arch/arm/plat-versatile/platsmp.c
index 49c7db4..41b4706 100644
--- a/arch/arm/plat-versatile/platsmp.c
+++ b/arch/arm/plat-versatile/platsmp.c
@@ -40,7 +40,7 @@ static void __cpuinit write_pen_release(int val)
static DEFINE_SPINLOCK(boot_lock);
-void __cpuinit platform_secondary_init(unsigned int cpu)
+void __cpuinit versatile_secondary_init(unsigned int cpu)
{
/*
* if any interrupts are already enabled for the primary
@@ -62,7 +62,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
spin_unlock(&boot_lock);
}
-int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+int __cpuinit versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
unsigned long timeout;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 04/15] ARM: SoC: convert OMAP4 to SoC descriptor
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (2 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 03/15] ARM: SoC: convert VExpress/RealView to SoC descriptor Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 05/15] ARM: SoC: convert Tegra " Marc Zyngier
` (11 subsequent siblings)
15 siblings, 0 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Convert OMAP4 to use the SoC descriptor to provide its SMP
and CPU hotplug operations.
Tested on both Panda and IGEPv2 (MULTI_OMAP kernel)
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-omap2/board-4430sdp.c | 1 +
arch/arm/mach-omap2/board-omap4panda.c | 1 +
arch/arm/mach-omap2/common.h | 13 +++++++++++++
arch/arm/mach-omap2/omap-hotplug.c | 6 +++---
arch/arm/mach-omap2/omap-smp.c | 24 ++++++++++++++++++++----
arch/arm/mach-omap2/omap4-common.c | 7 +++++++
6 files changed, 45 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 39fba9d..21834d1 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -914,6 +914,7 @@ static void __init omap_4430sdp_init(void)
MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
/* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
.atag_offset = 0x100,
+ .soc = &omap4_soc_desc,
.reserve = omap_reserve,
.map_io = omap4_map_io,
.init_early = omap4430_init_early,
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 30ad40d..f84cc0b 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -500,6 +500,7 @@ static void __init omap4_panda_init(void)
MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
/* Maintainer: David Anders - Texas Instruments Inc */
.atag_offset = 0x100,
+ .soc = &omap4_soc_desc,
.reserve = omap_reserve,
.map_io = omap4_map_io,
.init_early = omap4430_init_early,
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index febffde..961b79a 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -194,8 +194,21 @@ extern void omap_secondary_startup(void);
extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask);
extern void omap_auxcoreboot_addr(u32 cpu_addr);
extern u32 omap_read_auxcoreboot0(void);
+
+extern int omap4_cpu_kill(unsigned int cpu);
+extern void omap4_cpu_die(unsigned int cpu);
+extern int omap4_cpu_disable(unsigned int cpu);
+
+struct arm_soc_smp_init_ops;
+struct arm_soc_smp_ops;
+
+extern struct arm_soc_smp_init_ops omap4_soc_smp_init_ops;
+extern struct arm_soc_smp_ops omap4_soc_smp_ops;
#endif
+struct arm_soc_desc;
+extern struct arm_soc_desc omap4_soc_desc;
+
#if defined(CONFIG_SMP) && defined(CONFIG_PM)
extern int omap4_mpuss_init(void);
extern int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state);
diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c
index adbe4d8..e794f4b 100644
--- a/arch/arm/mach-omap2/omap-hotplug.c
+++ b/arch/arm/mach-omap2/omap-hotplug.c
@@ -24,7 +24,7 @@
#include "powerdomain.h"
-int platform_cpu_kill(unsigned int cpu)
+int omap4_cpu_kill(unsigned int cpu)
{
return 1;
}
@@ -33,7 +33,7 @@ int platform_cpu_kill(unsigned int cpu)
* platform-specific code to shutdown a CPU
* Called with IRQs disabled
*/
-void platform_cpu_die(unsigned int cpu)
+void omap4_cpu_die(unsigned int cpu)
{
unsigned int this_cpu;
@@ -62,7 +62,7 @@ void platform_cpu_die(unsigned int cpu)
}
}
-int platform_cpu_disable(unsigned int cpu)
+int omap4_cpu_disable(unsigned int cpu)
{
/*
* we don't allow CPU 0 to be shutdown (it is still too special
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index c1bf3ef..4d39fd0 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -23,6 +23,7 @@
#include <asm/cacheflush.h>
#include <asm/hardware/gic.h>
#include <asm/smp_scu.h>
+#include <asm/soc.h>
#include <mach/hardware.h>
#include <mach/omap-secure.h>
@@ -40,7 +41,7 @@ void __iomem *omap4_get_scu_base(void)
return scu_base;
}
-void __cpuinit platform_secondary_init(unsigned int cpu)
+static void __cpuinit omap4_secondary_init(unsigned int cpu)
{
/*
* Configure ACTRL and enable NS SMP bit access on CPU1 on HS device.
@@ -68,7 +69,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
spin_unlock(&boot_lock);
}
-int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+static int __cpuinit omap4_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
static struct clockdomain *cpu1_clkdm;
static bool booted;
@@ -144,7 +145,7 @@ static void __init wakeup_secondary(void)
* Initialise the CPU possible map early - this describes the CPUs
* which may be present or become present in the system.
*/
-void __init smp_init_cpus(void)
+static void __init omap4_smp_init_cpus(void)
{
unsigned int i, ncores;
@@ -170,7 +171,7 @@ void __init smp_init_cpus(void)
set_smp_cross_call(gic_raise_softirq);
}
-void __init platform_smp_prepare_cpus(unsigned int max_cpus)
+static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
{
/*
@@ -180,3 +181,18 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
scu_enable(scu_base);
wakeup_secondary();
}
+
+struct arm_soc_smp_init_ops omap4_soc_smp_init_ops __initdata = {
+ .smp_init_cpus = omap4_smp_init_cpus,
+ .smp_prepare_cpus = omap4_smp_prepare_cpus,
+};
+
+struct arm_soc_smp_ops omap4_soc_smp_ops __initdata = {
+ .smp_secondary_init = omap4_secondary_init,
+ .smp_boot_secondary = omap4_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_kill = omap4_cpu_kill,
+ .cpu_die = omap4_cpu_die,
+ .cpu_disable = omap4_cpu_disable,
+#endif
+};
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 40a8fbc..0742ddf 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -17,6 +17,7 @@
#include <linux/platform_device.h>
#include <linux/memblock.h>
+#include <asm/soc.h>
#include <asm/hardware/gic.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/mach/map.h>
@@ -198,3 +199,9 @@ static int __init omap4_sar_ram_init(void)
return 0;
}
early_initcall(omap4_sar_ram_init);
+
+struct arm_soc_desc omap4_soc_desc __initdata = {
+ .name = "TI OMAP4",
+ soc_smp_init_ops(omap4_soc_smp_init_ops)
+ soc_smp_ops(omap4_soc_smp_ops)
+};
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 05/15] ARM: SoC: convert Tegra to SoC descriptor
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (3 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 04/15] ARM: SoC: convert OMAP4 " Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 06/15] ARM: SoC: convert Exynos4 " Marc Zyngier
` (10 subsequent siblings)
15 siblings, 0 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Convert Tegra to use the SoC descriptor to provide its SMP
and CPU hotplug operations.
Tested on Harmony.
Cc: Colin Cross <ccross@android.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-tegra/board-dt-tegra20.c | 2 ++
arch/arm/mach-tegra/board-dt-tegra30.c | 1 +
arch/arm/mach-tegra/board-harmony.c | 2 ++
arch/arm/mach-tegra/board-paz00.c | 2 ++
arch/arm/mach-tegra/board-seaboard.c | 4 ++++
arch/arm/mach-tegra/board-trimslice.c | 2 ++
arch/arm/mach-tegra/common.c | 8 ++++++++
arch/arm/mach-tegra/common.h | 11 +++++++++++
arch/arm/mach-tegra/hotplug.c | 6 +++---
arch/arm/mach-tegra/platsmp.c | 26 ++++++++++++++++++++++----
10 files changed, 57 insertions(+), 7 deletions(-)
create mode 100644 arch/arm/mach-tegra/common.h
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index 7a95e0b..759d340 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -46,6 +46,7 @@
#include "board-harmony.h"
#include "clock.h"
#include "devices.h"
+#include "common.h"
void harmony_pinmux_init(void);
void paz00_pinmux_init(void);
@@ -141,6 +142,7 @@ static const char *tegra20_dt_board_compat[] = {
DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)")
.map_io = tegra_map_common_io,
+ .soc = &tegra_soc_desc,
.init_early = tegra20_init_early,
.init_irq = tegra_dt_init_irq,
.handle_irq = gic_handle_irq,
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c
index 3c197e2..8f058ab 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -52,6 +52,7 @@ static const char *tegra30_dt_board_compat[] = {
};
DT_MACHINE_START(TEGRA30_DT, "NVIDIA Tegra30 (Flattened Device Tree)")
+ .soc = &tegra_soc_desc,
.map_io = tegra_map_common_io,
.init_early = tegra30_init_early,
.init_irq = tegra_dt_init_irq,
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
index 789bdc9..382161b 100644
--- a/arch/arm/mach-tegra/board-harmony.c
+++ b/arch/arm/mach-tegra/board-harmony.c
@@ -44,6 +44,7 @@
#include "clock.h"
#include "devices.h"
#include "gpio-names.h"
+#include "common.h"
static struct plat_serial8250_port debug_uart_platform_data[] = {
{
@@ -184,6 +185,7 @@ static void __init tegra_harmony_init(void)
MACHINE_START(HARMONY, "harmony")
.atag_offset = 0x100,
+ .soc = &tegra_soc_desc,
.fixup = tegra_harmony_fixup,
.map_io = tegra_map_common_io,
.init_early = tegra20_init_early,
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index fcf4f37..05bbc13 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -46,6 +46,7 @@
#include "clock.h"
#include "devices.h"
#include "gpio-names.h"
+#include "common.h"
static struct plat_serial8250_port debug_uart_platform_data[] = {
{
@@ -214,6 +215,7 @@ static void __init tegra_paz00_init(void)
MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
.atag_offset = 0x100,
+ .soc = &tegra_soc_desc,
.fixup = tegra_paz00_fixup,
.map_io = tegra_map_common_io,
.init_early = tegra20_init_early,
diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c
index ebac65f..36797bd 100644
--- a/arch/arm/mach-tegra/board-seaboard.c
+++ b/arch/arm/mach-tegra/board-seaboard.c
@@ -41,6 +41,7 @@
#include "clock.h"
#include "devices.h"
#include "gpio-names.h"
+#include "common.h"
static struct plat_serial8250_port debug_uart_platform_data[] = {
{
@@ -282,6 +283,7 @@ static void __init tegra_wario_init(void)
MACHINE_START(SEABOARD, "seaboard")
.atag_offset = 0x100,
+ .soc = &tegra_soc_desc,
.map_io = tegra_map_common_io,
.init_early = tegra20_init_early,
.init_irq = tegra_init_irq,
@@ -293,6 +295,7 @@ MACHINE_END
MACHINE_START(KAEN, "kaen")
.atag_offset = 0x100,
+ .soc = &tegra_soc_desc,
.map_io = tegra_map_common_io,
.init_early = tegra20_init_early,
.init_irq = tegra_init_irq,
@@ -304,6 +307,7 @@ MACHINE_END
MACHINE_START(WARIO, "wario")
.atag_offset = 0x100,
+ .soc = &tegra_soc_desc,
.map_io = tegra_map_common_io,
.init_early = tegra20_init_early,
.init_irq = tegra_init_irq,
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c
index cd52820..4391981 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -38,6 +38,7 @@
#include "clock.h"
#include "devices.h"
#include "gpio-names.h"
+#include "common.h"
#include "board-trimslice.h"
@@ -173,6 +174,7 @@ static void __init tegra_trimslice_init(void)
MACHINE_START(TRIMSLICE, "trimslice")
.atag_offset = 0x100,
+ .soc = &tegra_soc_desc,
.fixup = tegra_trimslice_fixup,
.map_io = tegra_map_common_io,
.init_early = tegra20_init_early,
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index a2eb901..bfc1e35 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -23,6 +23,7 @@
#include <linux/delay.h>
#include <linux/of_irq.h>
+#include <asm/soc.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/hardware/gic.h>
@@ -32,6 +33,7 @@
#include "board.h"
#include "clock.h"
#include "fuse.h"
+#include "common.h"
#ifdef CONFIG_OF
static const struct of_device_id tegra_dt_irq_match[] __initconst = {
@@ -108,3 +110,9 @@ void __init tegra30_init_early(void)
tegra_init_cache(0x441, 0x551);
}
#endif
+
+struct arm_soc_desc tegra_soc_desc __initdata = {
+ .name = "NVIDIA Tegra",
+ soc_smp_init_ops(tegra_soc_smp_init_ops)
+ soc_smp_ops(tegra_soc_smp_ops)
+};
diff --git a/arch/arm/mach-tegra/common.h b/arch/arm/mach-tegra/common.h
new file mode 100644
index 0000000..e4c214d
--- /dev/null
+++ b/arch/arm/mach-tegra/common.h
@@ -0,0 +1,11 @@
+struct arm_soc_desc;
+extern struct arm_soc_desc tegra_soc_desc;
+
+struct arm_soc_smp_init_ops;
+struct arm_soc_smp_ops;
+extern struct arm_soc_smp_init_ops tegra_soc_smp_init_ops;
+extern struct arm_soc_smp_ops tegra_soc_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 f329404..7319f5f 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -86,7 +86,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
}
}
-int platform_cpu_kill(unsigned int cpu)
+int tegra_cpu_kill(unsigned int cpu)
{
return 1;
}
@@ -96,7 +96,7 @@ int platform_cpu_kill(unsigned int cpu)
*
* Called with IRQs disabled
*/
-void platform_cpu_die(unsigned int cpu)
+void tegra_cpu_die(unsigned int cpu)
{
int spurious = 0;
@@ -116,7 +116,7 @@ void platform_cpu_die(unsigned int cpu)
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
}
-int platform_cpu_disable(unsigned int cpu)
+int tegra_cpu_disable(unsigned int cpu)
{
/*
* we don't allow CPU 0 to be shutdown (it is still too special
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 7d2b5d0..519b110 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -23,9 +23,12 @@
#include <asm/hardware/gic.h>
#include <asm/mach-types.h>
#include <asm/smp_scu.h>
+#include <asm/soc.h>
#include <mach/iomap.h>
+#include "common.h"
+
extern void tegra_secondary_startup(void);
static DEFINE_SPINLOCK(boot_lock);
@@ -38,7 +41,7 @@ static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE);
#define CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x344)
-void __cpuinit platform_secondary_init(unsigned int cpu)
+static void __cpuinit tegra_secondary_init(unsigned int cpu)
{
/*
* if any interrupts are already enabled for the primary
@@ -54,7 +57,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
spin_unlock(&boot_lock);
}
-int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+static int __cpuinit tegra_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
unsigned long old_boot_vector;
unsigned long boot_vector;
@@ -110,7 +113,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
* Initialise the CPU possible map early - this describes the CPUs
* which may be present or become present in the system.
*/
-void __init smp_init_cpus(void)
+static void __init tegra_smp_init_cpus(void)
{
unsigned int i, ncores = scu_get_core_count(scu_base);
@@ -126,8 +129,23 @@ void __init smp_init_cpus(void)
set_smp_cross_call(gic_raise_softirq);
}
-void __init platform_smp_prepare_cpus(unsigned int max_cpus)
+static void __init tegra_smp_prepare_cpus(unsigned int max_cpus)
{
scu_enable(scu_base);
}
+
+struct arm_soc_smp_init_ops tegra_soc_smp_init_ops __initdata = {
+ .smp_init_cpus = tegra_smp_init_cpus,
+ .smp_prepare_cpus = tegra_smp_prepare_cpus,
+};
+
+struct arm_soc_smp_ops tegra_soc_smp_ops __initdata = {
+ .smp_secondary_init = tegra_secondary_init,
+ .smp_boot_secondary = tegra_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_kill = tegra_cpu_kill,
+ .cpu_die = tegra_cpu_die,
+ .cpu_disable = tegra_cpu_disable,
+#endif
+};
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 06/15] ARM: SoC: convert Exynos4 to SoC descriptor
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (4 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 05/15] ARM: SoC: convert Tegra " Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 07/15] ARM: SoC: convert MSM SMP " Marc Zyngier
` (9 subsequent siblings)
15 siblings, 0 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Convert Exynos4 to use the SoC descriptor to provide its SMP
and CPU hotplug operations.
Cc: Kukjin Kim <kgene.kim@samsung.com>
Tested-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-exynos/common.c | 6 ++++++
arch/arm/mach-exynos/common.h | 10 ++++++++++
arch/arm/mach-exynos/hotplug.c | 8 +++++---
arch/arm/mach-exynos/mach-armlex4210.c | 1 +
arch/arm/mach-exynos/mach-nuri.c | 1 +
arch/arm/mach-exynos/mach-origen.c | 1 +
arch/arm/mach-exynos/mach-smdk4x12.c | 2 ++
arch/arm/mach-exynos/mach-smdkv310.c | 2 ++
arch/arm/mach-exynos/mach-universal_c210.c | 1 +
arch/arm/mach-exynos/platsmp.c | 25 +++++++++++++++++++++----
10 files changed, 50 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index c59e188..04578e1 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -697,3 +697,9 @@ int __init exynos4_init_irq_eint(void)
return 0;
}
arch_initcall(exynos4_init_irq_eint);
+
+struct arm_soc_desc exynos4_soc_desc __initdata = {
+ .name = "Samsung EXYNOS4",
+ soc_smp_init_ops(exynos4_soc_smp_init_ops)
+ soc_smp_ops(exynos4_soc_smp_ops)
+};
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 1ac49de..cd37455 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -12,6 +12,8 @@
#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H
#define __ARCH_ARM_MACH_EXYNOS_COMMON_H
+#include <asm/soc.h>
+
void exynos_init_io(struct map_desc *mach_desc, int size);
void exynos4_init_irq(void);
@@ -25,6 +27,14 @@ void exynos4_restart(char mode, const char *cmd);
extern struct sys_timer exynos4_timer;
+extern struct arm_soc_smp_init_ops exynos4_soc_smp_init_ops;
+extern struct arm_soc_smp_ops exynos4_soc_smp_ops;
+extern struct arm_soc_desc exynos4_soc_desc;
+
+extern int exynos4_cpu_kill(unsigned int cpu);
+extern void exynos4_cpu_die(unsigned int cpu);
+extern int exynos4_cpu_disable(unsigned int cpu);
+
#ifdef CONFIG_ARCH_EXYNOS
extern int exynos_init(void);
extern void exynos4_map_io(void);
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index dd1ad55..66e202d 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -20,6 +20,8 @@
#include <mach/regs-pmu.h>
+#include "common.h"
+
extern volatile int pen_release;
static inline void cpu_enter_lowpower(void)
@@ -94,7 +96,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
}
}
-int platform_cpu_kill(unsigned int cpu)
+int exynos4_cpu_kill(unsigned int cpu)
{
return 1;
}
@@ -104,7 +106,7 @@ int platform_cpu_kill(unsigned int cpu)
*
* Called with IRQs disabled
*/
-void platform_cpu_die(unsigned int cpu)
+void exynos4_cpu_die(unsigned int cpu)
{
int spurious = 0;
@@ -124,7 +126,7 @@ void platform_cpu_die(unsigned int cpu)
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
}
-int platform_cpu_disable(unsigned int cpu)
+int exynos4_cpu_disable(unsigned int cpu)
{
/*
* we don't allow CPU 0 to be shutdown (it is still too special
diff --git a/arch/arm/mach-exynos/mach-armlex4210.c b/arch/arm/mach-exynos/mach-armlex4210.c
index d726fcd..5e60cea 100644
--- a/arch/arm/mach-exynos/mach-armlex4210.c
+++ b/arch/arm/mach-exynos/mach-armlex4210.c
@@ -210,6 +210,7 @@ static void __init armlex4210_machine_init(void)
MACHINE_START(ARMLEX4210, "ARMLEX4210")
/* Maintainer: Alim Akhtar <alim.akhtar@samsung.com> */
.atag_offset = 0x100,
+ .soc = &exynos4_soc_desc,
.init_irq = exynos4_init_irq,
.map_io = armlex4210_map_io,
.handle_irq = gic_handle_irq,
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index b895ec0..5a3bf74 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -1328,6 +1328,7 @@ static void __init nuri_machine_init(void)
MACHINE_START(NURI, "NURI")
/* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
.atag_offset = 0x100,
+ .soc = &exynos4_soc_desc,
.init_irq = exynos4_init_irq,
.map_io = nuri_map_io,
.handle_irq = gic_handle_irq,
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c
index 0679b8a..076d4d8 100644
--- a/arch/arm/mach-exynos/mach-origen.c
+++ b/arch/arm/mach-exynos/mach-origen.c
@@ -708,6 +708,7 @@ static void __init origen_machine_init(void)
MACHINE_START(ORIGEN, "ORIGEN")
/* Maintainer: JeongHyeon Kim <jhkim@insignal.co.kr> */
.atag_offset = 0x100,
+ .soc = &exynos4_soc_desc,
.init_irq = exynos4_init_irq,
.map_io = origen_map_io,
.handle_irq = gic_handle_irq,
diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c b/arch/arm/mach-exynos/mach-smdk4x12.c
index d00e4f0..fb9a313 100644
--- a/arch/arm/mach-exynos/mach-smdk4x12.c
+++ b/arch/arm/mach-exynos/mach-smdk4x12.c
@@ -287,6 +287,7 @@ static void __init smdk4x12_machine_init(void)
MACHINE_START(SMDK4212, "SMDK4212")
/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
.atag_offset = 0x100,
+ .soc = &exynos4_soc_desc,
.init_irq = exynos4_init_irq,
.map_io = smdk4x12_map_io,
.handle_irq = gic_handle_irq,
@@ -299,6 +300,7 @@ MACHINE_START(SMDK4412, "SMDK4412")
/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
/* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
.atag_offset = 0x100,
+ .soc = &exynos4_soc_desc,
.init_irq = exynos4_init_irq,
.map_io = smdk4x12_map_io,
.handle_irq = gic_handle_irq,
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c
index b2c5557..6672161 100644
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ b/arch/arm/mach-exynos/mach-smdkv310.c
@@ -386,6 +386,7 @@ MACHINE_START(SMDKV310, "SMDKV310")
/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
/* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
.atag_offset = 0x100,
+ .soc = &exynos4_soc_desc,
.init_irq = exynos4_init_irq,
.map_io = smdkv310_map_io,
.handle_irq = gic_handle_irq,
@@ -398,6 +399,7 @@ MACHINE_END
MACHINE_START(SMDKC210, "SMDKC210")
/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
.atag_offset = 0x100,
+ .soc = &exynos4_soc_desc,
.init_irq = exynos4_init_irq,
.map_io = smdkv310_map_io,
.handle_irq = gic_handle_irq,
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 37ac93e..3350b50 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -1054,6 +1054,7 @@ static void __init universal_machine_init(void)
MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
/* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
.atag_offset = 0x100,
+ .soc = &exynos4_soc_desc,
.init_irq = exynos4_init_irq,
.map_io = universal_map_io,
.handle_irq = gic_handle_irq,
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 0f2035a..9c6e322 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -32,6 +32,8 @@
#include <plat/cpu.h>
+#include "common.h"
+
extern void exynos4_secondary_startup(void);
#define CPU1_BOOT_REG (samsung_rev() == EXYNOS4210_REV_1_1 ? \
@@ -64,7 +66,7 @@ static void __iomem *scu_base_addr(void)
static DEFINE_SPINLOCK(boot_lock);
-void __cpuinit platform_secondary_init(unsigned int cpu)
+static void __cpuinit exynos4_secondary_init(unsigned int cpu)
{
/*
* if any interrupts are already enabled for the primary
@@ -86,7 +88,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
spin_unlock(&boot_lock);
}
-int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+static int __cpuinit exynos4_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
unsigned long timeout;
@@ -161,7 +163,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
* which may be present or become present in the system.
*/
-void __init smp_init_cpus(void)
+static void __init exynos4_smp_init_cpus(void)
{
void __iomem *scu_base = scu_base_addr();
unsigned int i, ncores;
@@ -181,7 +183,7 @@ void __init smp_init_cpus(void)
set_smp_cross_call(gic_raise_softirq);
}
-void __init platform_smp_prepare_cpus(unsigned int max_cpus)
+static void __init exynos4_smp_prepare_cpus(unsigned int max_cpus)
{
scu_enable(scu_base_addr());
@@ -195,3 +197,18 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
__raw_writel(virt_to_phys(exynos4_secondary_startup),
CPU1_BOOT_REG);
}
+
+struct arm_soc_smp_init_ops exynos4_soc_smp_init_ops __initdata = {
+ .smp_init_cpus = exynos4_smp_init_cpus,
+ .smp_prepare_cpus = exynos4_smp_prepare_cpus,
+};
+
+struct arm_soc_smp_ops exynos4_soc_smp_ops __initdata = {
+ .smp_secondary_init = exynos4_secondary_init,
+ .smp_boot_secondary = exynos4_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_kill = exynos4_cpu_kill,
+ .cpu_die = exynos4_cpu_die,
+ .cpu_disable = exynos4_cpu_disable,
+#endif
+};
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 07/15] ARM: SoC: convert MSM SMP to SoC descriptor
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (5 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 06/15] ARM: SoC: convert Exynos4 " Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-08 23:39 ` David Brown
2012-02-08 0:30 ` [PATCH v6 08/15] ARM: SoC: convert ux500 " Marc Zyngier
` (8 subsequent siblings)
15 siblings, 1 reply; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Convert MSM SMP platforms to use the SoC descriptor to provide
their SMP and CPU hotplug operations.
Cc: David Brown <davidb@codeaurora.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-msm/Makefile | 2 +-
arch/arm/mach-msm/board-msm8960.c | 3 +++
arch/arm/mach-msm/board-msm8x60.c | 9 +++++++++
arch/arm/mach-msm/core.c | 17 +++++++++++++++++
arch/arm/mach-msm/core.h | 9 +++++++++
arch/arm/mach-msm/hotplug.c | 8 +++++---
arch/arm/mach-msm/platsmp.c | 24 ++++++++++++++++++++----
7 files changed, 64 insertions(+), 8 deletions(-)
create mode 100644 arch/arm/mach-msm/core.c
create mode 100644 arch/arm/mach-msm/core.h
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 4ad3969..cba9355 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -1,5 +1,5 @@
obj-y += io.o idle.o timer.o
-obj-y += clock.o
+obj-y += clock.o core.o
obj-$(CONFIG_DEBUG_FS) += clock-debug.o
obj-$(CONFIG_MSM_VIC) += irq-vic.o
diff --git a/arch/arm/mach-msm/board-msm8960.c b/arch/arm/mach-msm/board-msm8960.c
index ed35981..bc67bea 100644
--- a/arch/arm/mach-msm/board-msm8960.c
+++ b/arch/arm/mach-msm/board-msm8960.c
@@ -30,6 +30,7 @@
#include <mach/board.h>
#include <mach/msm_iomap.h>
+#include "core.h"
#include "devices.h"
static void __init msm8960_fixup(struct tag *tag, char **cmdline,
@@ -94,6 +95,7 @@ static void __init msm8960_rumi3_init(void)
}
MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
+ .soc = &msm_soc_desc,
.fixup = msm8960_fixup,
.reserve = msm8960_reserve,
.map_io = msm8960_map_io,
@@ -104,6 +106,7 @@ MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
MACHINE_END
MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
+ .soc = &msm_soc_desc,
.fixup = msm8960_fixup,
.reserve = msm8960_reserve,
.map_io = msm8960_map_io,
diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c
index 0a11342..9d89a59 100644
--- a/arch/arm/mach-msm/board-msm8x60.c
+++ b/arch/arm/mach-msm/board-msm8x60.c
@@ -28,6 +28,8 @@
#include <mach/board.h>
#include <mach/msm_iomap.h>
+#include "core.h"
+
static void __init msm8x60_fixup(struct tag *tag, char **cmdline,
struct meminfo *mi)
{
@@ -104,6 +106,7 @@ static const char *msm8x60_fluid_match[] __initdata = {
#endif /* CONFIG_OF */
MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
+ .soc = &msm_soc_desc,
.fixup = msm8x60_fixup,
.reserve = msm8x60_reserve,
.map_io = msm8x60_map_io,
@@ -114,6 +117,7 @@ MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
MACHINE_END
MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
+ .soc = &msm_soc_desc,
.fixup = msm8x60_fixup,
.reserve = msm8x60_reserve,
.map_io = msm8x60_map_io,
@@ -124,6 +128,7 @@ MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
MACHINE_END
MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
+ .soc = &msm_soc_desc,
.fixup = msm8x60_fixup,
.reserve = msm8x60_reserve,
.map_io = msm8x60_map_io,
@@ -134,6 +139,7 @@ MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
MACHINE_END
MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
+ .soc = &msm_soc_desc,
.fixup = msm8x60_fixup,
.reserve = msm8x60_reserve,
.map_io = msm8x60_map_io,
@@ -146,6 +152,9 @@ MACHINE_END
#ifdef CONFIG_OF
/* TODO: General device tree support for all MSM. */
DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
+ .soc = &msm_soc_desc,
+ .fixup = msm8x60_fixup,
+ .reserve = msm8x60_reserve,
.map_io = msm8x60_map_io,
.init_irq = msm8x60_init_irq,
.init_machine = msm8x60_dt_init,
diff --git a/arch/arm/mach-msm/core.c b/arch/arm/mach-msm/core.c
new file mode 100644
index 0000000..390cde7
--- /dev/null
+++ b/arch/arm/mach-msm/core.c
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2011 ARM Ltd.
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include "core.h"
+
+struct arm_soc_desc msm_soc_desc __initdata = {
+ .name = "Qualcomm MSM",
+ soc_smp_init_ops(msm_soc_smp_init_ops)
+ soc_smp_ops(msm_soc_smp_ops)
+};
diff --git a/arch/arm/mach-msm/core.h b/arch/arm/mach-msm/core.h
new file mode 100644
index 0000000..e8394dd
--- /dev/null
+++ b/arch/arm/mach-msm/core.h
@@ -0,0 +1,9 @@
+#include <asm/soc.h>
+
+extern struct arm_soc_smp_init_ops msm_soc_smp_init_ops;
+extern struct arm_soc_smp_ops msm_soc_smp_ops;
+extern struct arm_soc_desc msm_soc_desc;
+
+extern int msm_cpu_kill(unsigned int cpu);
+extern void msm_cpu_die(unsigned int cpu);
+extern int msm_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c
index a446fc1..6ba3602 100644
--- a/arch/arm/mach-msm/hotplug.c
+++ b/arch/arm/mach-msm/hotplug.c
@@ -13,6 +13,8 @@
#include <asm/cacheflush.h>
#include <asm/smp_plat.h>
+#include "core.h"
+
extern volatile int pen_release;
static inline void cpu_enter_lowpower(void)
@@ -57,7 +59,7 @@ static inline void platform_do_lowpower(unsigned int cpu)
}
}
-int platform_cpu_kill(unsigned int cpu)
+int msm_cpu_kill(unsigned int cpu)
{
return 1;
}
@@ -67,7 +69,7 @@ int platform_cpu_kill(unsigned int cpu)
*
* Called with IRQs disabled
*/
-void platform_cpu_die(unsigned int cpu)
+void msm_cpu_die(unsigned int cpu)
{
/*
* we're ready for shutdown now, so do it
@@ -82,7 +84,7 @@ void platform_cpu_die(unsigned int cpu)
cpu_leave_lowpower();
}
-int platform_cpu_disable(unsigned int cpu)
+int msm_cpu_disable(unsigned int cpu)
{
/*
* we don't allow CPU 0 to be shutdown (it is still too special
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
index db0117e..8b56ae1 100644
--- a/arch/arm/mach-msm/platsmp.c
+++ b/arch/arm/mach-msm/platsmp.c
@@ -25,6 +25,7 @@
#include <mach/msm_iomap.h>
#include "scm-boot.h"
+#include "core.h"
#define VDD_SC1_ARRAY_CLAMP_GFS_CTL 0x15A0
#define SCSS_CPU1CORE_RESET 0xD80
@@ -48,7 +49,7 @@ static inline int get_core_count(void)
return ((read_cpuid_id() >> 4) & 3) + 1;
}
-void __cpuinit platform_secondary_init(unsigned int cpu)
+static void __cpuinit msm_secondary_init(unsigned int cpu)
{
/* Configure edge-triggered PPIs */
writel(GIC_PPI_EDGE_MASK, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
@@ -93,7 +94,7 @@ static __cpuinit void prepare_cold_cpu(unsigned int cpu)
"address\n");
}
-int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+static int __cpuinit msm_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
unsigned long timeout;
static int cold_boot_done;
@@ -153,7 +154,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
* does not support the ARM SCU, so just set the possible cpu mask to
* NR_CPUS.
*/
-void __init smp_init_cpus(void)
+static void __init msm_smp_init_cpus(void)
{
unsigned int i, ncores = get_core_count();
@@ -169,6 +170,21 @@ void __init smp_init_cpus(void)
set_smp_cross_call(gic_raise_softirq);
}
-void __init platform_smp_prepare_cpus(unsigned int max_cpus)
+static void __init msm_smp_prepare_cpus(unsigned int max_cpus)
{
}
+
+struct arm_soc_smp_init_ops msm_soc_smp_init_ops __initdata = {
+ .smp_init_cpus = msm_smp_init_cpus,
+ .smp_prepare_cpus = msm_smp_prepare_cpus,
+};
+
+struct arm_soc_smp_ops msm_soc_smp_ops __initdata = {
+ .smp_secondary_init = msm_secondary_init,
+ .smp_boot_secondary = msm_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_kill = msm_cpu_kill,
+ .cpu_die = msm_cpu_die,
+ .cpu_disable = msm_cpu_disable,
+#endif
+};
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 08/15] ARM: SoC: convert ux500 to SoC descriptor
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (6 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 07/15] ARM: SoC: convert MSM SMP " Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-08 22:31 ` Linus Walleij
2012-02-08 0:30 ` [PATCH v6 09/15] ARM: SoC: convert shmobile SMP " Marc Zyngier
` (7 subsequent siblings)
15 siblings, 1 reply; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Convert ux500 platforms to use the SoC descriptor to provide
their SMP and CPU hotplug operations.
Cc: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-ux500/board-mop500.c | 3 +++
arch/arm/mach-ux500/board-u5500.c | 1 +
arch/arm/mach-ux500/cpu.c | 7 ++++++-
arch/arm/mach-ux500/hotplug.c | 8 +++++---
arch/arm/mach-ux500/include/mach/setup.h | 9 +++++++++
arch/arm/mach-ux500/platsmp.c | 23 +++++++++++++++++++----
6 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 5c00712..8780c79 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -692,6 +692,7 @@ static void __init hrefv60_init_machine(void)
MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
/* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
.atag_offset = 0x100,
+ .soc = &ux500_soc_desc,
.map_io = u8500_map_io,
.init_irq = ux500_init_irq,
/* we re-use nomadik timer here */
@@ -702,6 +703,7 @@ MACHINE_END
MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
.atag_offset = 0x100,
+ .soc = &ux500_soc_desc,
.map_io = u8500_map_io,
.init_irq = ux500_init_irq,
.timer = &ux500_timer,
@@ -711,6 +713,7 @@ MACHINE_END
MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
.atag_offset = 0x100,
+ .soc = &ux500_soc_desc,
.map_io = u8500_map_io,
.init_irq = ux500_init_irq,
/* we re-use nomadik timer here */
diff --git a/arch/arm/mach-ux500/board-u5500.c b/arch/arm/mach-ux500/board-u5500.c
index 9de9e9c..47e0c6b 100644
--- a/arch/arm/mach-ux500/board-u5500.c
+++ b/arch/arm/mach-ux500/board-u5500.c
@@ -147,6 +147,7 @@ static void __init u5500_init_machine(void)
MACHINE_START(U5500, "ST-Ericsson U5500 Platform")
.atag_offset = 0x100,
+ .soc = &ux500_soc_desc,
.map_io = u5500_map_io,
.init_irq = ux500_init_irq,
.timer = &ux500_timer,
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index f418574..4fb3cea 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -14,7 +14,6 @@
#include <asm/hardware/gic.h>
#include <asm/mach/map.h>
-#include <asm/localtimer.h>
#include <mach/hardware.h>
#include <mach/setup.h>
@@ -50,3 +49,9 @@ void __init ux500_init_irq(void)
db8500_prcmu_early_init();
clk_init();
}
+
+struct arm_soc_desc ux500_soc_desc __initdata = {
+ .name = "STE Ux500",
+ soc_smp_init_ops(ux500_soc_smp_init_ops)
+ soc_smp_ops(ux500_soc_smp_ops)
+};
diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c
index c76f0f4..ae1a8eb 100644
--- a/arch/arm/mach-ux500/hotplug.c
+++ b/arch/arm/mach-ux500/hotplug.c
@@ -15,6 +15,8 @@
#include <asm/cacheflush.h>
#include <asm/smp_plat.h>
+#include <mach/setup.h>
+
extern volatile int pen_release;
static inline void platform_do_lowpower(unsigned int cpu)
@@ -34,7 +36,7 @@ static inline void platform_do_lowpower(unsigned int cpu)
}
}
-int platform_cpu_kill(unsigned int cpu)
+int ux500_cpu_kill(unsigned int cpu)
{
return 1;
}
@@ -44,13 +46,13 @@ int platform_cpu_kill(unsigned int cpu)
*
* Called with IRQs disabled
*/
-void platform_cpu_die(unsigned int cpu)
+void ux500_cpu_die(unsigned int cpu)
{
/* directly enter low power state, skipping secure registers */
platform_do_lowpower(cpu);
}
-int platform_cpu_disable(unsigned int cpu)
+int ux500_cpu_disable(unsigned int cpu)
{
/*
* we don't allow CPU 0 to be shutdown (it is still too special
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
index a7d363f..e764530 100644
--- a/arch/arm/mach-ux500/include/mach/setup.h
+++ b/arch/arm/mach-ux500/include/mach/setup.h
@@ -11,6 +11,7 @@
#ifndef __ASM_ARCH_SETUP_H
#define __ASM_ARCH_SETUP_H
+#include <asm/soc.h>
#include <asm/mach/time.h>
#include <linux/init.h>
@@ -50,4 +51,12 @@ extern struct sys_timer ux500_timer;
.type = MT_MEMORY, \
}
+extern struct arm_soc_smp_init_ops ux500_soc_smp_init_ops;
+extern struct arm_soc_smp_ops ux500_soc_smp_ops;
+extern struct arm_soc_desc ux500_soc_desc;
+
+extern int ux500_cpu_kill(unsigned int cpu);
+extern void ux500_cpu_die(unsigned int cpu);
+extern int ux500_cpu_disable(unsigned int cpu);
+
#endif /* __ASM_ARCH_SETUP_H */
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index d2058ef..fc72ce1 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -60,7 +60,7 @@ static void __iomem *scu_base_addr(void)
static DEFINE_SPINLOCK(boot_lock);
-void __cpuinit platform_secondary_init(unsigned int cpu)
+static void __cpuinit ux500_secondary_init(unsigned int cpu)
{
/*
* if any interrupts are already enabled for the primary
@@ -82,7 +82,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
spin_unlock(&boot_lock);
}
-int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+static int __cpuinit ux500_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
unsigned long timeout;
@@ -149,7 +149,7 @@ static void __init wakeup_secondary(void)
* Initialise the CPU possible map early - this describes the CPUs
* which may be present or become present in the system.
*/
-void __init smp_init_cpus(void)
+static void __init ux500_smp_init_cpus(void)
{
void __iomem *scu_base = scu_base_addr();
unsigned int i, ncores;
@@ -169,9 +169,24 @@ void __init smp_init_cpus(void)
set_smp_cross_call(gic_raise_softirq);
}
-void __init platform_smp_prepare_cpus(unsigned int max_cpus)
+static void __init ux500_smp_prepare_cpus(unsigned int max_cpus)
{
scu_enable(scu_base_addr());
wakeup_secondary();
}
+
+struct arm_soc_smp_init_ops ux500_soc_smp_init_ops __initdata = {
+ .smp_init_cpus = ux500_smp_init_cpus,
+ .smp_prepare_cpus = ux500_smp_prepare_cpus,
+};
+
+struct arm_soc_smp_ops ux500_soc_smp_ops __initdata = {
+ .smp_secondary_init = ux500_secondary_init,
+ .smp_boot_secondary = ux500_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_kill = ux500_cpu_kill,
+ .cpu_die = ux500_cpu_die,
+ .cpu_disable = ux500_cpu_disable,
+#endif
+};
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 09/15] ARM: SoC: convert shmobile SMP to SoC descriptor
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (7 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 08/15] ARM: SoC: convert ux500 " Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 10/15] ARM: SoC: convert highbank " Marc Zyngier
` (6 subsequent siblings)
15 siblings, 0 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Convert shmobile SMP platforms to use the SoC descriptor to provide
their SMP and CPU hotplug operations.
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Magnus Damm <magnus.damm@gmail.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-shmobile/Makefile | 2 +-
arch/arm/mach-shmobile/board-ag5evm.c | 1 +
arch/arm/mach-shmobile/board-kota2.c | 1 +
arch/arm/mach-shmobile/board-marzen.c | 1 +
arch/arm/mach-shmobile/hotplug.c | 13 +++-
arch/arm/mach-shmobile/include/mach/common.h | 14 +---
arch/arm/mach-shmobile/include/mach/r8a7779.h | 6 ++
arch/arm/mach-shmobile/include/mach/sh73a0.h | 6 ++
arch/arm/mach-shmobile/platsmp.c | 97 -------------------------
arch/arm/mach-shmobile/setup-r8a7779.c | 6 ++
arch/arm/mach-shmobile/setup-sh73a0.c | 6 ++
arch/arm/mach-shmobile/smp-r8a7779.c | 40 +++++++++-
arch/arm/mach-shmobile/smp-sh73a0.c | 41 ++++++++++-
13 files changed, 114 insertions(+), 120 deletions(-)
delete mode 100644 arch/arm/mach-shmobile/platsmp.c
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 7ad6954..b6dbffa 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -14,7 +14,7 @@ obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o clock-r8a7740.o intc-r8a7740.o
obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o clock-r8a7779.o intc-r8a7779.o
# SMP objects
-smp-y := platsmp.o headsmp.o
+smp-y := headsmp.o
smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o
smp-$(CONFIG_LOCAL_TIMERS) += localtimer.o
smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index eff8a96..55c8e03 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -633,6 +633,7 @@ struct sys_timer ag5evm_timer = {
};
MACHINE_START(AG5EVM, "ag5evm")
+ .soc = &sh73a0_soc_desc,
.map_io = ag5evm_map_io,
.nr_irqs = NR_IRQS_LEGACY,
.init_irq = sh73a0_init_irq,
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c
index 857ceee..200aaef 100644
--- a/arch/arm/mach-shmobile/board-kota2.c
+++ b/arch/arm/mach-shmobile/board-kota2.c
@@ -548,6 +548,7 @@ struct sys_timer kota2_timer = {
};
MACHINE_START(KOTA2, "kota2")
+ .soc = &sh73a0_soc_desc,
.map_io = kota2_map_io,
.nr_irqs = NR_IRQS_LEGACY,
.init_irq = sh73a0_init_irq,
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index f0e02c0..a244d32 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -147,6 +147,7 @@ struct sys_timer marzen_timer = {
};
MACHINE_START(MARZEN, "marzen")
+ .soc = &r8a7779_soc_desc,
.map_io = marzen_map_io,
.init_early = marzen_init_early,
.nr_irqs = NR_IRQS_LEGACY,
diff --git a/arch/arm/mach-shmobile/hotplug.c b/arch/arm/mach-shmobile/hotplug.c
index 828d22f..d191582 100644
--- a/arch/arm/mach-shmobile/hotplug.c
+++ b/arch/arm/mach-shmobile/hotplug.c
@@ -16,10 +16,15 @@
#include <linux/delay.h>
#include <mach/common.h>
#include <asm/cacheflush.h>
+#include <asm/mach-types.h>
static cpumask_t dead_cpus;
-int platform_cpu_kill(unsigned int cpu)
+#include <mach/common.h>
+
+#define is_r8a7779() machine_is_marzen()
+
+int shmobile_cpu_kill(unsigned int cpu)
{
int k;
@@ -29,7 +34,7 @@ int platform_cpu_kill(unsigned int cpu)
*/
for (k = 0; k < 1000; k++) {
if (cpumask_test_cpu(cpu, &dead_cpus))
- return shmobile_platform_cpu_kill(cpu);
+ return is_r8a7779() ? r8a7779_platform_cpu_kill(cpu) : 1;
mdelay(1);
}
@@ -37,7 +42,7 @@ int platform_cpu_kill(unsigned int cpu)
return 0;
}
-void platform_cpu_die(unsigned int cpu)
+void shmobile_cpu_die(unsigned int cpu)
{
/* hardware shutdown code running on the CPU that is being offlined */
flush_cache_all();
@@ -60,7 +65,7 @@ void platform_cpu_die(unsigned int cpu)
}
}
-int platform_cpu_disable(unsigned int cpu)
+int shmobile_cpu_disable(unsigned int cpu)
{
cpumask_clear_cpu(cpu, &dead_cpus);
/*
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index e4b945e..a152503 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -4,7 +4,6 @@
extern struct sys_timer shmobile_timer;
extern void shmobile_setup_console(void);
extern void shmobile_secondary_vector(void);
-extern int shmobile_platform_cpu_kill(unsigned int cpu);
struct clk;
extern int clk_init(void);
extern void shmobile_handle_irq_intc(struct pt_regs *);
@@ -50,11 +49,6 @@ extern struct clk sh73a0_extal2_clk;
extern struct clk sh73a0_extcki_clk;
extern struct clk sh73a0_extalr_clk;
-extern unsigned int sh73a0_get_core_count(void);
-extern void sh73a0_secondary_init(unsigned int cpu);
-extern int sh73a0_boot_secondary(unsigned int cpu);
-extern void sh73a0_smp_prepare_cpus(void);
-
extern void r8a7740_init_irq(void);
extern void r8a7740_add_early_devices(void);
extern void r8a7740_add_standard_devices(void);
@@ -68,10 +62,10 @@ extern void r8a7779_clock_init(void);
extern void r8a7779_pinmux_init(void);
extern void r8a7779_pm_init(void);
-extern unsigned int r8a7779_get_core_count(void);
extern int r8a7779_platform_cpu_kill(unsigned int cpu);
-extern void r8a7779_secondary_init(unsigned int cpu);
-extern int r8a7779_boot_secondary(unsigned int cpu);
-extern void r8a7779_smp_prepare_cpus(void);
+
+extern int shmobile_cpu_kill(unsigned int cpu);
+extern void shmobile_cpu_die(unsigned int cpu);
+extern int shmobile_cpu_disable(unsigned int cpu);
#endif /* __ARCH_MACH_COMMON_H */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
index b07ad31..0f67b4f 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -360,4 +360,10 @@ extern void r8a7779_add_device_to_domain(struct r8a7779_pm_domain *r8a7779_pd,
#define r8a7779_add_device_to_domain(pd, pdev) do { } while (0)
#endif /* CONFIG_PM */
+#include <asm/soc.h>
+
+extern struct arm_soc_smp_init_ops r8a7779_soc_smp_init_ops;
+extern struct arm_soc_smp_ops r8a7779_soc_smp_ops;
+extern struct arm_soc_desc r8a7779_soc_desc;
+
#endif /* __ASM_R8A7779_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/include/mach/sh73a0.h
index 881d515..4aeb692 100644
--- a/arch/arm/mach-shmobile/include/mach/sh73a0.h
+++ b/arch/arm/mach-shmobile/include/mach/sh73a0.h
@@ -519,4 +519,10 @@ enum {
#define SH73A0_PINT0_IRQ(irq) ((irq) + 768)
#define SH73A0_PINT1_IRQ(irq) ((irq) + 800)
+#include <asm/soc.h>
+
+extern struct arm_soc_smp_init_ops sh73a0_soc_smp_init_ops;
+extern struct arm_soc_smp_ops sh73a0_soc_smp_ops;
+extern struct arm_soc_desc sh73a0_soc_desc;
+
#endif /* __ASM_SH73A0_H__ */
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
deleted file mode 100644
index 9933812..0000000
--- a/arch/arm/mach-shmobile/platsmp.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * SMP support for R-Mobile / SH-Mobile
- *
- * Copyright (C) 2010 Magnus Damm
- * Copyright (C) 2011 Paul Mundt
- *
- * Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/delay.h>
-#include <linux/device.h>
-#include <linux/smp.h>
-#include <linux/io.h>
-#include <asm/hardware/gic.h>
-#include <asm/localtimer.h>
-#include <asm/mach-types.h>
-#include <mach/common.h>
-
-#define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2())
-#define is_r8a7779() machine_is_marzen()
-
-static unsigned int __init shmobile_smp_get_core_count(void)
-{
- if (is_sh73a0())
- return sh73a0_get_core_count();
-
- if (is_r8a7779())
- return r8a7779_get_core_count();
-
- return 1;
-}
-
-static void __init shmobile_smp_prepare_cpus(void)
-{
- if (is_sh73a0())
- sh73a0_smp_prepare_cpus();
-
- if (is_r8a7779())
- r8a7779_smp_prepare_cpus();
-}
-
-int shmobile_platform_cpu_kill(unsigned int cpu)
-{
- if (is_r8a7779())
- return r8a7779_platform_cpu_kill(cpu);
-
- return 1;
-}
-
-void __cpuinit platform_secondary_init(unsigned int cpu)
-{
- trace_hardirqs_off();
-
- if (is_sh73a0())
- sh73a0_secondary_init(cpu);
-
- if (is_r8a7779())
- r8a7779_secondary_init(cpu);
-}
-
-int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
-{
- if (is_sh73a0())
- return sh73a0_boot_secondary(cpu);
-
- if (is_r8a7779())
- return r8a7779_boot_secondary(cpu);
-
- return -ENOSYS;
-}
-
-void __init smp_init_cpus(void)
-{
- unsigned int ncores = shmobile_smp_get_core_count();
- unsigned int i;
-
- if (ncores > nr_cpu_ids) {
- pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
- ncores, nr_cpu_ids);
- ncores = nr_cpu_ids;
- }
-
- for (i = 0; i < ncores; i++)
- set_cpu_possible(i, true);
-
- set_smp_cross_call(gic_raise_softirq);
-}
-
-void __init platform_smp_prepare_cpus(unsigned int max_cpus)
-{
- shmobile_smp_prepare_cpus();
-}
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 4725663..7f8b9e3 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -237,3 +237,9 @@ void __init r8a7779_add_early_devices(void)
early_platform_add_devices(r8a7779_early_devices,
ARRAY_SIZE(r8a7779_early_devices));
}
+
+struct arm_soc_desc r8a7779_soc_desc __initdata = {
+ .name = "Renesas r8a7779",
+ soc_smp_init_ops(r8a7779_soc_smp_init_ops)
+ soc_smp_ops(r8a7779_soc_smp_ops)
+};
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 20e71e5..3bb9bdd 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -672,3 +672,9 @@ void __init sh73a0_add_early_devices(void)
early_platform_add_devices(sh73a0_early_devices,
ARRAY_SIZE(sh73a0_early_devices));
}
+
+struct arm_soc_desc sh73a0_soc_desc __initdata = {
+ .name = "Renesas sh73a0",
+ soc_smp_init_ops(sh73a0_soc_smp_init_ops)
+ soc_smp_ops(sh73a0_soc_smp_ops)
+};
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 4fe2e9e..49610ba 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -78,7 +78,7 @@ static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
__raw_writel(tmp, scu_base + 8);
}
-unsigned int __init r8a7779_get_core_count(void)
+static unsigned int __init r8a7779_get_core_count(void)
{
void __iomem *scu_base = scu_base_addr();
@@ -109,12 +109,12 @@ int r8a7779_platform_cpu_kill(unsigned int cpu)
return ret ? ret : 1;
}
-void __cpuinit r8a7779_secondary_init(unsigned int cpu)
+static void __cpuinit r8a7779_secondary_init(unsigned int cpu)
{
gic_secondary_init(0);
}
-int __cpuinit r8a7779_boot_secondary(unsigned int cpu)
+static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
struct r8a7779_pm_ch *ch = NULL;
int ret = -EIO;
@@ -133,7 +133,7 @@ int __cpuinit r8a7779_boot_secondary(unsigned int cpu)
return ret;
}
-void __init r8a7779_smp_prepare_cpus(void)
+static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus)
{
int cpu = cpu_logical_map(0);
@@ -152,3 +152,35 @@ void __init r8a7779_smp_prepare_cpus(void)
r8a7779_platform_cpu_kill(2);
r8a7779_platform_cpu_kill(3);
}
+
+static void __init r8a7779_smp_init_cpus(void)
+{
+ unsigned int ncores = r8a7779_get_core_count();
+ unsigned int i;
+
+ if (ncores > nr_cpu_ids) {
+ pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
+ ncores, nr_cpu_ids);
+ ncores = nr_cpu_ids;
+ }
+
+ for (i = 0; i < ncores; i++)
+ set_cpu_possible(i, true);
+
+ set_smp_cross_call(gic_raise_softirq);
+}
+
+struct arm_soc_smp_init_ops r8a7779_soc_smp_init_ops __initdata = {
+ .smp_init_cpus = r8a7779_smp_init_cpus,
+ .smp_prepare_cpus = r8a7779_smp_prepare_cpus,
+};
+
+struct arm_soc_smp_ops r8a7779_soc_smp_ops __initdata = {
+ .smp_secondary_init = r8a7779_secondary_init,
+ .smp_boot_secondary = r8a7779_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_kill = shmobile_cpu_kill,
+ .cpu_die = shmobile_cpu_die,
+ .cpu_disable = shmobile_cpu_disable,
+#endif
+};
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 0d159d6..8b16e25 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -23,6 +23,7 @@
#include <linux/spinlock.h>
#include <linux/io.h>
#include <mach/common.h>
+#include <mach/sh73a0.h>
#include <asm/smp_plat.h>
#include <asm/smp_scu.h>
#include <asm/smp_twd.h>
@@ -56,7 +57,7 @@ static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
__raw_writel(tmp, scu_base + 8);
}
-unsigned int __init sh73a0_get_core_count(void)
+static unsigned int __init sh73a0_get_core_count(void)
{
void __iomem *scu_base = scu_base_addr();
@@ -68,12 +69,12 @@ unsigned int __init sh73a0_get_core_count(void)
return scu_get_core_count(scu_base);
}
-void __cpuinit sh73a0_secondary_init(unsigned int cpu)
+static void __cpuinit sh73a0_secondary_init(unsigned int cpu)
{
gic_secondary_init(0);
}
-int __cpuinit sh73a0_boot_secondary(unsigned int cpu)
+static int __cpuinit sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
cpu = cpu_logical_map(cpu);
@@ -88,7 +89,7 @@ int __cpuinit sh73a0_boot_secondary(unsigned int cpu)
return 0;
}
-void __init sh73a0_smp_prepare_cpus(void)
+static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus)
{
int cpu = cpu_logical_map(0);
@@ -101,3 +102,35 @@ void __init sh73a0_smp_prepare_cpus(void)
/* enable cache coherency on CPU0 */
modify_scu_cpu_psr(0, 3 << (cpu * 8));
}
+
+static void __init sh73a0_smp_init_cpus(void)
+{
+ unsigned int ncores = sh73a0_get_core_count();
+ unsigned int i;
+
+ if (ncores > nr_cpu_ids) {
+ pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
+ ncores, nr_cpu_ids);
+ ncores = nr_cpu_ids;
+ }
+
+ for (i = 0; i < ncores; i++)
+ set_cpu_possible(i, true);
+
+ set_smp_cross_call(gic_raise_softirq);
+}
+
+struct arm_soc_smp_init_ops sh73a0_soc_smp_init_ops __initdata = {
+ .smp_init_cpus = sh73a0_smp_init_cpus,
+ .smp_prepare_cpus = sh73a0_smp_prepare_cpus,
+};
+
+struct arm_soc_smp_ops sh73a0_soc_smp_ops __initdata = {
+ .smp_secondary_init = sh73a0_secondary_init,
+ .smp_boot_secondary = sh73a0_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_kill = shmobile_cpu_kill,
+ .cpu_die = shmobile_cpu_die,
+ .cpu_disable = shmobile_cpu_disable,
+#endif
+};
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 10/15] ARM: SoC: convert highbank to SoC descriptor
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (8 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 09/15] ARM: SoC: convert shmobile SMP " Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 11/15] ARM: SoC: convert imx6q " Marc Zyngier
` (5 subsequent siblings)
15 siblings, 0 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Convert the highbank platform to use the SoC descriptor to provide
its SMP and CPU hotplug operations.
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-highbank/core.h | 8 ++++++++
arch/arm/mach-highbank/highbank.c | 7 +++++++
arch/arm/mach-highbank/hotplug.c | 6 +++---
arch/arm/mach-highbank/platsmp.c | 23 +++++++++++++++++++----
4 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-highbank/core.h b/arch/arm/mach-highbank/core.h
index d8e2d0b..d1fd356 100644
--- a/arch/arm/mach-highbank/core.h
+++ b/arch/arm/mach-highbank/core.h
@@ -1,3 +1,5 @@
+#include <asm/soc.h>
+
extern void highbank_set_cpu_jump(int cpu, void *jump_addr);
extern void highbank_clocks_init(void);
extern void highbank_restart(char, const char *);
@@ -8,3 +10,9 @@ extern void highbank_lluart_map_io(void);
static inline void highbank_lluart_map_io(void) {}
#endif
+extern int highbank_cpu_kill(unsigned int cpu);
+extern void highbank_cpu_die(unsigned int cpu);
+extern int highbank_cpu_disable(unsigned int cpu);
+
+extern struct arm_soc_smp_init_ops highbank_soc_smp_init_ops;
+extern struct arm_soc_smp_ops highbank_soc_smp_ops;
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 8394d51..1a6a704 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -138,7 +138,14 @@ static const char *highbank_match[] __initconst = {
NULL,
};
+static struct arm_soc_desc highbank_soc_desc __initdata = {
+ .name = "Calxeda Highbank",
+ soc_smp_init_ops(highbank_soc_smp_init_ops)
+ soc_smp_ops(highbank_soc_smp_ops)
+};
+
DT_MACHINE_START(HIGHBANK, "Highbank")
+ .soc = &highbank_soc_desc,
.map_io = highbank_map_io,
.init_irq = highbank_init_irq,
.timer = &highbank_timer,
diff --git a/arch/arm/mach-highbank/hotplug.c b/arch/arm/mach-highbank/hotplug.c
index 977cebb..7c25d49 100644
--- a/arch/arm/mach-highbank/hotplug.c
+++ b/arch/arm/mach-highbank/hotplug.c
@@ -24,7 +24,7 @@
extern void secondary_startup(void);
-int platform_cpu_kill(unsigned int cpu)
+int highbank_cpu_kill(unsigned int cpu)
{
return 1;
}
@@ -33,7 +33,7 @@ int platform_cpu_kill(unsigned int cpu)
* platform-specific code to shutdown a CPU
*
*/
-void platform_cpu_die(unsigned int cpu)
+void highbank_cpu_die(unsigned int cpu)
{
flush_cache_all();
@@ -46,7 +46,7 @@ void platform_cpu_die(unsigned int cpu)
panic("highbank: cpu %d unexpectedly exit from shutdown\n", cpu);
}
-int platform_cpu_disable(unsigned int cpu)
+int highbank_cpu_disable(unsigned int cpu)
{
/*
* CPU0 should not be shut down via hotplug. cpu_idle can WFI
diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c
index d01364c..24162a7 100644
--- a/arch/arm/mach-highbank/platsmp.c
+++ b/arch/arm/mach-highbank/platsmp.c
@@ -25,12 +25,12 @@
extern void secondary_startup(void);
-void __cpuinit platform_secondary_init(unsigned int cpu)
+static void __cpuinit highbank_secondary_init(unsigned int cpu)
{
gic_secondary_init(0);
}
-int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+static int __cpuinit highbank_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
gic_raise_softirq(cpumask_of(cpu), 0);
return 0;
@@ -40,7 +40,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
* Initialise the CPU possible map early - this describes the CPUs
* which may be present or become present in the system.
*/
-void __init smp_init_cpus(void)
+static void __init highbank_smp_init_cpus(void)
{
unsigned int i, ncores;
@@ -61,7 +61,7 @@ void __init smp_init_cpus(void)
set_smp_cross_call(gic_raise_softirq);
}
-void __init platform_smp_prepare_cpus(unsigned int max_cpus)
+static void __init highbank_smp_prepare_cpus(unsigned int max_cpus)
{
int i;
@@ -76,3 +76,18 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
for (i = 1; i < max_cpus; i++)
highbank_set_cpu_jump(i, secondary_startup);
}
+
+struct arm_soc_smp_init_ops highbank_soc_smp_init_ops __initdata = {
+ .smp_init_cpus = highbank_smp_init_cpus,
+ .smp_prepare_cpus = highbank_smp_prepare_cpus,
+};
+
+struct arm_soc_smp_ops highbank_soc_smp_ops __initdata = {
+ .smp_secondary_init = highbank_secondary_init,
+ .smp_boot_secondary = highbank_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_kill = highbank_cpu_kill,
+ .cpu_die = highbank_cpu_die,
+ .cpu_disable = highbank_cpu_disable,
+#endif
+};
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 11/15] ARM: SoC: convert imx6q to SoC descriptor
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (9 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 10/15] ARM: SoC: convert highbank " Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-11 3:32 ` Shawn Guo
2012-02-08 0:30 ` [PATCH v6 12/15] ARM: smp: Make SoC descriptor mandatory for SMP platforms Marc Zyngier
` (4 subsequent siblings)
15 siblings, 1 reply; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Convert the imx6q platform to use the SoC descriptor to provide
its SMP and CPU hotplug operations.
Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-imx/hotplug.c | 6 +++---
arch/arm/mach-imx/mach-imx6q.c | 8 ++++++++
arch/arm/mach-imx/platsmp.c | 24 ++++++++++++++++++++----
arch/arm/plat-mxc/include/mach/common.h | 10 ++++++++++
4 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
index 89493ab..474b11d 100644
--- a/arch/arm/mach-imx/hotplug.c
+++ b/arch/arm/mach-imx/hotplug.c
@@ -14,7 +14,7 @@
#include <asm/cacheflush.h>
#include <mach/common.h>
-int platform_cpu_kill(unsigned int cpu)
+int imx_cpu_kill(unsigned int cpu)
{
return 1;
}
@@ -24,7 +24,7 @@ int platform_cpu_kill(unsigned int cpu)
*
* Called with IRQs disabled
*/
-void platform_cpu_die(unsigned int cpu)
+void imx_cpu_die(unsigned int cpu)
{
flush_cache_all();
imx_enable_cpu(cpu, false);
@@ -34,7 +34,7 @@ void platform_cpu_die(unsigned int cpu)
panic("cpu %d unexpectedly exit from shutdown\n", cpu);
}
-int platform_cpu_disable(unsigned int cpu)
+int imx_cpu_disable(unsigned int cpu)
{
/*
* we don't allow CPU 0 to be shutdown (it is still too special
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index c257281..2657df1 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -21,6 +21,7 @@
#include <linux/of_platform.h>
#include <linux/phy.h>
#include <linux/micrel_phy.h>
+#include <asm/soc.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/hardware/gic.h>
#include <asm/mach/arch.h>
@@ -131,7 +132,14 @@ static const char *imx6q_dt_compat[] __initdata = {
NULL,
};
+static struct arm_soc_desc imx6q_soc_desc __initdata = {
+ .name = "Freescale i.MX6 Quad",
+ soc_smp_init_ops(imx_soc_smp_init_ops)
+ soc_smp_ops(imx_soc_smp_ops)
+};
+
DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad (Device Tree)")
+ .soc = &imx6q_soc_desc,
.map_io = imx6q_map_io,
.init_irq = imx6q_init_irq,
.handle_irq = imx6q_handle_irq,
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index ab98c6f..ae55931 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -14,6 +14,7 @@
#include <linux/smp.h>
#include <asm/page.h>
#include <asm/smp_scu.h>
+#include <asm/soc.h>
#include <asm/hardware/gic.h>
#include <asm/mach/map.h>
#include <mach/common.h>
@@ -41,7 +42,7 @@ void __init imx_scu_map_io(void)
scu_base = IMX_IO_ADDRESS(base);
}
-void __cpuinit platform_secondary_init(unsigned int cpu)
+static void __cpuinit imx_secondary_init(unsigned int cpu)
{
/*
* if any interrupts are already enabled for the primary
@@ -51,7 +52,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
gic_secondary_init(0);
}
-int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+static int __cpuinit imx_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
imx_set_cpu_jump(cpu, v7_secondary_startup);
imx_enable_cpu(cpu, true);
@@ -62,7 +63,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
* Initialise the CPU possible map early - this describes the CPUs
* which may be present or become present in the system.
*/
-void __init smp_init_cpus(void)
+static void __init imx_smp_init_cpus(void)
{
int i, ncores;
@@ -79,7 +80,22 @@ void imx_smp_prepare(void)
scu_enable(scu_base);
}
-void __init platform_smp_prepare_cpus(unsigned int max_cpus)
+static void __init imx_smp_prepare_cpus(unsigned int max_cpus)
{
imx_smp_prepare();
}
+
+struct arm_soc_smp_init_ops imx_soc_smp_init_ops __initdata = {
+ .smp_init_cpus = imx_smp_init_cpus,
+ .smp_prepare_cpus = imx_smp_prepare_cpus,
+};
+
+struct arm_soc_smp_ops imx_soc_smp_ops __initdata = {
+ .smp_secondary_init = imx_secondary_init,
+ .smp_boot_secondary = imx_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_kill = imx_cpu_kill,
+ .cpu_die = imx_cpu_die,
+ .cpu_disable = imx_cpu_disable,
+#endif
+};
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index 1bf0df8..99c7978 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -133,10 +133,20 @@ extern void imx53_smd_common_init(void);
extern int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode);
extern void imx6q_clock_map_io(void);
+extern int imx_cpu_kill(unsigned int cpu);
+extern void imx_cpu_die(unsigned int cpu);
+extern int imx_cpu_disable(unsigned int cpu);
+
#ifdef CONFIG_PM
extern void imx6q_pm_init(void);
#else
static inline void imx6q_pm_init(void) {}
#endif
+struct arm_soc_smp_init_ops;
+struct arm_soc_smp_ops;
+
+extern struct arm_soc_smp_init_ops imx_soc_smp_init_ops;
+extern struct arm_soc_smp_ops imx_soc_smp_ops;
+
#endif
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 12/15] ARM: smp: Make SoC descriptor mandatory for SMP platforms
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (10 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 11/15] ARM: SoC: convert imx6q " Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 13/15] ARM: hotplug: Introduce dummy_cpu_kill Marc Zyngier
` (3 subsequent siblings)
15 siblings, 0 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Now that all SMP platforms have been converted to the SOC descriptor
and its SMP operations, remove the "weak" attribute from the hooks
in smp.c, and make the functions static wherever possible.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/include/asm/smp.h | 15 ---------------
arch/arm/kernel/smp.c | 18 +++++++++---------
2 files changed, 9 insertions(+), 24 deletions(-)
diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index ae29293..13753fa 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -61,16 +61,6 @@ extern int boot_secondary(unsigned int cpu, struct task_struct *);
asmlinkage void secondary_start_kernel(void);
/*
- * Perform platform specific initialisation of the specified CPU.
- */
-extern void platform_secondary_init(unsigned int cpu);
-
-/*
- * Initialize cpu_possible map, and enable coherency
- */
-extern void platform_smp_prepare_cpus(unsigned int);
-
-/*
* Initial data for bringing up a secondary CPU.
*/
struct secondary_data {
@@ -81,15 +71,10 @@ struct secondary_data {
extern struct secondary_data secondary_data;
extern int __cpu_disable(void);
-extern int platform_cpu_disable(unsigned int cpu);
extern void __cpu_die(unsigned int cpu);
extern void cpu_die(void);
-extern void platform_cpu_die(unsigned int cpu);
-extern int platform_cpu_kill(unsigned int cpu);
-extern void platform_cpu_enable(unsigned int cpu);
-
extern void arch_send_call_function_single_ipi(int cpu);
extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 49a904d..5321909 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -151,25 +151,25 @@ void __init soc_smp_ops_register(struct arm_soc_smp_init_ops *smp_init_ops,
}
}
-void __attribute__((weak)) __init smp_init_cpus(void)
+void __init smp_init_cpus(void)
{
if (soc_smp_init_ops && soc_smp_init_ops->smp_init_cpus)
soc_smp_init_ops->smp_init_cpus();
}
-void __attribute__((weak)) __init platform_smp_prepare_cpus(unsigned int max_cpus)
+static void __init platform_smp_prepare_cpus(unsigned int max_cpus)
{
if (soc_smp_ops && soc_smp_init_ops->smp_prepare_cpus)
soc_smp_init_ops->smp_prepare_cpus(max_cpus);
}
-void __attribute__((weak)) __cpuinit platform_secondary_init(unsigned int cpu)
+static void __cpuinit platform_secondary_init(unsigned int cpu)
{
if (soc_smp_ops && soc_smp_ops->smp_secondary_init)
soc_smp_ops->smp_secondary_init(cpu);
}
-int __attribute__((weak)) __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
{
if (soc_smp_ops && soc_smp_ops->smp_boot_secondary)
return soc_smp_ops->smp_boot_secondary(cpu, idle);
@@ -179,20 +179,20 @@ int __attribute__((weak)) __cpuinit boot_secondary(unsigned int cpu, struct task
#ifdef CONFIG_HOTPLUG_CPU
static void percpu_timer_stop(void);
-int __attribute__((weak)) __cpuinit platform_cpu_kill(unsigned int cpu)
+static int __cpuinit platform_cpu_kill(unsigned int cpu)
{
if (soc_smp_ops && soc_smp_ops->cpu_kill)
return soc_smp_ops->cpu_kill(cpu);
return 0;
}
-void __attribute__((weak)) __cpuinit platform_cpu_die(unsigned int cpu)
+static void __cpuinit platform_cpu_die(unsigned int cpu)
{
if (soc_smp_ops && soc_smp_ops->cpu_die)
soc_smp_ops->cpu_die(cpu);
}
-int __attribute__((weak)) __cpuinit platform_cpu_disable(unsigned int cpu)
+static int __cpuinit platform_cpu_disable(unsigned int cpu)
{
if (soc_smp_ops && soc_smp_ops->cpu_disable)
return soc_smp_ops->cpu_disable(cpu);
@@ -202,7 +202,7 @@ int __attribute__((weak)) __cpuinit platform_cpu_disable(unsigned int cpu)
/*
* __cpu_disable runs on the processor to be shutdown.
*/
-int __cpu_disable(void)
+int __cpuinit __cpu_disable(void)
{
unsigned int cpu = smp_processor_id();
struct task_struct *p;
@@ -251,7 +251,7 @@ static DECLARE_COMPLETION(cpu_died);
* called on the thread which is asking for a CPU to be shutdown -
* waits until shutdown has completed, or it is timed out.
*/
-void __cpu_die(unsigned int cpu)
+void __cpuinit __cpu_die(unsigned int cpu)
{
if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
pr_err("CPU%u: cpu didn't die\n", cpu);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 13/15] ARM: hotplug: Introduce dummy_cpu_kill
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (11 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 12/15] ARM: smp: Make SoC descriptor mandatory for SMP platforms Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-09 0:16 ` Nicolas Pitre
2012-02-08 0:30 ` [PATCH v6 14/15] ARM: hotplug: Introduce dummy_cpu_disable Marc Zyngier
` (2 subsequent siblings)
15 siblings, 1 reply; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Most platforms don't implement their cpu_kill method.
Some because they simply don't offer the capability, some other
because nobody cared enough to implement the necessary code.
Either way, this code is duplicated all over the place. Implement
a global dummy_cpu_kill method and convert all SMP (but shmobile)
to use it. Hopefully the "dummy" prefix will be an incentive
for people to do the right thing.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Colin Cross <ccross@android.com>
Cc: David Brown <davidb@codeaurora.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/include/asm/smp_plat.h | 3 +++
arch/arm/kernel/smp.c | 5 +++++
arch/arm/mach-exynos/common.h | 1 -
arch/arm/mach-exynos/hotplug.c | 5 -----
arch/arm/mach-exynos/platsmp.c | 2 +-
arch/arm/mach-highbank/core.h | 1 -
arch/arm/mach-highbank/hotplug.c | 5 -----
arch/arm/mach-highbank/platsmp.c | 3 ++-
arch/arm/mach-imx/hotplug.c | 5 -----
arch/arm/mach-imx/platsmp.c | 3 ++-
arch/arm/mach-msm/core.h | 1 -
arch/arm/mach-msm/hotplug.c | 5 -----
arch/arm/mach-msm/platsmp.c | 2 +-
arch/arm/mach-omap2/common.h | 1 -
arch/arm/mach-omap2/omap-hotplug.c | 5 -----
arch/arm/mach-omap2/omap-smp.c | 3 ++-
arch/arm/mach-realview/core.h | 1 -
arch/arm/mach-realview/hotplug.c | 5 -----
arch/arm/mach-realview/platsmp.c | 3 ++-
arch/arm/mach-tegra/common.h | 1 -
arch/arm/mach-tegra/hotplug.c | 5 -----
arch/arm/mach-tegra/platsmp.c | 3 ++-
arch/arm/mach-ux500/hotplug.c | 5 -----
arch/arm/mach-ux500/include/mach/setup.h | 1 -
arch/arm/mach-ux500/platsmp.c | 2 +-
arch/arm/mach-vexpress/core.h | 1 -
arch/arm/mach-vexpress/hotplug.c | 5 -----
arch/arm/mach-vexpress/platsmp.c | 3 ++-
arch/arm/plat-mxc/include/mach/common.h | 1 -
29 files changed, 23 insertions(+), 63 deletions(-)
diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h
index 558d6c8..8b2ffe2 100644
--- a/arch/arm/include/asm/smp_plat.h
+++ b/arch/arm/include/asm/smp_plat.h
@@ -49,4 +49,7 @@ static inline int cache_ops_need_broadcast(void)
extern int __cpu_logical_map[];
#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
+/* Only use this if your platform doesn't have any CPU PM */
+extern int dummy_cpu_kill(unsigned int cpu);
+
#endif
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 5321909..eabd6b8 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -179,6 +179,11 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
#ifdef CONFIG_HOTPLUG_CPU
static void percpu_timer_stop(void);
+int dummy_cpu_kill(unsigned int cpu)
+{
+ return 1;
+}
+
static int __cpuinit platform_cpu_kill(unsigned int cpu)
{
if (soc_smp_ops && soc_smp_ops->cpu_kill)
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index cd37455..9046df8 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -31,7 +31,6 @@ extern struct arm_soc_smp_init_ops exynos4_soc_smp_init_ops;
extern struct arm_soc_smp_ops exynos4_soc_smp_ops;
extern struct arm_soc_desc exynos4_soc_desc;
-extern int exynos4_cpu_kill(unsigned int cpu);
extern void exynos4_cpu_die(unsigned int cpu);
extern int exynos4_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 66e202d..1235df1 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -96,11 +96,6 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
}
}
-int exynos4_cpu_kill(unsigned int cpu)
-{
- return 1;
-}
-
/*
* platform-specific code to shutdown a CPU
*
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 9c6e322..b263e63 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -207,7 +207,7 @@ struct arm_soc_smp_ops exynos4_soc_smp_ops __initdata = {
.smp_secondary_init = exynos4_secondary_init,
.smp_boot_secondary = exynos4_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
- .cpu_kill = exynos4_cpu_kill,
+ .cpu_kill = dummy_cpu_kill,
.cpu_die = exynos4_cpu_die,
.cpu_disable = exynos4_cpu_disable,
#endif
diff --git a/arch/arm/mach-highbank/core.h b/arch/arm/mach-highbank/core.h
index d1fd356..115793e 100644
--- a/arch/arm/mach-highbank/core.h
+++ b/arch/arm/mach-highbank/core.h
@@ -10,7 +10,6 @@ extern void highbank_lluart_map_io(void);
static inline void highbank_lluart_map_io(void) {}
#endif
-extern int highbank_cpu_kill(unsigned int cpu);
extern void highbank_cpu_die(unsigned int cpu);
extern int highbank_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-highbank/hotplug.c b/arch/arm/mach-highbank/hotplug.c
index 7c25d49..6fda597 100644
--- a/arch/arm/mach-highbank/hotplug.c
+++ b/arch/arm/mach-highbank/hotplug.c
@@ -24,11 +24,6 @@
extern void secondary_startup(void);
-int highbank_cpu_kill(unsigned int cpu)
-{
- return 1;
-}
-
/*
* platform-specific code to shutdown a CPU
*
diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c
index 24162a7..b90ad83 100644
--- a/arch/arm/mach-highbank/platsmp.c
+++ b/arch/arm/mach-highbank/platsmp.c
@@ -18,6 +18,7 @@
#include <linux/smp.h>
#include <linux/io.h>
+#include <asm/smp_plat.h>
#include <asm/smp_scu.h>
#include <asm/hardware/gic.h>
@@ -86,7 +87,7 @@ struct arm_soc_smp_ops highbank_soc_smp_ops __initdata = {
.smp_secondary_init = highbank_secondary_init,
.smp_boot_secondary = highbank_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
- .cpu_kill = highbank_cpu_kill,
+ .cpu_kill = dummy_cpu_kill,
.cpu_die = highbank_cpu_die,
.cpu_disable = highbank_cpu_disable,
#endif
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
index 474b11d..7e75f8e 100644
--- a/arch/arm/mach-imx/hotplug.c
+++ b/arch/arm/mach-imx/hotplug.c
@@ -14,11 +14,6 @@
#include <asm/cacheflush.h>
#include <mach/common.h>
-int imx_cpu_kill(unsigned int cpu)
-{
- return 1;
-}
-
/*
* platform-specific code to shutdown a CPU
*
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index ae55931..64d9c9e 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -13,6 +13,7 @@
#include <linux/init.h>
#include <linux/smp.h>
#include <asm/page.h>
+#include <asm/smp_plat.h>
#include <asm/smp_scu.h>
#include <asm/soc.h>
#include <asm/hardware/gic.h>
@@ -94,7 +95,7 @@ struct arm_soc_smp_ops imx_soc_smp_ops __initdata = {
.smp_secondary_init = imx_secondary_init,
.smp_boot_secondary = imx_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
- .cpu_kill = imx_cpu_kill,
+ .cpu_kill = dummy_cpu_kill,
.cpu_die = imx_cpu_die,
.cpu_disable = imx_cpu_disable,
#endif
diff --git a/arch/arm/mach-msm/core.h b/arch/arm/mach-msm/core.h
index e8394dd..533130d 100644
--- a/arch/arm/mach-msm/core.h
+++ b/arch/arm/mach-msm/core.h
@@ -4,6 +4,5 @@ extern struct arm_soc_smp_init_ops msm_soc_smp_init_ops;
extern struct arm_soc_smp_ops msm_soc_smp_ops;
extern struct arm_soc_desc msm_soc_desc;
-extern int msm_cpu_kill(unsigned int cpu);
extern void msm_cpu_die(unsigned int cpu);
extern int msm_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c
index 6ba3602..5f09e5a1 100644
--- a/arch/arm/mach-msm/hotplug.c
+++ b/arch/arm/mach-msm/hotplug.c
@@ -59,11 +59,6 @@ static inline void platform_do_lowpower(unsigned int cpu)
}
}
-int msm_cpu_kill(unsigned int cpu)
-{
- return 1;
-}
-
/*
* platform-specific code to shutdown a CPU
*
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
index 8b56ae1..0664a91 100644
--- a/arch/arm/mach-msm/platsmp.c
+++ b/arch/arm/mach-msm/platsmp.c
@@ -183,7 +183,7 @@ struct arm_soc_smp_ops msm_soc_smp_ops __initdata = {
.smp_secondary_init = msm_secondary_init,
.smp_boot_secondary = msm_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
- .cpu_kill = msm_cpu_kill,
+ .cpu_kill = dummy_cpu_kill,
.cpu_die = msm_cpu_die,
.cpu_disable = msm_cpu_disable,
#endif
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 961b79a..e0ae233 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -195,7 +195,6 @@ extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask);
extern void omap_auxcoreboot_addr(u32 cpu_addr);
extern u32 omap_read_auxcoreboot0(void);
-extern int omap4_cpu_kill(unsigned int cpu);
extern void omap4_cpu_die(unsigned int cpu);
extern int omap4_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c
index e794f4b..d3d01fe 100644
--- a/arch/arm/mach-omap2/omap-hotplug.c
+++ b/arch/arm/mach-omap2/omap-hotplug.c
@@ -24,11 +24,6 @@
#include "powerdomain.h"
-int omap4_cpu_kill(unsigned int cpu)
-{
- return 1;
-}
-
/*
* platform-specific code to shutdown a CPU
* Called with IRQs disabled
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 4d39fd0..2c97b14 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -22,6 +22,7 @@
#include <asm/cacheflush.h>
#include <asm/hardware/gic.h>
+#include <asm/smp_plat.h>
#include <asm/smp_scu.h>
#include <asm/soc.h>
#include <mach/hardware.h>
@@ -191,7 +192,7 @@ struct arm_soc_smp_ops omap4_soc_smp_ops __initdata = {
.smp_secondary_init = omap4_secondary_init,
.smp_boot_secondary = omap4_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
- .cpu_kill = omap4_cpu_kill,
+ .cpu_kill = dummy_cpu_kill,
.cpu_die = omap4_cpu_die,
.cpu_disable = omap4_cpu_disable,
#endif
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index a23caa3..6cdfdf9 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -71,7 +71,6 @@ extern struct arm_soc_desc realview_soc_desc;
extern struct arm_soc_smp_init_ops realview_soc_smp_init_ops;
extern struct arm_soc_smp_ops realview_soc_smp_ops;
-extern int realview_cpu_kill(unsigned int cpu);
extern void realview_cpu_die(unsigned int cpu);
extern int realview_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
index ba4e2a86..7f28a56 100644
--- a/arch/arm/mach-realview/hotplug.c
+++ b/arch/arm/mach-realview/hotplug.c
@@ -88,11 +88,6 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
}
}
-int realview_cpu_kill(unsigned int cpu)
-{
- return 1;
-}
-
/*
* platform-specific code to shutdown a CPU
*
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index 8e4a865..ebe975e 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -16,6 +16,7 @@
#include <mach/hardware.h>
#include <asm/hardware/gic.h>
#include <asm/mach-types.h>
+#include <asm/smp_plat.h>
#include <asm/smp_scu.h>
#include <asm/soc.h>
@@ -88,7 +89,7 @@ struct arm_soc_smp_ops realview_soc_smp_ops __initdata = {
.smp_secondary_init = versatile_secondary_init,
.smp_boot_secondary = versatile_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
- .cpu_kill = realview_cpu_kill,
+ .cpu_kill = dummy_cpu_kill,
.cpu_die = realview_cpu_die,
.cpu_disable = realview_cpu_disable,
#endif
diff --git a/arch/arm/mach-tegra/common.h b/arch/arm/mach-tegra/common.h
index e4c214d..c135700 100644
--- a/arch/arm/mach-tegra/common.h
+++ b/arch/arm/mach-tegra/common.h
@@ -6,6 +6,5 @@ struct arm_soc_smp_ops;
extern struct arm_soc_smp_init_ops tegra_soc_smp_init_ops;
extern struct arm_soc_smp_ops tegra_soc_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 7319f5f..51e8690 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -86,11 +86,6 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
}
}
-int tegra_cpu_kill(unsigned int cpu)
-{
- return 1;
-}
-
/*
* platform-specific code to shutdown a CPU
*
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 519b110..c31018e 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -22,6 +22,7 @@
#include <asm/cacheflush.h>
#include <asm/hardware/gic.h>
#include <asm/mach-types.h>
+#include <asm/smp_plat.h>
#include <asm/smp_scu.h>
#include <asm/soc.h>
@@ -144,7 +145,7 @@ struct arm_soc_smp_ops tegra_soc_smp_ops __initdata = {
.smp_secondary_init = tegra_secondary_init,
.smp_boot_secondary = tegra_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
- .cpu_kill = tegra_cpu_kill,
+ .cpu_kill = dummy_cpu_kill,
.cpu_die = tegra_cpu_die,
.cpu_disable = tegra_cpu_disable,
#endif
diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c
index ae1a8eb..1e86d5a 100644
--- a/arch/arm/mach-ux500/hotplug.c
+++ b/arch/arm/mach-ux500/hotplug.c
@@ -36,11 +36,6 @@ static inline void platform_do_lowpower(unsigned int cpu)
}
}
-int ux500_cpu_kill(unsigned int cpu)
-{
- return 1;
-}
-
/*
* platform-specific code to shutdown a CPU
*
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
index e764530..72ba37d 100644
--- a/arch/arm/mach-ux500/include/mach/setup.h
+++ b/arch/arm/mach-ux500/include/mach/setup.h
@@ -55,7 +55,6 @@ extern struct arm_soc_smp_init_ops ux500_soc_smp_init_ops;
extern struct arm_soc_smp_ops ux500_soc_smp_ops;
extern struct arm_soc_desc ux500_soc_desc;
-extern int ux500_cpu_kill(unsigned int cpu);
extern void ux500_cpu_die(unsigned int cpu);
extern int ux500_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index fc72ce1..f105192 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -185,7 +185,7 @@ struct arm_soc_smp_ops ux500_soc_smp_ops __initdata = {
.smp_secondary_init = ux500_secondary_init,
.smp_boot_secondary = ux500_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
- .cpu_kill = ux500_cpu_kill,
+ .cpu_kill = dummy_cpu_kill,
.cpu_die = ux500_cpu_die,
.cpu_disable = ux500_cpu_disable,
#endif
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
index bd9065a..f072682 100644
--- a/arch/arm/mach-vexpress/core.h
+++ b/arch/arm/mach-vexpress/core.h
@@ -24,6 +24,5 @@ struct arm_soc_smp_ops;
extern struct arm_soc_smp_init_ops vexpress_soc_smp_init_ops;
extern struct arm_soc_smp_ops vexpress_soc_smp_ops;
-extern int vexpress_cpu_kill(unsigned int cpu);
extern void vexpress_cpu_die(unsigned int cpu);
extern int vexpress_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
index ac6d034..11d2c77 100644
--- a/arch/arm/mach-vexpress/hotplug.c
+++ b/arch/arm/mach-vexpress/hotplug.c
@@ -84,11 +84,6 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
}
}
-int vexpress_cpu_kill(unsigned int cpu)
-{
- return 1;
-}
-
/*
* platform-specific code to shutdown a CPU
*
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index aba765b..80ab030 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -13,6 +13,7 @@
#include <linux/smp.h>
#include <linux/io.h>
+#include <asm/smp_plat.h>
#include <asm/soc.h>
#include <mach/motherboard.h>
@@ -59,7 +60,7 @@ struct arm_soc_smp_ops vexpress_soc_smp_ops __initdata = {
.smp_secondary_init = versatile_secondary_init,
.smp_boot_secondary = versatile_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
- .cpu_kill = vexpress_cpu_kill,
+ .cpu_kill = dummy_cpu_kill,
.cpu_die = vexpress_cpu_die,
.cpu_disable = vexpress_cpu_disable,
#endif
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index 99c7978..08b241c 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -133,7 +133,6 @@ extern void imx53_smd_common_init(void);
extern int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode);
extern void imx6q_clock_map_io(void);
-extern int imx_cpu_kill(unsigned int cpu);
extern void imx_cpu_die(unsigned int cpu);
extern int imx_cpu_disable(unsigned int cpu);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 14/15] ARM: hotplug: Introduce dummy_cpu_disable
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (12 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 13/15] ARM: hotplug: Introduce dummy_cpu_kill Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-09 0:19 ` Nicolas Pitre
2012-02-08 0:30 ` [PATCH v6 15/15] ARM: hotplug: add cpu_lowpower as an alternative to cpu_die Marc Zyngier
2012-02-08 0:43 ` [PATCH v6 00/15] Per SoC descriptor Rob Herring
15 siblings, 1 reply; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Most platforms don't implement their cpu_disable method.
Some because they simply don't offer the capability, some other
because nobody cared enough to implement the necessary code.
Either way, this code is duplicated all over the place. Implement
a global dummy_cpu_disable method and convert all SMP (but shmobile)
to use it. Hopefully the "dummy" prefix will be an incentive
for people to do the right thing.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Colin Cross <ccross@android.com>
Cc: David Brown <davidb@codeaurora.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/include/asm/smp_plat.h | 1 +
arch/arm/kernel/smp.c | 9 +++++++++
arch/arm/mach-exynos/common.h | 1 -
arch/arm/mach-exynos/hotplug.c | 9 ---------
arch/arm/mach-exynos/platsmp.c | 2 +-
arch/arm/mach-highbank/core.h | 1 -
arch/arm/mach-highbank/hotplug.c | 9 ---------
arch/arm/mach-highbank/platsmp.c | 2 +-
arch/arm/mach-imx/hotplug.c | 9 ---------
arch/arm/mach-imx/platsmp.c | 2 +-
arch/arm/mach-msm/core.h | 1 -
arch/arm/mach-msm/hotplug.c | 9 ---------
arch/arm/mach-msm/platsmp.c | 2 +-
arch/arm/mach-omap2/common.h | 1 -
arch/arm/mach-omap2/omap-hotplug.c | 9 ---------
arch/arm/mach-omap2/omap-smp.c | 2 +-
arch/arm/mach-realview/core.h | 1 -
arch/arm/mach-realview/hotplug.c | 9 ---------
arch/arm/mach-realview/platsmp.c | 2 +-
arch/arm/mach-tegra/common.h | 1 -
arch/arm/mach-tegra/hotplug.c | 9 ---------
arch/arm/mach-tegra/platsmp.c | 2 +-
arch/arm/mach-ux500/hotplug.c | 9 ---------
arch/arm/mach-ux500/include/mach/setup.h | 1 -
arch/arm/mach-ux500/platsmp.c | 2 +-
arch/arm/mach-vexpress/core.h | 1 -
arch/arm/mach-vexpress/hotplug.c | 9 ---------
arch/arm/mach-vexpress/platsmp.c | 2 +-
arch/arm/plat-mxc/include/mach/common.h | 1 -
29 files changed, 19 insertions(+), 99 deletions(-)
diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h
index 8b2ffe2..f43d039 100644
--- a/arch/arm/include/asm/smp_plat.h
+++ b/arch/arm/include/asm/smp_plat.h
@@ -51,5 +51,6 @@ extern int __cpu_logical_map[];
/* Only use this if your platform doesn't have any CPU PM */
extern int dummy_cpu_kill(unsigned int cpu);
+extern int dummy_cpu_disable(unsigned int cpu);
#endif
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index eabd6b8..e0d1622 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -184,6 +184,15 @@ int dummy_cpu_kill(unsigned int cpu)
return 1;
}
+int dummy_cpu_disable(unsigned int cpu)
+{
+ /*
+ * we don't allow CPU 0 to be shutdown (it is still too special
+ * e.g. clock tick interrupts)
+ */
+ return cpu == 0 ? -EPERM : 0;
+}
+
static int __cpuinit platform_cpu_kill(unsigned int cpu)
{
if (soc_smp_ops && soc_smp_ops->cpu_kill)
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 9046df8..f13631a 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -32,7 +32,6 @@ extern struct arm_soc_smp_ops exynos4_soc_smp_ops;
extern struct arm_soc_desc exynos4_soc_desc;
extern void exynos4_cpu_die(unsigned int cpu);
-extern int exynos4_cpu_disable(unsigned int cpu);
#ifdef CONFIG_ARCH_EXYNOS
extern int exynos_init(void);
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 1235df1..be7a96b 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -120,12 +120,3 @@ void exynos4_cpu_die(unsigned int cpu)
if (spurious)
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
}
-
-int exynos4_cpu_disable(unsigned int cpu)
-{
- /*
- * we don't allow CPU 0 to be shutdown (it is still too special
- * e.g. clock tick interrupts)
- */
- return cpu == 0 ? -EPERM : 0;
-}
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index b263e63..4d22c2a 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -209,6 +209,6 @@ struct arm_soc_smp_ops exynos4_soc_smp_ops __initdata = {
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
.cpu_die = exynos4_cpu_die,
- .cpu_disable = exynos4_cpu_disable,
+ .cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-highbank/core.h b/arch/arm/mach-highbank/core.h
index 115793e..7f4aaca 100644
--- a/arch/arm/mach-highbank/core.h
+++ b/arch/arm/mach-highbank/core.h
@@ -11,7 +11,6 @@ static inline void highbank_lluart_map_io(void) {}
#endif
extern void highbank_cpu_die(unsigned int cpu);
-extern int highbank_cpu_disable(unsigned int cpu);
extern struct arm_soc_smp_init_ops highbank_soc_smp_init_ops;
extern struct arm_soc_smp_ops highbank_soc_smp_ops;
diff --git a/arch/arm/mach-highbank/hotplug.c b/arch/arm/mach-highbank/hotplug.c
index 6fda597..1277da3 100644
--- a/arch/arm/mach-highbank/hotplug.c
+++ b/arch/arm/mach-highbank/hotplug.c
@@ -40,12 +40,3 @@ void highbank_cpu_die(unsigned int cpu)
/* We should never return from idle */
panic("highbank: cpu %d unexpectedly exit from shutdown\n", cpu);
}
-
-int highbank_cpu_disable(unsigned int cpu)
-{
- /*
- * CPU0 should not be shut down via hotplug. cpu_idle can WFI
- * or a proper shutdown or hibernate should be used.
- */
- return cpu == 0 ? -EPERM : 0;
-}
diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c
index b90ad83..789147d 100644
--- a/arch/arm/mach-highbank/platsmp.c
+++ b/arch/arm/mach-highbank/platsmp.c
@@ -89,6 +89,6 @@ struct arm_soc_smp_ops highbank_soc_smp_ops __initdata = {
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
.cpu_die = highbank_cpu_die,
- .cpu_disable = highbank_cpu_disable,
+ .cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
index 7e75f8e..63d5144 100644
--- a/arch/arm/mach-imx/hotplug.c
+++ b/arch/arm/mach-imx/hotplug.c
@@ -28,12 +28,3 @@ void imx_cpu_die(unsigned int cpu)
/* We should never return from idle */
panic("cpu %d unexpectedly exit from shutdown\n", cpu);
}
-
-int imx_cpu_disable(unsigned int cpu)
-{
- /*
- * we don't allow CPU 0 to be shutdown (it is still too special
- * e.g. clock tick interrupts)
- */
- return cpu == 0 ? -EPERM : 0;
-}
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index 64d9c9e..2fea1e3 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -97,6 +97,6 @@ struct arm_soc_smp_ops imx_soc_smp_ops __initdata = {
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
.cpu_die = imx_cpu_die,
- .cpu_disable = imx_cpu_disable,
+ .cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-msm/core.h b/arch/arm/mach-msm/core.h
index 533130d..623474a 100644
--- a/arch/arm/mach-msm/core.h
+++ b/arch/arm/mach-msm/core.h
@@ -5,4 +5,3 @@ extern struct arm_soc_smp_ops msm_soc_smp_ops;
extern struct arm_soc_desc msm_soc_desc;
extern void msm_cpu_die(unsigned int cpu);
-extern int msm_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c
index 5f09e5a1..d0f79e8 100644
--- a/arch/arm/mach-msm/hotplug.c
+++ b/arch/arm/mach-msm/hotplug.c
@@ -78,12 +78,3 @@ void msm_cpu_die(unsigned int cpu)
*/
cpu_leave_lowpower();
}
-
-int msm_cpu_disable(unsigned int cpu)
-{
- /*
- * we don't allow CPU 0 to be shutdown (it is still too special
- * e.g. clock tick interrupts)
- */
- return cpu == 0 ? -EPERM : 0;
-}
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
index 0664a91..f7e27d9 100644
--- a/arch/arm/mach-msm/platsmp.c
+++ b/arch/arm/mach-msm/platsmp.c
@@ -185,6 +185,6 @@ struct arm_soc_smp_ops msm_soc_smp_ops __initdata = {
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
.cpu_die = msm_cpu_die,
- .cpu_disable = msm_cpu_disable,
+ .cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index e0ae233..c8e3c3e 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -196,7 +196,6 @@ extern void omap_auxcoreboot_addr(u32 cpu_addr);
extern u32 omap_read_auxcoreboot0(void);
extern void omap4_cpu_die(unsigned int cpu);
-extern int omap4_cpu_disable(unsigned int cpu);
struct arm_soc_smp_init_ops;
struct arm_soc_smp_ops;
diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c
index d3d01fe..1d95520 100644
--- a/arch/arm/mach-omap2/omap-hotplug.c
+++ b/arch/arm/mach-omap2/omap-hotplug.c
@@ -56,12 +56,3 @@ void omap4_cpu_die(unsigned int cpu)
pr_debug("CPU%u: spurious wakeup call\n", cpu);
}
}
-
-int omap4_cpu_disable(unsigned int cpu)
-{
- /*
- * we don't allow CPU 0 to be shutdown (it is still too special
- * e.g. clock tick interrupts)
- */
- return cpu == 0 ? -EPERM : 0;
-}
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 2c97b14..6b1d652 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -194,6 +194,6 @@ struct arm_soc_smp_ops omap4_soc_smp_ops __initdata = {
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
.cpu_die = omap4_cpu_die,
- .cpu_disable = omap4_cpu_disable,
+ .cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 6cdfdf9..dd4bcdb 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -72,6 +72,5 @@ extern struct arm_soc_smp_init_ops realview_soc_smp_init_ops;
extern struct arm_soc_smp_ops realview_soc_smp_ops;
extern void realview_cpu_die(unsigned int cpu);
-extern int realview_cpu_disable(unsigned int cpu);
#endif
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
index 7f28a56..12af634 100644
--- a/arch/arm/mach-realview/hotplug.c
+++ b/arch/arm/mach-realview/hotplug.c
@@ -112,12 +112,3 @@ void realview_cpu_die(unsigned int cpu)
if (spurious)
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
}
-
-int realview_cpu_disable(unsigned int cpu)
-{
- /*
- * we don't allow CPU 0 to be shutdown (it is still too special
- * e.g. clock tick interrupts)
- */
- return cpu == 0 ? -EPERM : 0;
-}
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index ebe975e..5b7535d 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -91,6 +91,6 @@ struct arm_soc_smp_ops realview_soc_smp_ops __initdata = {
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
.cpu_die = realview_cpu_die,
- .cpu_disable = realview_cpu_disable,
+ .cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-tegra/common.h b/arch/arm/mach-tegra/common.h
index c135700..b02cc87 100644
--- a/arch/arm/mach-tegra/common.h
+++ b/arch/arm/mach-tegra/common.h
@@ -7,4 +7,3 @@ extern struct arm_soc_smp_init_ops tegra_soc_smp_init_ops;
extern struct arm_soc_smp_ops tegra_soc_smp_ops;
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 51e8690..15433b2 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -110,12 +110,3 @@ void tegra_cpu_die(unsigned int cpu)
if (spurious)
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
}
-
-int tegra_cpu_disable(unsigned int cpu)
-{
- /*
- * we don't allow CPU 0 to be shutdown (it is still too special
- * e.g. clock tick interrupts)
- */
- return cpu == 0 ? -EPERM : 0;
-}
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index c31018e..4edc8ab 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -147,6 +147,6 @@ struct arm_soc_smp_ops tegra_soc_smp_ops __initdata = {
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
.cpu_die = tegra_cpu_die,
- .cpu_disable = tegra_cpu_disable,
+ .cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c
index 1e86d5a..ec1c77f 100644
--- a/arch/arm/mach-ux500/hotplug.c
+++ b/arch/arm/mach-ux500/hotplug.c
@@ -46,12 +46,3 @@ void ux500_cpu_die(unsigned int cpu)
/* directly enter low power state, skipping secure registers */
platform_do_lowpower(cpu);
}
-
-int ux500_cpu_disable(unsigned int cpu)
-{
- /*
- * we don't allow CPU 0 to be shutdown (it is still too special
- * e.g. clock tick interrupts)
- */
- return cpu == 0 ? -EPERM : 0;
-}
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
index 72ba37d..2935f85 100644
--- a/arch/arm/mach-ux500/include/mach/setup.h
+++ b/arch/arm/mach-ux500/include/mach/setup.h
@@ -56,6 +56,5 @@ extern struct arm_soc_smp_ops ux500_soc_smp_ops;
extern struct arm_soc_desc ux500_soc_desc;
extern void ux500_cpu_die(unsigned int cpu);
-extern int ux500_cpu_disable(unsigned int cpu);
#endif /* __ASM_ARCH_SETUP_H */
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index f105192..bbd6480 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -187,6 +187,6 @@ struct arm_soc_smp_ops ux500_soc_smp_ops __initdata = {
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
.cpu_die = ux500_cpu_die,
- .cpu_disable = ux500_cpu_disable,
+ .cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
index f072682..d9b1ec0 100644
--- a/arch/arm/mach-vexpress/core.h
+++ b/arch/arm/mach-vexpress/core.h
@@ -25,4 +25,3 @@ extern struct arm_soc_smp_init_ops vexpress_soc_smp_init_ops;
extern struct arm_soc_smp_ops vexpress_soc_smp_ops;
extern void vexpress_cpu_die(unsigned int cpu);
-extern int vexpress_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
index 11d2c77..e1a7fef 100644
--- a/arch/arm/mach-vexpress/hotplug.c
+++ b/arch/arm/mach-vexpress/hotplug.c
@@ -108,12 +108,3 @@ void vexpress_cpu_die(unsigned int cpu)
if (spurious)
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
}
-
-int vexpress_cpu_disable(unsigned int cpu)
-{
- /*
- * we don't allow CPU 0 to be shutdown (it is still too special
- * e.g. clock tick interrupts)
- */
- return cpu == 0 ? -EPERM : 0;
-}
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index 80ab030..a5196f87 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -62,6 +62,6 @@ struct arm_soc_smp_ops vexpress_soc_smp_ops __initdata = {
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
.cpu_die = vexpress_cpu_die,
- .cpu_disable = vexpress_cpu_disable,
+ .cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index 08b241c..c0d0a21 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -134,7 +134,6 @@ extern int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode);
extern void imx6q_clock_map_io(void);
extern void imx_cpu_die(unsigned int cpu);
-extern int imx_cpu_disable(unsigned int cpu);
#ifdef CONFIG_PM
extern void imx6q_pm_init(void);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 15/15] ARM: hotplug: add cpu_lowpower as an alternative to cpu_die
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (13 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 14/15] ARM: hotplug: Introduce dummy_cpu_disable Marc Zyngier
@ 2012-02-08 0:30 ` Marc Zyngier
2012-02-09 0:21 ` Nicolas Pitre
2012-02-09 8:48 ` Russell King - ARM Linux
2012-02-08 0:43 ` [PATCH v6 00/15] Per SoC descriptor Rob Herring
15 siblings, 2 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Most platforms don't actually implement cpu_die, but instead
a "go into low power mode" operation.
Factor these similar implementations into a single one called
from platform_cpu_die().
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Colin Cross <ccross@android.com>
Cc: David Brown <davidb@codeaurora.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/include/asm/soc.h | 1 +
arch/arm/kernel/smp.c | 16 ++++++++-
arch/arm/mach-exynos/common.h | 2 +-
arch/arm/mach-exynos/hotplug.c | 27 +--------------
arch/arm/mach-exynos/platsmp.c | 2 +-
arch/arm/mach-msm/core.h | 2 +-
arch/arm/mach-msm/hotplug.c | 22 +-----------
arch/arm/mach-msm/platsmp.c | 2 +-
arch/arm/mach-realview/core.h | 2 +-
arch/arm/mach-realview/hotplug.c | 27 +--------------
arch/arm/mach-realview/platsmp.c | 2 +-
arch/arm/mach-tegra/common.h | 2 +-
arch/arm/mach-tegra/hotplug.c | 53 ++++--------------------------
arch/arm/mach-tegra/platsmp.c | 2 +-
arch/arm/mach-ux500/hotplug.c | 14 +-------
arch/arm/mach-ux500/include/mach/setup.h | 2 +-
arch/arm/mach-ux500/platsmp.c | 2 +-
arch/arm/mach-vexpress/core.h | 2 +-
arch/arm/mach-vexpress/hotplug.c | 27 +--------------
arch/arm/mach-vexpress/platsmp.c | 2 +-
20 files changed, 44 insertions(+), 167 deletions(-)
diff --git a/arch/arm/include/asm/soc.h b/arch/arm/include/asm/soc.h
index 1bcc58c..f1b6c45 100644
--- a/arch/arm/include/asm/soc.h
+++ b/arch/arm/include/asm/soc.h
@@ -38,6 +38,7 @@ struct arm_soc_smp_ops {
#ifdef CONFIG_HOTPLUG_CPU
int (*cpu_kill)(unsigned int cpu);
void (*cpu_die)(unsigned int cpu);
+ void (*cpu_lowpower)(unsigned int cpu, int *spurious);
int (*cpu_disable)(unsigned int cpu);
#endif
};
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index e0d1622..34318aa 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -202,8 +202,20 @@ static int __cpuinit platform_cpu_kill(unsigned int cpu)
static void __cpuinit platform_cpu_die(unsigned int cpu)
{
- if (soc_smp_ops && soc_smp_ops->cpu_die)
- soc_smp_ops->cpu_die(cpu);
+ if (soc_smp_ops) {
+ if (soc_smp_ops->cpu_die) {
+ soc_smp_ops->cpu_die(cpu);
+ return;
+ }
+
+ if (soc_smp_ops->cpu_lowpower) {
+ int spurious = 0;
+ soc_smp_ops->cpu_lowpower(cpu, &spurious);
+ if (spurious)
+ pr_warn("CPU%u: %u spurious wakeup calls\n",
+ cpu, spurious);
+ }
+ }
}
static int __cpuinit platform_cpu_disable(unsigned int cpu)
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index f13631a..d664f6e 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -31,7 +31,7 @@ extern struct arm_soc_smp_init_ops exynos4_soc_smp_init_ops;
extern struct arm_soc_smp_ops exynos4_soc_smp_ops;
extern struct arm_soc_desc exynos4_soc_desc;
-extern void exynos4_cpu_die(unsigned int cpu);
+extern void exynos4_cpu_lowpower(unsigned int cpu, int *spurious);
#ifdef CONFIG_ARCH_EXYNOS
extern int exynos_init(void);
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index be7a96b..aed75cb 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -62,8 +62,9 @@ static inline void cpu_leave_lowpower(void)
: "cc");
}
-static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
+void exynos4_cpu_lowpower(unsigned int cpu, int *spurious)
{
+ cpu_enter_lowpower();
for (;;) {
/* make cpu1 to be turned off at next WFI command */
@@ -94,29 +95,5 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
*/
(*spurious)++;
}
-}
-
-/*
- * platform-specific code to shutdown a CPU
- *
- * Called with IRQs disabled
- */
-void exynos4_cpu_die(unsigned int cpu)
-{
- int spurious = 0;
-
- /*
- * we're ready for shutdown now, so do it
- */
- cpu_enter_lowpower();
- platform_do_lowpower(cpu, &spurious);
-
- /*
- * bring this CPU back into the world of cache
- * coherency, and then restore interrupts
- */
cpu_leave_lowpower();
-
- if (spurious)
- pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
}
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 4d22c2a..8469ac8 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -208,7 +208,7 @@ struct arm_soc_smp_ops exynos4_soc_smp_ops __initdata = {
.smp_boot_secondary = exynos4_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
- .cpu_die = exynos4_cpu_die,
+ .cpu_lowpower = exynos4_cpu_lowpower,
.cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-msm/core.h b/arch/arm/mach-msm/core.h
index 623474a..a5c50c4 100644
--- a/arch/arm/mach-msm/core.h
+++ b/arch/arm/mach-msm/core.h
@@ -4,4 +4,4 @@ extern struct arm_soc_smp_init_ops msm_soc_smp_init_ops;
extern struct arm_soc_smp_ops msm_soc_smp_ops;
extern struct arm_soc_desc msm_soc_desc;
-extern void msm_cpu_die(unsigned int cpu);
+extern void msm_cpu_lowpower(unsigned int cpu, int *spurious);
diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c
index d0f79e8..6e6ed2d 100644
--- a/arch/arm/mach-msm/hotplug.c
+++ b/arch/arm/mach-msm/hotplug.c
@@ -28,9 +28,10 @@ static inline void cpu_leave_lowpower(void)
{
}
-static inline void platform_do_lowpower(unsigned int cpu)
+void msm_cpu_lowpower(unsigned int cpu, int *spurious)
{
/* Just enter wfi for now. TODO: Properly shut off the cpu. */
+ cpu_enter_lowpower();
for (;;) {
/*
* here's the WFI
@@ -57,24 +58,5 @@ static inline void platform_do_lowpower(unsigned int cpu)
*/
pr_debug("CPU%u: spurious wakeup call\n", cpu);
}
-}
-
-/*
- * platform-specific code to shutdown a CPU
- *
- * Called with IRQs disabled
- */
-void msm_cpu_die(unsigned int cpu)
-{
- /*
- * we're ready for shutdown now, so do it
- */
- cpu_enter_lowpower();
- platform_do_lowpower(cpu);
-
- /*
- * bring this CPU back into the world of cache
- * coherency, and then restore interrupts
- */
cpu_leave_lowpower();
}
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
index f7e27d9..5e153cf 100644
--- a/arch/arm/mach-msm/platsmp.c
+++ b/arch/arm/mach-msm/platsmp.c
@@ -184,7 +184,7 @@ struct arm_soc_smp_ops msm_soc_smp_ops __initdata = {
.smp_boot_secondary = msm_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
- .cpu_die = msm_cpu_die,
+ .cpu_lowpower = msm_cpu_lowpower,
.cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index dd4bcdb..b593b36 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -71,6 +71,6 @@ extern struct arm_soc_desc realview_soc_desc;
extern struct arm_soc_smp_init_ops realview_soc_smp_init_ops;
extern struct arm_soc_smp_ops realview_soc_smp_ops;
-extern void realview_cpu_die(unsigned int cpu);
+extern void realview_cpu_lowpower(unsigned int cpu, int *spurious);
#endif
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
index 12af634..4d45d07 100644
--- a/arch/arm/mach-realview/hotplug.c
+++ b/arch/arm/mach-realview/hotplug.c
@@ -54,13 +54,14 @@ static inline void cpu_leave_lowpower(void)
: "cc");
}
-static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
+void realview_cpu_lowpower(unsigned int cpu, int *spurious)
{
/*
* there is no power-control hardware on this platform, so all
* we can do is put the core into WFI; this is safe as the calling
* code will have already disabled interrupts
*/
+ cpu_enter_lowpower();
for (;;) {
/*
* here's the WFI
@@ -86,29 +87,5 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
*/
(*spurious)++;
}
-}
-
-/*
- * platform-specific code to shutdown a CPU
- *
- * Called with IRQs disabled
- */
-void realview_cpu_die(unsigned int cpu)
-{
- int spurious = 0;
-
- /*
- * we're ready for shutdown now, so do it
- */
- cpu_enter_lowpower();
- platform_do_lowpower(cpu, &spurious);
-
- /*
- * bring this CPU back into the world of cache
- * coherency, and then restore interrupts
- */
cpu_leave_lowpower();
-
- if (spurious)
- pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
}
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index 5b7535d..eb6b532 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -90,7 +90,7 @@ struct arm_soc_smp_ops realview_soc_smp_ops __initdata = {
.smp_boot_secondary = versatile_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
- .cpu_die = realview_cpu_die,
+ .cpu_lowpower = realview_cpu_lowpower,
.cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-tegra/common.h b/arch/arm/mach-tegra/common.h
index b02cc87..38b9ea4 100644
--- a/arch/arm/mach-tegra/common.h
+++ b/arch/arm/mach-tegra/common.h
@@ -6,4 +6,4 @@ struct arm_soc_smp_ops;
extern struct arm_soc_smp_init_ops tegra_soc_smp_init_ops;
extern struct arm_soc_smp_ops tegra_soc_smp_ops;
-extern void tegra_cpu_die(unsigned int cpu);
+extern void tegra_cpu_lowpower(unsigned int cpu, int *spurious);
diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
index 15433b2..455a077 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -52,61 +52,22 @@ static inline void cpu_leave_lowpower(void)
: "cc");
}
-static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
+void tegra_cpu_lowpower(unsigned int cpu, int *spurious)
{
/*
* there is no power-control hardware on this platform, so all
* we can do is put the core into WFI; this is safe as the calling
* code will have already disabled interrupts
*/
- for (;;) {
- /*
- * here's the WFI
- */
- asm(".word 0xe320f003\n"
- :
- :
- : "memory", "cc");
-
- /*if (pen_release == cpu) {*/
- /*
- * OK, proper wakeup, we're done
- */
- break;
- /*}*/
-
- /*
- * Getting here, means that we have come out of WFI without
- * having been woken up - this shouldn't happen
- *
- * Just note it happening - when we're woken, we can report
- * its occurrence.
- */
- (*spurious)++;
- }
-}
-
-/*
- * platform-specific code to shutdown a CPU
- *
- * Called with IRQs disabled
- */
-void tegra_cpu_die(unsigned int cpu)
-{
- int spurious = 0;
-
- /*
- * we're ready for shutdown now, so do it
- */
cpu_enter_lowpower();
- platform_do_lowpower(cpu, &spurious);
/*
- * bring this CPU back into the world of cache
- * coherency, and then restore interrupts
+ * here's the WFI
*/
- cpu_leave_lowpower();
+ asm("wfi\n"
+ :
+ :
+ : "memory", "cc");
- if (spurious)
- pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
+ cpu_leave_lowpower();
}
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 4edc8ab..5d1593c 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -146,7 +146,7 @@ struct arm_soc_smp_ops tegra_soc_smp_ops __initdata = {
.smp_boot_secondary = tegra_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
- .cpu_die = tegra_cpu_die,
+ .cpu_lowpower = tegra_cpu_lowpower,
.cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c
index ec1c77f..c46b01d 100644
--- a/arch/arm/mach-ux500/hotplug.c
+++ b/arch/arm/mach-ux500/hotplug.c
@@ -19,7 +19,7 @@
extern volatile int pen_release;
-static inline void platform_do_lowpower(unsigned int cpu)
+void ux500_cpu_lowpower(unsigned int cpu, int *spurious)
{
flush_cache_all();
@@ -33,16 +33,6 @@ static inline void platform_do_lowpower(unsigned int cpu)
*/
break;
}
+ (*spurious)++;
}
}
-
-/*
- * platform-specific code to shutdown a CPU
- *
- * Called with IRQs disabled
- */
-void ux500_cpu_die(unsigned int cpu)
-{
- /* directly enter low power state, skipping secure registers */
- platform_do_lowpower(cpu);
-}
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
index 2935f85..127fd0b 100644
--- a/arch/arm/mach-ux500/include/mach/setup.h
+++ b/arch/arm/mach-ux500/include/mach/setup.h
@@ -55,6 +55,6 @@ extern struct arm_soc_smp_init_ops ux500_soc_smp_init_ops;
extern struct arm_soc_smp_ops ux500_soc_smp_ops;
extern struct arm_soc_desc ux500_soc_desc;
-extern void ux500_cpu_die(unsigned int cpu);
+extern void ux500_cpu_lowpower(unsigned int cpu, int *spurious)l
#endif /* __ASM_ARCH_SETUP_H */
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index bbd6480..f19ba4e 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -186,7 +186,7 @@ struct arm_soc_smp_ops ux500_soc_smp_ops __initdata = {
.smp_boot_secondary = ux500_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
- .cpu_die = ux500_cpu_die,
+ .cpu_lowpower = ux500_cpu_lowpower,
.cpu_disable = dummy_cpu_disable,
#endif
};
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
index d9b1ec0..413e889 100644
--- a/arch/arm/mach-vexpress/core.h
+++ b/arch/arm/mach-vexpress/core.h
@@ -24,4 +24,4 @@ struct arm_soc_smp_ops;
extern struct arm_soc_smp_init_ops vexpress_soc_smp_init_ops;
extern struct arm_soc_smp_ops vexpress_soc_smp_ops;
-extern void vexpress_cpu_die(unsigned int cpu);
+extern void vexpress_cpu_lowpower(unsigned int cpu, int *spurious)
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
index e1a7fef..4c87adc 100644
--- a/arch/arm/mach-vexpress/hotplug.c
+++ b/arch/arm/mach-vexpress/hotplug.c
@@ -56,13 +56,14 @@ static inline void cpu_leave_lowpower(void)
: "cc");
}
-static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
+void vexpress_cpu_lowpower(unsigned int cpu, int *spurious)
{
/*
* there is no power-control hardware on this platform, so all
* we can do is put the core into WFI; this is safe as the calling
* code will have already disabled interrupts
*/
+ cpu_enter_lowpower();
for (;;) {
wfi();
@@ -82,29 +83,5 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
*/
(*spurious)++;
}
-}
-
-/*
- * platform-specific code to shutdown a CPU
- *
- * Called with IRQs disabled
- */
-void vexpress_cpu_die(unsigned int cpu)
-{
- int spurious = 0;
-
- /*
- * we're ready for shutdown now, so do it
- */
- cpu_enter_lowpower();
- platform_do_lowpower(cpu, &spurious);
-
- /*
- * bring this CPU back into the world of cache
- * coherency, and then restore interrupts
- */
cpu_leave_lowpower();
-
- if (spurious)
- pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
}
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index a5196f87..5630d2b 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -61,7 +61,7 @@ struct arm_soc_smp_ops vexpress_soc_smp_ops __initdata = {
.smp_boot_secondary = versatile_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
.cpu_kill = dummy_cpu_kill,
- .cpu_die = vexpress_cpu_die,
+ .cpu_lowpower = vexpress_cpu_lowpower,
.cpu_disable = dummy_cpu_disable,
#endif
};
--
1.7.3.4
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 00/15] Per SoC descriptor
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
` (14 preceding siblings ...)
2012-02-08 0:30 ` [PATCH v6 15/15] ARM: hotplug: add cpu_lowpower as an alternative to cpu_die Marc Zyngier
@ 2012-02-08 0:43 ` Rob Herring
2012-02-08 0:49 ` Marc Zyngier
15 siblings, 1 reply; 37+ messages in thread
From: Rob Herring @ 2012-02-08 0:43 UTC (permalink / raw)
To: linux-arm-kernel
On 02/07/2012 06:30 PM, Marc Zyngier wrote:
> This patch series introduces a per-soc descriptor which should, in the
> end, contain most of the SoC specific operations.
>
> This first patch series introduces the arm_soc_desc structure, adds
> per-soc SMP and CPU hotplug operations, and converts all SMP platform
> to this new scheme.
>
> The last three patches consolidate some of the most commonly duplicated
> hotplug code and move it to a common location.
>
> Patches against v3.3-rc2. Tested on VExpress (A5 and A15), RealView EB-11MP,
> OMAP4 (Panda) and Tegra2 (Harmony).
>
Do you have a git tree for this?
Rob
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 00/15] Per SoC descriptor
2012-02-08 0:43 ` [PATCH v6 00/15] Per SoC descriptor Rob Herring
@ 2012-02-08 0:49 ` Marc Zyngier
0 siblings, 0 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 0:49 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, 07 Feb 2012 18:43:02 -0600, Rob Herring <robherring2@gmail.com>
wrote:
> On 02/07/2012 06:30 PM, Marc Zyngier wrote:
>> This patch series introduces a per-soc descriptor which should, in the
>> end, contain most of the SoC specific operations.
>>
>> This first patch series introduces the arm_soc_desc structure, adds
>> per-soc SMP and CPU hotplug operations, and converts all SMP platform
>> to this new scheme.
>>
>> The last three patches consolidate some of the most commonly duplicated
>> hotplug code and move it to a common location.
>>
>> Patches against v3.3-rc2. Tested on VExpress (A5 and A15), RealView
>> EB-11MP,
>> OMAP4 (Panda) and Tegra2 (Harmony).
>>
>
> Do you have a git tree for this?
I just pushed to
git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git
soc_desc-v3.3-rc2
It should be visible in a few minutes.
M.
--
Fast, cheap, reliable. Pick two.
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 08/15] ARM: SoC: convert ux500 to SoC descriptor
2012-02-08 0:30 ` [PATCH v6 08/15] ARM: SoC: convert ux500 " Marc Zyngier
@ 2012-02-08 22:31 ` Linus Walleij
2012-02-09 5:29 ` Srinidhi KASAGAR
0 siblings, 1 reply; 37+ messages in thread
From: Linus Walleij @ 2012-02-08 22:31 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Feb 8, 2012 at 1:30 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> Convert ux500 platforms to use the SoC descriptor to provide
> their SMP and CPU hotplug operations.
>
> Cc: Linus Walleij <linus.walleij@stericsson.com>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Srinidhi, can you check this patch series? I feel you are better than
me at the things Marc is consolidating. It looks good to me though.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 07/15] ARM: SoC: convert MSM SMP to SoC descriptor
2012-02-08 0:30 ` [PATCH v6 07/15] ARM: SoC: convert MSM SMP " Marc Zyngier
@ 2012-02-08 23:39 ` David Brown
2012-02-08 23:42 ` Marc Zyngier
0 siblings, 1 reply; 37+ messages in thread
From: David Brown @ 2012-02-08 23:39 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Feb 08, 2012 at 12:30:51AM +0000, Marc Zyngier wrote:
> @@ -146,6 +152,9 @@ MACHINE_END
> #ifdef CONFIG_OF
> /* TODO: General device tree support for all MSM. */
> DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
> + .soc = &msm_soc_desc,
> + .fixup = msm8x60_fixup,
> + .reserve = msm8x60_reserve,
> .map_io = msm8x60_map_io,
> .init_irq = msm8x60_init_irq,
> .init_machine = msm8x60_dt_init,
The fixup and reserve aren't really needed (and probably not wanted)
for the DT board. The fixup doesn't actually work, since it modifies
the tags, which don't exist. The reservation should be passed in the
DT itself, since that has a mechanism for it.
Otherwise, the MSM part looks ok.
Acked-By: David Brown <davidb@codeaurora.org>
David
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 07/15] ARM: SoC: convert MSM SMP to SoC descriptor
2012-02-08 23:39 ` David Brown
@ 2012-02-08 23:42 ` Marc Zyngier
0 siblings, 0 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-08 23:42 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 8 Feb 2012 15:39:07 -0800, David Brown <davidb@codeaurora.org>
wrote:
> On Wed, Feb 08, 2012 at 12:30:51AM +0000, Marc Zyngier wrote:
>
>> @@ -146,6 +152,9 @@ MACHINE_END
>> #ifdef CONFIG_OF
>> /* TODO: General device tree support for all MSM. */
>> DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
>> + .soc = &msm_soc_desc,
>> + .fixup = msm8x60_fixup,
>> + .reserve = msm8x60_reserve,
>> .map_io = msm8x60_map_io,
>> .init_irq = msm8x60_init_irq,
>> .init_machine = msm8x60_dt_init,
>
> The fixup and reserve aren't really needed (and probably not wanted)
> for the DT board. The fixup doesn't actually work, since it modifies
> the tags, which don't exist. The reservation should be passed in the
> DT itself, since that has a mechanism for it.
Evidently a copy/paste abuse. I'll fix that shortly.
> Otherwise, the MSM part looks ok.
>
> Acked-By: David Brown <davidb@codeaurora.org>
Thanks David.
M.
--
Fast, cheap, reliable. Pick two.
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations
2012-02-08 0:30 ` [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations Marc Zyngier
@ 2012-02-08 23:42 ` David Brown
2012-02-09 1:00 ` Marc Zyngier
2012-02-10 0:03 ` Arnd Bergmann
2012-02-09 0:02 ` Nicolas Pitre
2012-02-09 8:54 ` Russell King - ARM Linux
2 siblings, 2 replies; 37+ messages in thread
From: David Brown @ 2012-02-08 23:42 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Feb 08, 2012 at 12:30:46AM +0000, Marc Zyngier wrote:
> +#ifdef CONFIG_SMP
> +#define soc_smp_init_ops(ops) .smp_init_ops = &(ops),
> +#define soc_smp_ops(ops) .smp_ops = &(ops),
> +extern void soc_smp_ops_register(struct arm_soc_smp_init_ops *,
> + struct arm_soc_smp_ops *);
> +#else
> +#define soc_smp_init_ops(ops) /* empty */
> +#define soc_smp_ops(ops) /* empty */
> +#define soc_smp_ops_register(a,b) do {} while(0)
> +#endif
I'm not sure if this bothers anyone else, but these macros mess up
editors that know how to indent C code, since the comma ends up inside
the macro. I'm not sure I have a better idea, though.
David
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 01/15] ARM: SoC: Introduce per SoC descriptor
2012-02-08 0:30 ` [PATCH v6 01/15] ARM: SoC: Introduce per " Marc Zyngier
@ 2012-02-08 23:59 ` Nicolas Pitre
0 siblings, 0 replies; 37+ messages in thread
From: Nicolas Pitre @ 2012-02-08 23:59 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 8 Feb 2012, Marc Zyngier wrote:
> The ARM core code expects the various SoCs to hide their
> implementation differences behind a well established API.
> The various sub-arch-specific bit are often either at
> the machine descriptor level, or provided at link time
> by the sub-arch code.
>
> The SoC descriptor is a container that holds the SoC
> specific bits that can be moved away from the machine
> descriptor as well as an indirection point for the
> global symbols (SMP and CPU hotplug support, for example).
>
> This patch introduce this SoC descriptor, with the only field
> being the name of the SoC.
>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Nicolas Pitre <nico@fluxnic.net>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
> ---
> arch/arm/include/asm/mach/arch.h | 2 ++
> arch/arm/include/asm/soc.h | 19 +++++++++++++++++++
> arch/arm/kernel/setup.c | 7 +++++++
> 3 files changed, 28 insertions(+), 0 deletions(-)
> create mode 100644 arch/arm/include/asm/soc.h
>
> diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
> index d7692ca..cf7ef91 100644
> --- a/arch/arm/include/asm/mach/arch.h
> +++ b/arch/arm/include/asm/mach/arch.h
> @@ -14,6 +14,7 @@ struct tag;
> struct meminfo;
> struct sys_timer;
> struct pt_regs;
> +struct arm_soc_desc;
>
> struct machine_desc {
> unsigned int nr; /* architecture number */
> @@ -35,6 +36,7 @@ struct machine_desc {
> unsigned char reserve_lp1 :1; /* never has lp1 */
> unsigned char reserve_lp2 :1; /* never has lp2 */
> char restart_mode; /* default restart mode */
> + struct arm_soc_desc *soc; /* SoC descriptor */
> void (*fixup)(struct tag *, char **,
> struct meminfo *);
> void (*reserve)(void);/* reserve mem blocks */
> diff --git a/arch/arm/include/asm/soc.h b/arch/arm/include/asm/soc.h
> new file mode 100644
> index 0000000..2d73e35
> --- /dev/null
> +++ b/arch/arm/include/asm/soc.h
> @@ -0,0 +1,19 @@
> +/*
> + * linux/arch/arm/include/asm/soc.h
> + *
> + * Copyright (C) 2011 ARM Ltd.
> + * All Rights Reserved
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef __ASM_ARM_SOC_H
> +#define __ASM_ARM_SOC_H
> +
> +struct arm_soc_desc {
> + const char *name;
> +};
> +
> +#endif /* __ASM_ARM_SOC_H */
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index a255c39..69ac002 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -45,6 +45,7 @@
> #include <asm/cachetype.h>
> #include <asm/tlbflush.h>
> #include <asm/system.h>
> +#include <asm/soc.h>
>
> #include <asm/prom.h>
> #include <asm/mach/arch.h>
> @@ -141,6 +142,7 @@ static const char *cpu_name;
> static const char *machine_name;
> static char __initdata cmd_line[COMMAND_LINE_SIZE];
> struct machine_desc *machine_desc __initdata;
> +static const struct arm_soc_desc *soc_desc __initdata;
>
> static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
> static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } };
> @@ -922,6 +924,11 @@ void __init setup_arch(char **cmdline_p)
> mdesc = setup_machine_tags(machine_arch_type);
> machine_desc = mdesc;
> machine_name = mdesc->name;
> + if (mdesc->soc) {
> + soc_desc = mdesc->soc;
> + pr_info("SoC: %s\n", soc_desc->name);
> + } else
> + soc_desc = NULL;
>
> #ifdef CONFIG_ZONE_DMA
> if (mdesc->dma_zone_size) {
> --
> 1.7.3.4
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations
2012-02-08 0:30 ` [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations Marc Zyngier
2012-02-08 23:42 ` David Brown
@ 2012-02-09 0:02 ` Nicolas Pitre
2012-02-09 8:54 ` Russell King - ARM Linux
2 siblings, 0 replies; 37+ messages in thread
From: Nicolas Pitre @ 2012-02-09 0:02 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 8 Feb 2012, Marc Zyngier wrote:
> Populate the SoC descriptor structure with the SMP and CPU hotplug
> operations. To allow the kernel to continue building, the platform
> hooks are defined as weak symbols which are overrided by the
> platform code. Once all platforms are converted, the "weak" attribute
> will be removed and the function made static.
>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Nicolas Pitre <nico@fluxnic.net>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
You should be able to replace __attribute__((weak)) with simply __weak.
Otherwise:
Acked-by: Nicolas Pitre <nico@linaro.org>
> ---
> arch/arm/include/asm/soc.h | 45 ++++++++++++++++++++++++++++
> arch/arm/kernel/setup.c | 1 +
> arch/arm/kernel/smp.c | 69 ++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 115 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/include/asm/soc.h b/arch/arm/include/asm/soc.h
> index 2d73e35..1bcc58c 100644
> --- a/arch/arm/include/asm/soc.h
> +++ b/arch/arm/include/asm/soc.h
> @@ -12,8 +12,53 @@
> #ifndef __ASM_ARM_SOC_H
> #define __ASM_ARM_SOC_H
>
> +struct task_struct;
> +
> +struct arm_soc_smp_init_ops {
> + /*
> + * Setup the set of possible CPUs (via set_cpu_possible)
> + */
> + void (*smp_init_cpus)(void);
> + /*
> + * Initialize cpu_possible map, and enable coherency
> + */
> + void (*smp_prepare_cpus)(unsigned int max_cpus);
> +};
> +
> +struct arm_soc_smp_ops {
> + /*
> + * Perform platform specific initialisation of the specified CPU.
> + */
> + void (*smp_secondary_init)(unsigned int cpu);
> + /*
> + * Boot a secondary CPU, and assign it the specified idle task.
> + * This also gives us the initial stack to use for this CPU.
> + */
> + int (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle);
> +#ifdef CONFIG_HOTPLUG_CPU
> + int (*cpu_kill)(unsigned int cpu);
> + void (*cpu_die)(unsigned int cpu);
> + int (*cpu_disable)(unsigned int cpu);
> +#endif
> +};
> +
> struct arm_soc_desc {
> const char *name;
> +#ifdef CONFIG_SMP
> + struct arm_soc_smp_init_ops *smp_init_ops;
> + struct arm_soc_smp_ops *smp_ops;
> +#endif
> };
>
> +#ifdef CONFIG_SMP
> +#define soc_smp_init_ops(ops) .smp_init_ops = &(ops),
> +#define soc_smp_ops(ops) .smp_ops = &(ops),
> +extern void soc_smp_ops_register(struct arm_soc_smp_init_ops *,
> + struct arm_soc_smp_ops *);
> +#else
> +#define soc_smp_init_ops(ops) /* empty */
> +#define soc_smp_ops(ops) /* empty */
> +#define soc_smp_ops_register(a,b) do {} while(0)
> +#endif
> +
> #endif /* __ASM_ARM_SOC_H */
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index 69ac002..bf30274 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -927,6 +927,7 @@ void __init setup_arch(char **cmdline_p)
> if (mdesc->soc) {
> soc_desc = mdesc->soc;
> pr_info("SoC: %s\n", soc_desc->name);
> + soc_smp_ops_register(soc_desc->smp_init_ops, soc_desc->smp_ops);
> } else
> soc_desc = NULL;
>
> diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
> index cdeb727..49a904d 100644
> --- a/arch/arm/kernel/smp.c
> +++ b/arch/arm/kernel/smp.c
> @@ -27,6 +27,7 @@
> #include <linux/completion.h>
>
> #include <linux/atomic.h>
> +#include <asm/soc.h>
> #include <asm/cacheflush.h>
> #include <asm/cpu.h>
> #include <asm/cputype.h>
> @@ -127,9 +128,77 @@ int __cpuinit __cpu_up(unsigned int cpu)
> return ret;
> }
>
> +/* SoC helpers */
> +static const struct arm_soc_smp_init_ops *soc_smp_init_ops __initdata;
> +static const struct arm_soc_smp_ops *soc_smp_ops __cpuinitdata;
> +static struct arm_soc_smp_ops __soc_smp_ops __cpuinitdata;
> +
> +void __init soc_smp_ops_register(struct arm_soc_smp_init_ops *smp_init_ops,
> + struct arm_soc_smp_ops *smp_ops)
> +{
> + if (smp_init_ops)
> + soc_smp_init_ops = smp_init_ops;
> +
> + /*
> + * Warning: we're copying an __initdata structure into a
> + * __cpuinitdata structure. We *know* it is valid because only
> + * __cpuinit (or more persistant) functions should be pointed
> + * to by soc_smp_ops. Still, this is borderline ugly.
> + */
> + if (smp_ops) {
> + __soc_smp_ops = *smp_ops;
> + soc_smp_ops = &__soc_smp_ops;
> + }
> +}
> +
> +void __attribute__((weak)) __init smp_init_cpus(void)
> +{
> + if (soc_smp_init_ops && soc_smp_init_ops->smp_init_cpus)
> + soc_smp_init_ops->smp_init_cpus();
> +}
> +
> +void __attribute__((weak)) __init platform_smp_prepare_cpus(unsigned int max_cpus)
> +{
> + if (soc_smp_ops && soc_smp_init_ops->smp_prepare_cpus)
> + soc_smp_init_ops->smp_prepare_cpus(max_cpus);
> +}
> +
> +void __attribute__((weak)) __cpuinit platform_secondary_init(unsigned int cpu)
> +{
> + if (soc_smp_ops && soc_smp_ops->smp_secondary_init)
> + soc_smp_ops->smp_secondary_init(cpu);
> +}
> +
> +int __attribute__((weak)) __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
> +{
> + if (soc_smp_ops && soc_smp_ops->smp_boot_secondary)
> + return soc_smp_ops->smp_boot_secondary(cpu, idle);
> + return -ENOSYS;
> +}
> +
> #ifdef CONFIG_HOTPLUG_CPU
> static void percpu_timer_stop(void);
>
> +int __attribute__((weak)) __cpuinit platform_cpu_kill(unsigned int cpu)
> +{
> + if (soc_smp_ops && soc_smp_ops->cpu_kill)
> + return soc_smp_ops->cpu_kill(cpu);
> + return 0;
> +}
> +
> +void __attribute__((weak)) __cpuinit platform_cpu_die(unsigned int cpu)
> +{
> + if (soc_smp_ops && soc_smp_ops->cpu_die)
> + soc_smp_ops->cpu_die(cpu);
> +}
> +
> +int __attribute__((weak)) __cpuinit platform_cpu_disable(unsigned int cpu)
> +{
> + if (soc_smp_ops && soc_smp_ops->cpu_disable)
> + return soc_smp_ops->cpu_disable(cpu);
> + return -EPERM;
> +}
> +
> /*
> * __cpu_disable runs on the processor to be shutdown.
> */
> --
> 1.7.3.4
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 13/15] ARM: hotplug: Introduce dummy_cpu_kill
2012-02-08 0:30 ` [PATCH v6 13/15] ARM: hotplug: Introduce dummy_cpu_kill Marc Zyngier
@ 2012-02-09 0:16 ` Nicolas Pitre
2012-02-09 0:57 ` Marc Zyngier
2012-02-09 8:46 ` Russell King - ARM Linux
0 siblings, 2 replies; 37+ messages in thread
From: Nicolas Pitre @ 2012-02-09 0:16 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 8 Feb 2012, Marc Zyngier wrote:
> Most platforms don't implement their cpu_kill method.
> Some because they simply don't offer the capability, some other
> because nobody cared enough to implement the necessary code.
>
> Either way, this code is duplicated all over the place. Implement
> a global dummy_cpu_kill method and convert all SMP (but shmobile)
> to use it. Hopefully the "dummy" prefix will be an incentive
> for people to do the right thing.
>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Colin Cross <ccross@android.com>
> Cc: David Brown <davidb@codeaurora.org>
> Cc: Kukjin Kim <kgene.kim@samsung.com>
> Cc: Linus Walleij <linus.walleij@stericsson.com>
> Cc: Magnus Damm <magnus.damm@gmail.com>
> Cc: Nicolas Pitre <nico@fluxnic.net>
> Cc: Paul Mundt <lethal@linux-sh.org>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Stephen Warren <swarren@nvidia.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
What avout this instead:
int __weak __cpuinit platform_cpu_kill(unsigned int cpu)
{
if (!soc_smp_ops)
return 0;
if (!soc_smp_ops->cpu_kill)
return 1;
return soc_smp_ops->cpu_kill(cpu);
}
and get rid of the dummy handler entirely?
> ---
> arch/arm/include/asm/smp_plat.h | 3 +++
> arch/arm/kernel/smp.c | 5 +++++
> arch/arm/mach-exynos/common.h | 1 -
> arch/arm/mach-exynos/hotplug.c | 5 -----
> arch/arm/mach-exynos/platsmp.c | 2 +-
> arch/arm/mach-highbank/core.h | 1 -
> arch/arm/mach-highbank/hotplug.c | 5 -----
> arch/arm/mach-highbank/platsmp.c | 3 ++-
> arch/arm/mach-imx/hotplug.c | 5 -----
> arch/arm/mach-imx/platsmp.c | 3 ++-
> arch/arm/mach-msm/core.h | 1 -
> arch/arm/mach-msm/hotplug.c | 5 -----
> arch/arm/mach-msm/platsmp.c | 2 +-
> arch/arm/mach-omap2/common.h | 1 -
> arch/arm/mach-omap2/omap-hotplug.c | 5 -----
> arch/arm/mach-omap2/omap-smp.c | 3 ++-
> arch/arm/mach-realview/core.h | 1 -
> arch/arm/mach-realview/hotplug.c | 5 -----
> arch/arm/mach-realview/platsmp.c | 3 ++-
> arch/arm/mach-tegra/common.h | 1 -
> arch/arm/mach-tegra/hotplug.c | 5 -----
> arch/arm/mach-tegra/platsmp.c | 3 ++-
> arch/arm/mach-ux500/hotplug.c | 5 -----
> arch/arm/mach-ux500/include/mach/setup.h | 1 -
> arch/arm/mach-ux500/platsmp.c | 2 +-
> arch/arm/mach-vexpress/core.h | 1 -
> arch/arm/mach-vexpress/hotplug.c | 5 -----
> arch/arm/mach-vexpress/platsmp.c | 3 ++-
> arch/arm/plat-mxc/include/mach/common.h | 1 -
> 29 files changed, 23 insertions(+), 63 deletions(-)
>
> diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h
> index 558d6c8..8b2ffe2 100644
> --- a/arch/arm/include/asm/smp_plat.h
> +++ b/arch/arm/include/asm/smp_plat.h
> @@ -49,4 +49,7 @@ static inline int cache_ops_need_broadcast(void)
> extern int __cpu_logical_map[];
> #define cpu_logical_map(cpu) __cpu_logical_map[cpu]
>
> +/* Only use this if your platform doesn't have any CPU PM */
> +extern int dummy_cpu_kill(unsigned int cpu);
> +
> #endif
> diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
> index 5321909..eabd6b8 100644
> --- a/arch/arm/kernel/smp.c
> +++ b/arch/arm/kernel/smp.c
> @@ -179,6 +179,11 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
> #ifdef CONFIG_HOTPLUG_CPU
> static void percpu_timer_stop(void);
>
> +int dummy_cpu_kill(unsigned int cpu)
> +{
> + return 1;
> +}
> +
> static int __cpuinit platform_cpu_kill(unsigned int cpu)
> {
> if (soc_smp_ops && soc_smp_ops->cpu_kill)
> diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
> index cd37455..9046df8 100644
> --- a/arch/arm/mach-exynos/common.h
> +++ b/arch/arm/mach-exynos/common.h
> @@ -31,7 +31,6 @@ extern struct arm_soc_smp_init_ops exynos4_soc_smp_init_ops;
> extern struct arm_soc_smp_ops exynos4_soc_smp_ops;
> extern struct arm_soc_desc exynos4_soc_desc;
>
> -extern int exynos4_cpu_kill(unsigned int cpu);
> extern void exynos4_cpu_die(unsigned int cpu);
> extern int exynos4_cpu_disable(unsigned int cpu);
>
> diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
> index 66e202d..1235df1 100644
> --- a/arch/arm/mach-exynos/hotplug.c
> +++ b/arch/arm/mach-exynos/hotplug.c
> @@ -96,11 +96,6 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
> }
> }
>
> -int exynos4_cpu_kill(unsigned int cpu)
> -{
> - return 1;
> -}
> -
> /*
> * platform-specific code to shutdown a CPU
> *
> diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
> index 9c6e322..b263e63 100644
> --- a/arch/arm/mach-exynos/platsmp.c
> +++ b/arch/arm/mach-exynos/platsmp.c
> @@ -207,7 +207,7 @@ struct arm_soc_smp_ops exynos4_soc_smp_ops __initdata = {
> .smp_secondary_init = exynos4_secondary_init,
> .smp_boot_secondary = exynos4_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> - .cpu_kill = exynos4_cpu_kill,
> + .cpu_kill = dummy_cpu_kill,
> .cpu_die = exynos4_cpu_die,
> .cpu_disable = exynos4_cpu_disable,
> #endif
> diff --git a/arch/arm/mach-highbank/core.h b/arch/arm/mach-highbank/core.h
> index d1fd356..115793e 100644
> --- a/arch/arm/mach-highbank/core.h
> +++ b/arch/arm/mach-highbank/core.h
> @@ -10,7 +10,6 @@ extern void highbank_lluart_map_io(void);
> static inline void highbank_lluart_map_io(void) {}
> #endif
>
> -extern int highbank_cpu_kill(unsigned int cpu);
> extern void highbank_cpu_die(unsigned int cpu);
> extern int highbank_cpu_disable(unsigned int cpu);
>
> diff --git a/arch/arm/mach-highbank/hotplug.c b/arch/arm/mach-highbank/hotplug.c
> index 7c25d49..6fda597 100644
> --- a/arch/arm/mach-highbank/hotplug.c
> +++ b/arch/arm/mach-highbank/hotplug.c
> @@ -24,11 +24,6 @@
>
> extern void secondary_startup(void);
>
> -int highbank_cpu_kill(unsigned int cpu)
> -{
> - return 1;
> -}
> -
> /*
> * platform-specific code to shutdown a CPU
> *
> diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c
> index 24162a7..b90ad83 100644
> --- a/arch/arm/mach-highbank/platsmp.c
> +++ b/arch/arm/mach-highbank/platsmp.c
> @@ -18,6 +18,7 @@
> #include <linux/smp.h>
> #include <linux/io.h>
>
> +#include <asm/smp_plat.h>
> #include <asm/smp_scu.h>
> #include <asm/hardware/gic.h>
>
> @@ -86,7 +87,7 @@ struct arm_soc_smp_ops highbank_soc_smp_ops __initdata = {
> .smp_secondary_init = highbank_secondary_init,
> .smp_boot_secondary = highbank_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> - .cpu_kill = highbank_cpu_kill,
> + .cpu_kill = dummy_cpu_kill,
> .cpu_die = highbank_cpu_die,
> .cpu_disable = highbank_cpu_disable,
> #endif
> diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
> index 474b11d..7e75f8e 100644
> --- a/arch/arm/mach-imx/hotplug.c
> +++ b/arch/arm/mach-imx/hotplug.c
> @@ -14,11 +14,6 @@
> #include <asm/cacheflush.h>
> #include <mach/common.h>
>
> -int imx_cpu_kill(unsigned int cpu)
> -{
> - return 1;
> -}
> -
> /*
> * platform-specific code to shutdown a CPU
> *
> diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
> index ae55931..64d9c9e 100644
> --- a/arch/arm/mach-imx/platsmp.c
> +++ b/arch/arm/mach-imx/platsmp.c
> @@ -13,6 +13,7 @@
> #include <linux/init.h>
> #include <linux/smp.h>
> #include <asm/page.h>
> +#include <asm/smp_plat.h>
> #include <asm/smp_scu.h>
> #include <asm/soc.h>
> #include <asm/hardware/gic.h>
> @@ -94,7 +95,7 @@ struct arm_soc_smp_ops imx_soc_smp_ops __initdata = {
> .smp_secondary_init = imx_secondary_init,
> .smp_boot_secondary = imx_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> - .cpu_kill = imx_cpu_kill,
> + .cpu_kill = dummy_cpu_kill,
> .cpu_die = imx_cpu_die,
> .cpu_disable = imx_cpu_disable,
> #endif
> diff --git a/arch/arm/mach-msm/core.h b/arch/arm/mach-msm/core.h
> index e8394dd..533130d 100644
> --- a/arch/arm/mach-msm/core.h
> +++ b/arch/arm/mach-msm/core.h
> @@ -4,6 +4,5 @@ extern struct arm_soc_smp_init_ops msm_soc_smp_init_ops;
> extern struct arm_soc_smp_ops msm_soc_smp_ops;
> extern struct arm_soc_desc msm_soc_desc;
>
> -extern int msm_cpu_kill(unsigned int cpu);
> extern void msm_cpu_die(unsigned int cpu);
> extern int msm_cpu_disable(unsigned int cpu);
> diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c
> index 6ba3602..5f09e5a1 100644
> --- a/arch/arm/mach-msm/hotplug.c
> +++ b/arch/arm/mach-msm/hotplug.c
> @@ -59,11 +59,6 @@ static inline void platform_do_lowpower(unsigned int cpu)
> }
> }
>
> -int msm_cpu_kill(unsigned int cpu)
> -{
> - return 1;
> -}
> -
> /*
> * platform-specific code to shutdown a CPU
> *
> diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
> index 8b56ae1..0664a91 100644
> --- a/arch/arm/mach-msm/platsmp.c
> +++ b/arch/arm/mach-msm/platsmp.c
> @@ -183,7 +183,7 @@ struct arm_soc_smp_ops msm_soc_smp_ops __initdata = {
> .smp_secondary_init = msm_secondary_init,
> .smp_boot_secondary = msm_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> - .cpu_kill = msm_cpu_kill,
> + .cpu_kill = dummy_cpu_kill,
> .cpu_die = msm_cpu_die,
> .cpu_disable = msm_cpu_disable,
> #endif
> diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
> index 961b79a..e0ae233 100644
> --- a/arch/arm/mach-omap2/common.h
> +++ b/arch/arm/mach-omap2/common.h
> @@ -195,7 +195,6 @@ extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask);
> extern void omap_auxcoreboot_addr(u32 cpu_addr);
> extern u32 omap_read_auxcoreboot0(void);
>
> -extern int omap4_cpu_kill(unsigned int cpu);
> extern void omap4_cpu_die(unsigned int cpu);
> extern int omap4_cpu_disable(unsigned int cpu);
>
> diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c
> index e794f4b..d3d01fe 100644
> --- a/arch/arm/mach-omap2/omap-hotplug.c
> +++ b/arch/arm/mach-omap2/omap-hotplug.c
> @@ -24,11 +24,6 @@
>
> #include "powerdomain.h"
>
> -int omap4_cpu_kill(unsigned int cpu)
> -{
> - return 1;
> -}
> -
> /*
> * platform-specific code to shutdown a CPU
> * Called with IRQs disabled
> diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
> index 4d39fd0..2c97b14 100644
> --- a/arch/arm/mach-omap2/omap-smp.c
> +++ b/arch/arm/mach-omap2/omap-smp.c
> @@ -22,6 +22,7 @@
>
> #include <asm/cacheflush.h>
> #include <asm/hardware/gic.h>
> +#include <asm/smp_plat.h>
> #include <asm/smp_scu.h>
> #include <asm/soc.h>
> #include <mach/hardware.h>
> @@ -191,7 +192,7 @@ struct arm_soc_smp_ops omap4_soc_smp_ops __initdata = {
> .smp_secondary_init = omap4_secondary_init,
> .smp_boot_secondary = omap4_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> - .cpu_kill = omap4_cpu_kill,
> + .cpu_kill = dummy_cpu_kill,
> .cpu_die = omap4_cpu_die,
> .cpu_disable = omap4_cpu_disable,
> #endif
> diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
> index a23caa3..6cdfdf9 100644
> --- a/arch/arm/mach-realview/core.h
> +++ b/arch/arm/mach-realview/core.h
> @@ -71,7 +71,6 @@ extern struct arm_soc_desc realview_soc_desc;
> extern struct arm_soc_smp_init_ops realview_soc_smp_init_ops;
> extern struct arm_soc_smp_ops realview_soc_smp_ops;
>
> -extern int realview_cpu_kill(unsigned int cpu);
> extern void realview_cpu_die(unsigned int cpu);
> extern int realview_cpu_disable(unsigned int cpu);
>
> diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
> index ba4e2a86..7f28a56 100644
> --- a/arch/arm/mach-realview/hotplug.c
> +++ b/arch/arm/mach-realview/hotplug.c
> @@ -88,11 +88,6 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
> }
> }
>
> -int realview_cpu_kill(unsigned int cpu)
> -{
> - return 1;
> -}
> -
> /*
> * platform-specific code to shutdown a CPU
> *
> diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
> index 8e4a865..ebe975e 100644
> --- a/arch/arm/mach-realview/platsmp.c
> +++ b/arch/arm/mach-realview/platsmp.c
> @@ -16,6 +16,7 @@
> #include <mach/hardware.h>
> #include <asm/hardware/gic.h>
> #include <asm/mach-types.h>
> +#include <asm/smp_plat.h>
> #include <asm/smp_scu.h>
> #include <asm/soc.h>
>
> @@ -88,7 +89,7 @@ struct arm_soc_smp_ops realview_soc_smp_ops __initdata = {
> .smp_secondary_init = versatile_secondary_init,
> .smp_boot_secondary = versatile_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> - .cpu_kill = realview_cpu_kill,
> + .cpu_kill = dummy_cpu_kill,
> .cpu_die = realview_cpu_die,
> .cpu_disable = realview_cpu_disable,
> #endif
> diff --git a/arch/arm/mach-tegra/common.h b/arch/arm/mach-tegra/common.h
> index e4c214d..c135700 100644
> --- a/arch/arm/mach-tegra/common.h
> +++ b/arch/arm/mach-tegra/common.h
> @@ -6,6 +6,5 @@ struct arm_soc_smp_ops;
> extern struct arm_soc_smp_init_ops tegra_soc_smp_init_ops;
> extern struct arm_soc_smp_ops tegra_soc_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 7319f5f..51e8690 100644
> --- a/arch/arm/mach-tegra/hotplug.c
> +++ b/arch/arm/mach-tegra/hotplug.c
> @@ -86,11 +86,6 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
> }
> }
>
> -int tegra_cpu_kill(unsigned int cpu)
> -{
> - return 1;
> -}
> -
> /*
> * platform-specific code to shutdown a CPU
> *
> diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
> index 519b110..c31018e 100644
> --- a/arch/arm/mach-tegra/platsmp.c
> +++ b/arch/arm/mach-tegra/platsmp.c
> @@ -22,6 +22,7 @@
> #include <asm/cacheflush.h>
> #include <asm/hardware/gic.h>
> #include <asm/mach-types.h>
> +#include <asm/smp_plat.h>
> #include <asm/smp_scu.h>
> #include <asm/soc.h>
>
> @@ -144,7 +145,7 @@ struct arm_soc_smp_ops tegra_soc_smp_ops __initdata = {
> .smp_secondary_init = tegra_secondary_init,
> .smp_boot_secondary = tegra_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> - .cpu_kill = tegra_cpu_kill,
> + .cpu_kill = dummy_cpu_kill,
> .cpu_die = tegra_cpu_die,
> .cpu_disable = tegra_cpu_disable,
> #endif
> diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c
> index ae1a8eb..1e86d5a 100644
> --- a/arch/arm/mach-ux500/hotplug.c
> +++ b/arch/arm/mach-ux500/hotplug.c
> @@ -36,11 +36,6 @@ static inline void platform_do_lowpower(unsigned int cpu)
> }
> }
>
> -int ux500_cpu_kill(unsigned int cpu)
> -{
> - return 1;
> -}
> -
> /*
> * platform-specific code to shutdown a CPU
> *
> diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
> index e764530..72ba37d 100644
> --- a/arch/arm/mach-ux500/include/mach/setup.h
> +++ b/arch/arm/mach-ux500/include/mach/setup.h
> @@ -55,7 +55,6 @@ extern struct arm_soc_smp_init_ops ux500_soc_smp_init_ops;
> extern struct arm_soc_smp_ops ux500_soc_smp_ops;
> extern struct arm_soc_desc ux500_soc_desc;
>
> -extern int ux500_cpu_kill(unsigned int cpu);
> extern void ux500_cpu_die(unsigned int cpu);
> extern int ux500_cpu_disable(unsigned int cpu);
>
> diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
> index fc72ce1..f105192 100644
> --- a/arch/arm/mach-ux500/platsmp.c
> +++ b/arch/arm/mach-ux500/platsmp.c
> @@ -185,7 +185,7 @@ struct arm_soc_smp_ops ux500_soc_smp_ops __initdata = {
> .smp_secondary_init = ux500_secondary_init,
> .smp_boot_secondary = ux500_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> - .cpu_kill = ux500_cpu_kill,
> + .cpu_kill = dummy_cpu_kill,
> .cpu_die = ux500_cpu_die,
> .cpu_disable = ux500_cpu_disable,
> #endif
> diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
> index bd9065a..f072682 100644
> --- a/arch/arm/mach-vexpress/core.h
> +++ b/arch/arm/mach-vexpress/core.h
> @@ -24,6 +24,5 @@ struct arm_soc_smp_ops;
> extern struct arm_soc_smp_init_ops vexpress_soc_smp_init_ops;
> extern struct arm_soc_smp_ops vexpress_soc_smp_ops;
>
> -extern int vexpress_cpu_kill(unsigned int cpu);
> extern void vexpress_cpu_die(unsigned int cpu);
> extern int vexpress_cpu_disable(unsigned int cpu);
> diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
> index ac6d034..11d2c77 100644
> --- a/arch/arm/mach-vexpress/hotplug.c
> +++ b/arch/arm/mach-vexpress/hotplug.c
> @@ -84,11 +84,6 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
> }
> }
>
> -int vexpress_cpu_kill(unsigned int cpu)
> -{
> - return 1;
> -}
> -
> /*
> * platform-specific code to shutdown a CPU
> *
> diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
> index aba765b..80ab030 100644
> --- a/arch/arm/mach-vexpress/platsmp.c
> +++ b/arch/arm/mach-vexpress/platsmp.c
> @@ -13,6 +13,7 @@
> #include <linux/smp.h>
> #include <linux/io.h>
>
> +#include <asm/smp_plat.h>
> #include <asm/soc.h>
>
> #include <mach/motherboard.h>
> @@ -59,7 +60,7 @@ struct arm_soc_smp_ops vexpress_soc_smp_ops __initdata = {
> .smp_secondary_init = versatile_secondary_init,
> .smp_boot_secondary = versatile_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> - .cpu_kill = vexpress_cpu_kill,
> + .cpu_kill = dummy_cpu_kill,
> .cpu_die = vexpress_cpu_die,
> .cpu_disable = vexpress_cpu_disable,
> #endif
> diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
> index 99c7978..08b241c 100644
> --- a/arch/arm/plat-mxc/include/mach/common.h
> +++ b/arch/arm/plat-mxc/include/mach/common.h
> @@ -133,7 +133,6 @@ extern void imx53_smd_common_init(void);
> extern int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode);
> extern void imx6q_clock_map_io(void);
>
> -extern int imx_cpu_kill(unsigned int cpu);
> extern void imx_cpu_die(unsigned int cpu);
> extern int imx_cpu_disable(unsigned int cpu);
>
> --
> 1.7.3.4
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 14/15] ARM: hotplug: Introduce dummy_cpu_disable
2012-02-08 0:30 ` [PATCH v6 14/15] ARM: hotplug: Introduce dummy_cpu_disable Marc Zyngier
@ 2012-02-09 0:19 ` Nicolas Pitre
0 siblings, 0 replies; 37+ messages in thread
From: Nicolas Pitre @ 2012-02-09 0:19 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 8 Feb 2012, Marc Zyngier wrote:
> Most platforms don't implement their cpu_disable method.
> Some because they simply don't offer the capability, some other
> because nobody cared enough to implement the necessary code.
>
> Either way, this code is duplicated all over the place. Implement
> a global dummy_cpu_disable method and convert all SMP (but shmobile)
> to use it. Hopefully the "dummy" prefix will be an incentive
> for people to do the right thing.
>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Colin Cross <ccross@android.com>
> Cc: David Brown <davidb@codeaurora.org>
> Cc: Kukjin Kim <kgene.kim@samsung.com>
> Cc: Linus Walleij <linus.walleij@stericsson.com>
> Cc: Nicolas Pitre <nico@fluxnic.net>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Stephen Warren <swarren@nvidia.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Couldn't the same strategy as I suggested for cpu_kill be used here too?
> ---
> arch/arm/include/asm/smp_plat.h | 1 +
> arch/arm/kernel/smp.c | 9 +++++++++
> arch/arm/mach-exynos/common.h | 1 -
> arch/arm/mach-exynos/hotplug.c | 9 ---------
> arch/arm/mach-exynos/platsmp.c | 2 +-
> arch/arm/mach-highbank/core.h | 1 -
> arch/arm/mach-highbank/hotplug.c | 9 ---------
> arch/arm/mach-highbank/platsmp.c | 2 +-
> arch/arm/mach-imx/hotplug.c | 9 ---------
> arch/arm/mach-imx/platsmp.c | 2 +-
> arch/arm/mach-msm/core.h | 1 -
> arch/arm/mach-msm/hotplug.c | 9 ---------
> arch/arm/mach-msm/platsmp.c | 2 +-
> arch/arm/mach-omap2/common.h | 1 -
> arch/arm/mach-omap2/omap-hotplug.c | 9 ---------
> arch/arm/mach-omap2/omap-smp.c | 2 +-
> arch/arm/mach-realview/core.h | 1 -
> arch/arm/mach-realview/hotplug.c | 9 ---------
> arch/arm/mach-realview/platsmp.c | 2 +-
> arch/arm/mach-tegra/common.h | 1 -
> arch/arm/mach-tegra/hotplug.c | 9 ---------
> arch/arm/mach-tegra/platsmp.c | 2 +-
> arch/arm/mach-ux500/hotplug.c | 9 ---------
> arch/arm/mach-ux500/include/mach/setup.h | 1 -
> arch/arm/mach-ux500/platsmp.c | 2 +-
> arch/arm/mach-vexpress/core.h | 1 -
> arch/arm/mach-vexpress/hotplug.c | 9 ---------
> arch/arm/mach-vexpress/platsmp.c | 2 +-
> arch/arm/plat-mxc/include/mach/common.h | 1 -
> 29 files changed, 19 insertions(+), 99 deletions(-)
>
> diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h
> index 8b2ffe2..f43d039 100644
> --- a/arch/arm/include/asm/smp_plat.h
> +++ b/arch/arm/include/asm/smp_plat.h
> @@ -51,5 +51,6 @@ extern int __cpu_logical_map[];
>
> /* Only use this if your platform doesn't have any CPU PM */
> extern int dummy_cpu_kill(unsigned int cpu);
> +extern int dummy_cpu_disable(unsigned int cpu);
>
> #endif
> diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
> index eabd6b8..e0d1622 100644
> --- a/arch/arm/kernel/smp.c
> +++ b/arch/arm/kernel/smp.c
> @@ -184,6 +184,15 @@ int dummy_cpu_kill(unsigned int cpu)
> return 1;
> }
>
> +int dummy_cpu_disable(unsigned int cpu)
> +{
> + /*
> + * we don't allow CPU 0 to be shutdown (it is still too special
> + * e.g. clock tick interrupts)
> + */
> + return cpu == 0 ? -EPERM : 0;
> +}
> +
> static int __cpuinit platform_cpu_kill(unsigned int cpu)
> {
> if (soc_smp_ops && soc_smp_ops->cpu_kill)
> diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
> index 9046df8..f13631a 100644
> --- a/arch/arm/mach-exynos/common.h
> +++ b/arch/arm/mach-exynos/common.h
> @@ -32,7 +32,6 @@ extern struct arm_soc_smp_ops exynos4_soc_smp_ops;
> extern struct arm_soc_desc exynos4_soc_desc;
>
> extern void exynos4_cpu_die(unsigned int cpu);
> -extern int exynos4_cpu_disable(unsigned int cpu);
>
> #ifdef CONFIG_ARCH_EXYNOS
> extern int exynos_init(void);
> diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
> index 1235df1..be7a96b 100644
> --- a/arch/arm/mach-exynos/hotplug.c
> +++ b/arch/arm/mach-exynos/hotplug.c
> @@ -120,12 +120,3 @@ void exynos4_cpu_die(unsigned int cpu)
> if (spurious)
> pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
> }
> -
> -int exynos4_cpu_disable(unsigned int cpu)
> -{
> - /*
> - * we don't allow CPU 0 to be shutdown (it is still too special
> - * e.g. clock tick interrupts)
> - */
> - return cpu == 0 ? -EPERM : 0;
> -}
> diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
> index b263e63..4d22c2a 100644
> --- a/arch/arm/mach-exynos/platsmp.c
> +++ b/arch/arm/mach-exynos/platsmp.c
> @@ -209,6 +209,6 @@ struct arm_soc_smp_ops exynos4_soc_smp_ops __initdata = {
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> .cpu_die = exynos4_cpu_die,
> - .cpu_disable = exynos4_cpu_disable,
> + .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-highbank/core.h b/arch/arm/mach-highbank/core.h
> index 115793e..7f4aaca 100644
> --- a/arch/arm/mach-highbank/core.h
> +++ b/arch/arm/mach-highbank/core.h
> @@ -11,7 +11,6 @@ static inline void highbank_lluart_map_io(void) {}
> #endif
>
> extern void highbank_cpu_die(unsigned int cpu);
> -extern int highbank_cpu_disable(unsigned int cpu);
>
> extern struct arm_soc_smp_init_ops highbank_soc_smp_init_ops;
> extern struct arm_soc_smp_ops highbank_soc_smp_ops;
> diff --git a/arch/arm/mach-highbank/hotplug.c b/arch/arm/mach-highbank/hotplug.c
> index 6fda597..1277da3 100644
> --- a/arch/arm/mach-highbank/hotplug.c
> +++ b/arch/arm/mach-highbank/hotplug.c
> @@ -40,12 +40,3 @@ void highbank_cpu_die(unsigned int cpu)
> /* We should never return from idle */
> panic("highbank: cpu %d unexpectedly exit from shutdown\n", cpu);
> }
> -
> -int highbank_cpu_disable(unsigned int cpu)
> -{
> - /*
> - * CPU0 should not be shut down via hotplug. cpu_idle can WFI
> - * or a proper shutdown or hibernate should be used.
> - */
> - return cpu == 0 ? -EPERM : 0;
> -}
> diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c
> index b90ad83..789147d 100644
> --- a/arch/arm/mach-highbank/platsmp.c
> +++ b/arch/arm/mach-highbank/platsmp.c
> @@ -89,6 +89,6 @@ struct arm_soc_smp_ops highbank_soc_smp_ops __initdata = {
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> .cpu_die = highbank_cpu_die,
> - .cpu_disable = highbank_cpu_disable,
> + .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
> index 7e75f8e..63d5144 100644
> --- a/arch/arm/mach-imx/hotplug.c
> +++ b/arch/arm/mach-imx/hotplug.c
> @@ -28,12 +28,3 @@ void imx_cpu_die(unsigned int cpu)
> /* We should never return from idle */
> panic("cpu %d unexpectedly exit from shutdown\n", cpu);
> }
> -
> -int imx_cpu_disable(unsigned int cpu)
> -{
> - /*
> - * we don't allow CPU 0 to be shutdown (it is still too special
> - * e.g. clock tick interrupts)
> - */
> - return cpu == 0 ? -EPERM : 0;
> -}
> diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
> index 64d9c9e..2fea1e3 100644
> --- a/arch/arm/mach-imx/platsmp.c
> +++ b/arch/arm/mach-imx/platsmp.c
> @@ -97,6 +97,6 @@ struct arm_soc_smp_ops imx_soc_smp_ops __initdata = {
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> .cpu_die = imx_cpu_die,
> - .cpu_disable = imx_cpu_disable,
> + .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-msm/core.h b/arch/arm/mach-msm/core.h
> index 533130d..623474a 100644
> --- a/arch/arm/mach-msm/core.h
> +++ b/arch/arm/mach-msm/core.h
> @@ -5,4 +5,3 @@ extern struct arm_soc_smp_ops msm_soc_smp_ops;
> extern struct arm_soc_desc msm_soc_desc;
>
> extern void msm_cpu_die(unsigned int cpu);
> -extern int msm_cpu_disable(unsigned int cpu);
> diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c
> index 5f09e5a1..d0f79e8 100644
> --- a/arch/arm/mach-msm/hotplug.c
> +++ b/arch/arm/mach-msm/hotplug.c
> @@ -78,12 +78,3 @@ void msm_cpu_die(unsigned int cpu)
> */
> cpu_leave_lowpower();
> }
> -
> -int msm_cpu_disable(unsigned int cpu)
> -{
> - /*
> - * we don't allow CPU 0 to be shutdown (it is still too special
> - * e.g. clock tick interrupts)
> - */
> - return cpu == 0 ? -EPERM : 0;
> -}
> diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
> index 0664a91..f7e27d9 100644
> --- a/arch/arm/mach-msm/platsmp.c
> +++ b/arch/arm/mach-msm/platsmp.c
> @@ -185,6 +185,6 @@ struct arm_soc_smp_ops msm_soc_smp_ops __initdata = {
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> .cpu_die = msm_cpu_die,
> - .cpu_disable = msm_cpu_disable,
> + .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
> index e0ae233..c8e3c3e 100644
> --- a/arch/arm/mach-omap2/common.h
> +++ b/arch/arm/mach-omap2/common.h
> @@ -196,7 +196,6 @@ extern void omap_auxcoreboot_addr(u32 cpu_addr);
> extern u32 omap_read_auxcoreboot0(void);
>
> extern void omap4_cpu_die(unsigned int cpu);
> -extern int omap4_cpu_disable(unsigned int cpu);
>
> struct arm_soc_smp_init_ops;
> struct arm_soc_smp_ops;
> diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c
> index d3d01fe..1d95520 100644
> --- a/arch/arm/mach-omap2/omap-hotplug.c
> +++ b/arch/arm/mach-omap2/omap-hotplug.c
> @@ -56,12 +56,3 @@ void omap4_cpu_die(unsigned int cpu)
> pr_debug("CPU%u: spurious wakeup call\n", cpu);
> }
> }
> -
> -int omap4_cpu_disable(unsigned int cpu)
> -{
> - /*
> - * we don't allow CPU 0 to be shutdown (it is still too special
> - * e.g. clock tick interrupts)
> - */
> - return cpu == 0 ? -EPERM : 0;
> -}
> diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
> index 2c97b14..6b1d652 100644
> --- a/arch/arm/mach-omap2/omap-smp.c
> +++ b/arch/arm/mach-omap2/omap-smp.c
> @@ -194,6 +194,6 @@ struct arm_soc_smp_ops omap4_soc_smp_ops __initdata = {
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> .cpu_die = omap4_cpu_die,
> - .cpu_disable = omap4_cpu_disable,
> + .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
> index 6cdfdf9..dd4bcdb 100644
> --- a/arch/arm/mach-realview/core.h
> +++ b/arch/arm/mach-realview/core.h
> @@ -72,6 +72,5 @@ extern struct arm_soc_smp_init_ops realview_soc_smp_init_ops;
> extern struct arm_soc_smp_ops realview_soc_smp_ops;
>
> extern void realview_cpu_die(unsigned int cpu);
> -extern int realview_cpu_disable(unsigned int cpu);
>
> #endif
> diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
> index 7f28a56..12af634 100644
> --- a/arch/arm/mach-realview/hotplug.c
> +++ b/arch/arm/mach-realview/hotplug.c
> @@ -112,12 +112,3 @@ void realview_cpu_die(unsigned int cpu)
> if (spurious)
> pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
> }
> -
> -int realview_cpu_disable(unsigned int cpu)
> -{
> - /*
> - * we don't allow CPU 0 to be shutdown (it is still too special
> - * e.g. clock tick interrupts)
> - */
> - return cpu == 0 ? -EPERM : 0;
> -}
> diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
> index ebe975e..5b7535d 100644
> --- a/arch/arm/mach-realview/platsmp.c
> +++ b/arch/arm/mach-realview/platsmp.c
> @@ -91,6 +91,6 @@ struct arm_soc_smp_ops realview_soc_smp_ops __initdata = {
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> .cpu_die = realview_cpu_die,
> - .cpu_disable = realview_cpu_disable,
> + .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-tegra/common.h b/arch/arm/mach-tegra/common.h
> index c135700..b02cc87 100644
> --- a/arch/arm/mach-tegra/common.h
> +++ b/arch/arm/mach-tegra/common.h
> @@ -7,4 +7,3 @@ extern struct arm_soc_smp_init_ops tegra_soc_smp_init_ops;
> extern struct arm_soc_smp_ops tegra_soc_smp_ops;
>
> 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 51e8690..15433b2 100644
> --- a/arch/arm/mach-tegra/hotplug.c
> +++ b/arch/arm/mach-tegra/hotplug.c
> @@ -110,12 +110,3 @@ void tegra_cpu_die(unsigned int cpu)
> if (spurious)
> pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
> }
> -
> -int tegra_cpu_disable(unsigned int cpu)
> -{
> - /*
> - * we don't allow CPU 0 to be shutdown (it is still too special
> - * e.g. clock tick interrupts)
> - */
> - return cpu == 0 ? -EPERM : 0;
> -}
> diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
> index c31018e..4edc8ab 100644
> --- a/arch/arm/mach-tegra/platsmp.c
> +++ b/arch/arm/mach-tegra/platsmp.c
> @@ -147,6 +147,6 @@ struct arm_soc_smp_ops tegra_soc_smp_ops __initdata = {
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> .cpu_die = tegra_cpu_die,
> - .cpu_disable = tegra_cpu_disable,
> + .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c
> index 1e86d5a..ec1c77f 100644
> --- a/arch/arm/mach-ux500/hotplug.c
> +++ b/arch/arm/mach-ux500/hotplug.c
> @@ -46,12 +46,3 @@ void ux500_cpu_die(unsigned int cpu)
> /* directly enter low power state, skipping secure registers */
> platform_do_lowpower(cpu);
> }
> -
> -int ux500_cpu_disable(unsigned int cpu)
> -{
> - /*
> - * we don't allow CPU 0 to be shutdown (it is still too special
> - * e.g. clock tick interrupts)
> - */
> - return cpu == 0 ? -EPERM : 0;
> -}
> diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
> index 72ba37d..2935f85 100644
> --- a/arch/arm/mach-ux500/include/mach/setup.h
> +++ b/arch/arm/mach-ux500/include/mach/setup.h
> @@ -56,6 +56,5 @@ extern struct arm_soc_smp_ops ux500_soc_smp_ops;
> extern struct arm_soc_desc ux500_soc_desc;
>
> extern void ux500_cpu_die(unsigned int cpu);
> -extern int ux500_cpu_disable(unsigned int cpu);
>
> #endif /* __ASM_ARCH_SETUP_H */
> diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
> index f105192..bbd6480 100644
> --- a/arch/arm/mach-ux500/platsmp.c
> +++ b/arch/arm/mach-ux500/platsmp.c
> @@ -187,6 +187,6 @@ struct arm_soc_smp_ops ux500_soc_smp_ops __initdata = {
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> .cpu_die = ux500_cpu_die,
> - .cpu_disable = ux500_cpu_disable,
> + .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
> index f072682..d9b1ec0 100644
> --- a/arch/arm/mach-vexpress/core.h
> +++ b/arch/arm/mach-vexpress/core.h
> @@ -25,4 +25,3 @@ extern struct arm_soc_smp_init_ops vexpress_soc_smp_init_ops;
> extern struct arm_soc_smp_ops vexpress_soc_smp_ops;
>
> extern void vexpress_cpu_die(unsigned int cpu);
> -extern int vexpress_cpu_disable(unsigned int cpu);
> diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
> index 11d2c77..e1a7fef 100644
> --- a/arch/arm/mach-vexpress/hotplug.c
> +++ b/arch/arm/mach-vexpress/hotplug.c
> @@ -108,12 +108,3 @@ void vexpress_cpu_die(unsigned int cpu)
> if (spurious)
> pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
> }
> -
> -int vexpress_cpu_disable(unsigned int cpu)
> -{
> - /*
> - * we don't allow CPU 0 to be shutdown (it is still too special
> - * e.g. clock tick interrupts)
> - */
> - return cpu == 0 ? -EPERM : 0;
> -}
> diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
> index 80ab030..a5196f87 100644
> --- a/arch/arm/mach-vexpress/platsmp.c
> +++ b/arch/arm/mach-vexpress/platsmp.c
> @@ -62,6 +62,6 @@ struct arm_soc_smp_ops vexpress_soc_smp_ops __initdata = {
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> .cpu_die = vexpress_cpu_die,
> - .cpu_disable = vexpress_cpu_disable,
> + .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
> index 08b241c..c0d0a21 100644
> --- a/arch/arm/plat-mxc/include/mach/common.h
> +++ b/arch/arm/plat-mxc/include/mach/common.h
> @@ -134,7 +134,6 @@ extern int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode);
> extern void imx6q_clock_map_io(void);
>
> extern void imx_cpu_die(unsigned int cpu);
> -extern int imx_cpu_disable(unsigned int cpu);
>
> #ifdef CONFIG_PM
> extern void imx6q_pm_init(void);
> --
> 1.7.3.4
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 15/15] ARM: hotplug: add cpu_lowpower as an alternative to cpu_die
2012-02-08 0:30 ` [PATCH v6 15/15] ARM: hotplug: add cpu_lowpower as an alternative to cpu_die Marc Zyngier
@ 2012-02-09 0:21 ` Nicolas Pitre
2012-02-09 8:48 ` Russell King - ARM Linux
1 sibling, 0 replies; 37+ messages in thread
From: Nicolas Pitre @ 2012-02-09 0:21 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 8 Feb 2012, Marc Zyngier wrote:
> Most platforms don't actually implement cpu_die, but instead
> a "go into low power mode" operation.
>
> Factor these similar implementations into a single one called
> from platform_cpu_die().
>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Colin Cross <ccross@android.com>
> Cc: David Brown <davidb@codeaurora.org>
> Cc: Kukjin Kim <kgene.kim@samsung.com>
> Cc: Linus Walleij <linus.walleij@stericsson.com>
> Cc: Nicolas Pitre <nico@fluxnic.net>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Stephen Warren <swarren@nvidia.com>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
> ---
> arch/arm/include/asm/soc.h | 1 +
> arch/arm/kernel/smp.c | 16 ++++++++-
> arch/arm/mach-exynos/common.h | 2 +-
> arch/arm/mach-exynos/hotplug.c | 27 +--------------
> arch/arm/mach-exynos/platsmp.c | 2 +-
> arch/arm/mach-msm/core.h | 2 +-
> arch/arm/mach-msm/hotplug.c | 22 +-----------
> arch/arm/mach-msm/platsmp.c | 2 +-
> arch/arm/mach-realview/core.h | 2 +-
> arch/arm/mach-realview/hotplug.c | 27 +--------------
> arch/arm/mach-realview/platsmp.c | 2 +-
> arch/arm/mach-tegra/common.h | 2 +-
> arch/arm/mach-tegra/hotplug.c | 53 ++++--------------------------
> arch/arm/mach-tegra/platsmp.c | 2 +-
> arch/arm/mach-ux500/hotplug.c | 14 +-------
> arch/arm/mach-ux500/include/mach/setup.h | 2 +-
> arch/arm/mach-ux500/platsmp.c | 2 +-
> arch/arm/mach-vexpress/core.h | 2 +-
> arch/arm/mach-vexpress/hotplug.c | 27 +--------------
> arch/arm/mach-vexpress/platsmp.c | 2 +-
> 20 files changed, 44 insertions(+), 167 deletions(-)
>
> diff --git a/arch/arm/include/asm/soc.h b/arch/arm/include/asm/soc.h
> index 1bcc58c..f1b6c45 100644
> --- a/arch/arm/include/asm/soc.h
> +++ b/arch/arm/include/asm/soc.h
> @@ -38,6 +38,7 @@ struct arm_soc_smp_ops {
> #ifdef CONFIG_HOTPLUG_CPU
> int (*cpu_kill)(unsigned int cpu);
> void (*cpu_die)(unsigned int cpu);
> + void (*cpu_lowpower)(unsigned int cpu, int *spurious);
> int (*cpu_disable)(unsigned int cpu);
> #endif
> };
> diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
> index e0d1622..34318aa 100644
> --- a/arch/arm/kernel/smp.c
> +++ b/arch/arm/kernel/smp.c
> @@ -202,8 +202,20 @@ static int __cpuinit platform_cpu_kill(unsigned int cpu)
>
> static void __cpuinit platform_cpu_die(unsigned int cpu)
> {
> - if (soc_smp_ops && soc_smp_ops->cpu_die)
> - soc_smp_ops->cpu_die(cpu);
> + if (soc_smp_ops) {
> + if (soc_smp_ops->cpu_die) {
> + soc_smp_ops->cpu_die(cpu);
> + return;
> + }
> +
> + if (soc_smp_ops->cpu_lowpower) {
> + int spurious = 0;
> + soc_smp_ops->cpu_lowpower(cpu, &spurious);
> + if (spurious)
> + pr_warn("CPU%u: %u spurious wakeup calls\n",
> + cpu, spurious);
> + }
> + }
> }
>
> static int __cpuinit platform_cpu_disable(unsigned int cpu)
> diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
> index f13631a..d664f6e 100644
> --- a/arch/arm/mach-exynos/common.h
> +++ b/arch/arm/mach-exynos/common.h
> @@ -31,7 +31,7 @@ extern struct arm_soc_smp_init_ops exynos4_soc_smp_init_ops;
> extern struct arm_soc_smp_ops exynos4_soc_smp_ops;
> extern struct arm_soc_desc exynos4_soc_desc;
>
> -extern void exynos4_cpu_die(unsigned int cpu);
> +extern void exynos4_cpu_lowpower(unsigned int cpu, int *spurious);
>
> #ifdef CONFIG_ARCH_EXYNOS
> extern int exynos_init(void);
> diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
> index be7a96b..aed75cb 100644
> --- a/arch/arm/mach-exynos/hotplug.c
> +++ b/arch/arm/mach-exynos/hotplug.c
> @@ -62,8 +62,9 @@ static inline void cpu_leave_lowpower(void)
> : "cc");
> }
>
> -static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
> +void exynos4_cpu_lowpower(unsigned int cpu, int *spurious)
> {
> + cpu_enter_lowpower();
> for (;;) {
>
> /* make cpu1 to be turned off at next WFI command */
> @@ -94,29 +95,5 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
> */
> (*spurious)++;
> }
> -}
> -
> -/*
> - * platform-specific code to shutdown a CPU
> - *
> - * Called with IRQs disabled
> - */
> -void exynos4_cpu_die(unsigned int cpu)
> -{
> - int spurious = 0;
> -
> - /*
> - * we're ready for shutdown now, so do it
> - */
> - cpu_enter_lowpower();
> - platform_do_lowpower(cpu, &spurious);
> -
> - /*
> - * bring this CPU back into the world of cache
> - * coherency, and then restore interrupts
> - */
> cpu_leave_lowpower();
> -
> - if (spurious)
> - pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
> }
> diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
> index 4d22c2a..8469ac8 100644
> --- a/arch/arm/mach-exynos/platsmp.c
> +++ b/arch/arm/mach-exynos/platsmp.c
> @@ -208,7 +208,7 @@ struct arm_soc_smp_ops exynos4_soc_smp_ops __initdata = {
> .smp_boot_secondary = exynos4_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> - .cpu_die = exynos4_cpu_die,
> + .cpu_lowpower = exynos4_cpu_lowpower,
> .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-msm/core.h b/arch/arm/mach-msm/core.h
> index 623474a..a5c50c4 100644
> --- a/arch/arm/mach-msm/core.h
> +++ b/arch/arm/mach-msm/core.h
> @@ -4,4 +4,4 @@ extern struct arm_soc_smp_init_ops msm_soc_smp_init_ops;
> extern struct arm_soc_smp_ops msm_soc_smp_ops;
> extern struct arm_soc_desc msm_soc_desc;
>
> -extern void msm_cpu_die(unsigned int cpu);
> +extern void msm_cpu_lowpower(unsigned int cpu, int *spurious);
> diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c
> index d0f79e8..6e6ed2d 100644
> --- a/arch/arm/mach-msm/hotplug.c
> +++ b/arch/arm/mach-msm/hotplug.c
> @@ -28,9 +28,10 @@ static inline void cpu_leave_lowpower(void)
> {
> }
>
> -static inline void platform_do_lowpower(unsigned int cpu)
> +void msm_cpu_lowpower(unsigned int cpu, int *spurious)
> {
> /* Just enter wfi for now. TODO: Properly shut off the cpu. */
> + cpu_enter_lowpower();
> for (;;) {
> /*
> * here's the WFI
> @@ -57,24 +58,5 @@ static inline void platform_do_lowpower(unsigned int cpu)
> */
> pr_debug("CPU%u: spurious wakeup call\n", cpu);
> }
> -}
> -
> -/*
> - * platform-specific code to shutdown a CPU
> - *
> - * Called with IRQs disabled
> - */
> -void msm_cpu_die(unsigned int cpu)
> -{
> - /*
> - * we're ready for shutdown now, so do it
> - */
> - cpu_enter_lowpower();
> - platform_do_lowpower(cpu);
> -
> - /*
> - * bring this CPU back into the world of cache
> - * coherency, and then restore interrupts
> - */
> cpu_leave_lowpower();
> }
> diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
> index f7e27d9..5e153cf 100644
> --- a/arch/arm/mach-msm/platsmp.c
> +++ b/arch/arm/mach-msm/platsmp.c
> @@ -184,7 +184,7 @@ struct arm_soc_smp_ops msm_soc_smp_ops __initdata = {
> .smp_boot_secondary = msm_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> - .cpu_die = msm_cpu_die,
> + .cpu_lowpower = msm_cpu_lowpower,
> .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
> index dd4bcdb..b593b36 100644
> --- a/arch/arm/mach-realview/core.h
> +++ b/arch/arm/mach-realview/core.h
> @@ -71,6 +71,6 @@ extern struct arm_soc_desc realview_soc_desc;
> extern struct arm_soc_smp_init_ops realview_soc_smp_init_ops;
> extern struct arm_soc_smp_ops realview_soc_smp_ops;
>
> -extern void realview_cpu_die(unsigned int cpu);
> +extern void realview_cpu_lowpower(unsigned int cpu, int *spurious);
>
> #endif
> diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
> index 12af634..4d45d07 100644
> --- a/arch/arm/mach-realview/hotplug.c
> +++ b/arch/arm/mach-realview/hotplug.c
> @@ -54,13 +54,14 @@ static inline void cpu_leave_lowpower(void)
> : "cc");
> }
>
> -static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
> +void realview_cpu_lowpower(unsigned int cpu, int *spurious)
> {
> /*
> * there is no power-control hardware on this platform, so all
> * we can do is put the core into WFI; this is safe as the calling
> * code will have already disabled interrupts
> */
> + cpu_enter_lowpower();
> for (;;) {
> /*
> * here's the WFI
> @@ -86,29 +87,5 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
> */
> (*spurious)++;
> }
> -}
> -
> -/*
> - * platform-specific code to shutdown a CPU
> - *
> - * Called with IRQs disabled
> - */
> -void realview_cpu_die(unsigned int cpu)
> -{
> - int spurious = 0;
> -
> - /*
> - * we're ready for shutdown now, so do it
> - */
> - cpu_enter_lowpower();
> - platform_do_lowpower(cpu, &spurious);
> -
> - /*
> - * bring this CPU back into the world of cache
> - * coherency, and then restore interrupts
> - */
> cpu_leave_lowpower();
> -
> - if (spurious)
> - pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
> }
> diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
> index 5b7535d..eb6b532 100644
> --- a/arch/arm/mach-realview/platsmp.c
> +++ b/arch/arm/mach-realview/platsmp.c
> @@ -90,7 +90,7 @@ struct arm_soc_smp_ops realview_soc_smp_ops __initdata = {
> .smp_boot_secondary = versatile_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> - .cpu_die = realview_cpu_die,
> + .cpu_lowpower = realview_cpu_lowpower,
> .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-tegra/common.h b/arch/arm/mach-tegra/common.h
> index b02cc87..38b9ea4 100644
> --- a/arch/arm/mach-tegra/common.h
> +++ b/arch/arm/mach-tegra/common.h
> @@ -6,4 +6,4 @@ struct arm_soc_smp_ops;
> extern struct arm_soc_smp_init_ops tegra_soc_smp_init_ops;
> extern struct arm_soc_smp_ops tegra_soc_smp_ops;
>
> -extern void tegra_cpu_die(unsigned int cpu);
> +extern void tegra_cpu_lowpower(unsigned int cpu, int *spurious);
> diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
> index 15433b2..455a077 100644
> --- a/arch/arm/mach-tegra/hotplug.c
> +++ b/arch/arm/mach-tegra/hotplug.c
> @@ -52,61 +52,22 @@ static inline void cpu_leave_lowpower(void)
> : "cc");
> }
>
> -static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
> +void tegra_cpu_lowpower(unsigned int cpu, int *spurious)
> {
> /*
> * there is no power-control hardware on this platform, so all
> * we can do is put the core into WFI; this is safe as the calling
> * code will have already disabled interrupts
> */
> - for (;;) {
> - /*
> - * here's the WFI
> - */
> - asm(".word 0xe320f003\n"
> - :
> - :
> - : "memory", "cc");
> -
> - /*if (pen_release == cpu) {*/
> - /*
> - * OK, proper wakeup, we're done
> - */
> - break;
> - /*}*/
> -
> - /*
> - * Getting here, means that we have come out of WFI without
> - * having been woken up - this shouldn't happen
> - *
> - * Just note it happening - when we're woken, we can report
> - * its occurrence.
> - */
> - (*spurious)++;
> - }
> -}
> -
> -/*
> - * platform-specific code to shutdown a CPU
> - *
> - * Called with IRQs disabled
> - */
> -void tegra_cpu_die(unsigned int cpu)
> -{
> - int spurious = 0;
> -
> - /*
> - * we're ready for shutdown now, so do it
> - */
> cpu_enter_lowpower();
> - platform_do_lowpower(cpu, &spurious);
>
> /*
> - * bring this CPU back into the world of cache
> - * coherency, and then restore interrupts
> + * here's the WFI
> */
> - cpu_leave_lowpower();
> + asm("wfi\n"
> + :
> + :
> + : "memory", "cc");
>
> - if (spurious)
> - pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
> + cpu_leave_lowpower();
> }
> diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
> index 4edc8ab..5d1593c 100644
> --- a/arch/arm/mach-tegra/platsmp.c
> +++ b/arch/arm/mach-tegra/platsmp.c
> @@ -146,7 +146,7 @@ struct arm_soc_smp_ops tegra_soc_smp_ops __initdata = {
> .smp_boot_secondary = tegra_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> - .cpu_die = tegra_cpu_die,
> + .cpu_lowpower = tegra_cpu_lowpower,
> .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c
> index ec1c77f..c46b01d 100644
> --- a/arch/arm/mach-ux500/hotplug.c
> +++ b/arch/arm/mach-ux500/hotplug.c
> @@ -19,7 +19,7 @@
>
> extern volatile int pen_release;
>
> -static inline void platform_do_lowpower(unsigned int cpu)
> +void ux500_cpu_lowpower(unsigned int cpu, int *spurious)
> {
> flush_cache_all();
>
> @@ -33,16 +33,6 @@ static inline void platform_do_lowpower(unsigned int cpu)
> */
> break;
> }
> + (*spurious)++;
> }
> }
> -
> -/*
> - * platform-specific code to shutdown a CPU
> - *
> - * Called with IRQs disabled
> - */
> -void ux500_cpu_die(unsigned int cpu)
> -{
> - /* directly enter low power state, skipping secure registers */
> - platform_do_lowpower(cpu);
> -}
> diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
> index 2935f85..127fd0b 100644
> --- a/arch/arm/mach-ux500/include/mach/setup.h
> +++ b/arch/arm/mach-ux500/include/mach/setup.h
> @@ -55,6 +55,6 @@ extern struct arm_soc_smp_init_ops ux500_soc_smp_init_ops;
> extern struct arm_soc_smp_ops ux500_soc_smp_ops;
> extern struct arm_soc_desc ux500_soc_desc;
>
> -extern void ux500_cpu_die(unsigned int cpu);
> +extern void ux500_cpu_lowpower(unsigned int cpu, int *spurious)l
>
> #endif /* __ASM_ARCH_SETUP_H */
> diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
> index bbd6480..f19ba4e 100644
> --- a/arch/arm/mach-ux500/platsmp.c
> +++ b/arch/arm/mach-ux500/platsmp.c
> @@ -186,7 +186,7 @@ struct arm_soc_smp_ops ux500_soc_smp_ops __initdata = {
> .smp_boot_secondary = ux500_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> - .cpu_die = ux500_cpu_die,
> + .cpu_lowpower = ux500_cpu_lowpower,
> .cpu_disable = dummy_cpu_disable,
> #endif
> };
> diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
> index d9b1ec0..413e889 100644
> --- a/arch/arm/mach-vexpress/core.h
> +++ b/arch/arm/mach-vexpress/core.h
> @@ -24,4 +24,4 @@ struct arm_soc_smp_ops;
> extern struct arm_soc_smp_init_ops vexpress_soc_smp_init_ops;
> extern struct arm_soc_smp_ops vexpress_soc_smp_ops;
>
> -extern void vexpress_cpu_die(unsigned int cpu);
> +extern void vexpress_cpu_lowpower(unsigned int cpu, int *spurious)
> diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
> index e1a7fef..4c87adc 100644
> --- a/arch/arm/mach-vexpress/hotplug.c
> +++ b/arch/arm/mach-vexpress/hotplug.c
> @@ -56,13 +56,14 @@ static inline void cpu_leave_lowpower(void)
> : "cc");
> }
>
> -static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
> +void vexpress_cpu_lowpower(unsigned int cpu, int *spurious)
> {
> /*
> * there is no power-control hardware on this platform, so all
> * we can do is put the core into WFI; this is safe as the calling
> * code will have already disabled interrupts
> */
> + cpu_enter_lowpower();
> for (;;) {
> wfi();
>
> @@ -82,29 +83,5 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
> */
> (*spurious)++;
> }
> -}
> -
> -/*
> - * platform-specific code to shutdown a CPU
> - *
> - * Called with IRQs disabled
> - */
> -void vexpress_cpu_die(unsigned int cpu)
> -{
> - int spurious = 0;
> -
> - /*
> - * we're ready for shutdown now, so do it
> - */
> - cpu_enter_lowpower();
> - platform_do_lowpower(cpu, &spurious);
> -
> - /*
> - * bring this CPU back into the world of cache
> - * coherency, and then restore interrupts
> - */
> cpu_leave_lowpower();
> -
> - if (spurious)
> - pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
> }
> diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
> index a5196f87..5630d2b 100644
> --- a/arch/arm/mach-vexpress/platsmp.c
> +++ b/arch/arm/mach-vexpress/platsmp.c
> @@ -61,7 +61,7 @@ struct arm_soc_smp_ops vexpress_soc_smp_ops __initdata = {
> .smp_boot_secondary = versatile_boot_secondary,
> #ifdef CONFIG_HOTPLUG_CPU
> .cpu_kill = dummy_cpu_kill,
> - .cpu_die = vexpress_cpu_die,
> + .cpu_lowpower = vexpress_cpu_lowpower,
> .cpu_disable = dummy_cpu_disable,
> #endif
> };
> --
> 1.7.3.4
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 13/15] ARM: hotplug: Introduce dummy_cpu_kill
2012-02-09 0:16 ` Nicolas Pitre
@ 2012-02-09 0:57 ` Marc Zyngier
2012-02-09 8:46 ` Russell King - ARM Linux
1 sibling, 0 replies; 37+ messages in thread
From: Marc Zyngier @ 2012-02-09 0:57 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 8 Feb 2012 16:16:24 -0800 (PST), Nicolas Pitre
<nicolas.pitre@linaro.org> wrote:
> On Wed, 8 Feb 2012, Marc Zyngier wrote:
>
>> Most platforms don't implement their cpu_kill method.
>> Some because they simply don't offer the capability, some other
>> because nobody cared enough to implement the necessary code.
>>
>> Either way, this code is duplicated all over the place. Implement
>> a global dummy_cpu_kill method and convert all SMP (but shmobile)
>> to use it. Hopefully the "dummy" prefix will be an incentive
>> for people to do the right thing.
>>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: Colin Cross <ccross@android.com>
>> Cc: David Brown <davidb@codeaurora.org>
>> Cc: Kukjin Kim <kgene.kim@samsung.com>
>> Cc: Linus Walleij <linus.walleij@stericsson.com>
>> Cc: Magnus Damm <magnus.damm@gmail.com>
>> Cc: Nicolas Pitre <nico@fluxnic.net>
>> Cc: Paul Mundt <lethal@linux-sh.org>
>> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> Cc: Stephen Warren <swarren@nvidia.com>
>> Cc: Shawn Guo <shawn.guo@linaro.org>
>> Cc: Rob Herring <rob.herring@calxeda.com>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>
> What avout this instead:
>
> int __weak __cpuinit platform_cpu_kill(unsigned int cpu)
> {
> if (!soc_smp_ops)
> return 0;
> if (!soc_smp_ops->cpu_kill)
> return 1;
> return soc_smp_ops->cpu_kill(cpu);
> }
>
> and get rid of the dummy handler entirely?
I thought the "dummy" prefix would maybe give maintainers a chance to
think whether or not this is the best they can do (given that they mostly
copied the RealView code, I'm quite sure it is possible...). I'll use your
approach if you think it's better.
M.
--
Fast, cheap, reliable. Pick two.
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations
2012-02-08 23:42 ` David Brown
@ 2012-02-09 1:00 ` Marc Zyngier
2012-02-09 1:28 ` David Brown
2012-02-10 0:03 ` Arnd Bergmann
1 sibling, 1 reply; 37+ messages in thread
From: Marc Zyngier @ 2012-02-09 1:00 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 8 Feb 2012 15:42:53 -0800, David Brown <davidb@codeaurora.org>
wrote:
> On Wed, Feb 08, 2012 at 12:30:46AM +0000, Marc Zyngier wrote:
>
>> +#ifdef CONFIG_SMP
>> +#define soc_smp_init_ops(ops) .smp_init_ops = &(ops),
>> +#define soc_smp_ops(ops) .smp_ops = &(ops),
>> +extern void soc_smp_ops_register(struct arm_soc_smp_init_ops *,
>> + struct arm_soc_smp_ops *);
>> +#else
>> +#define soc_smp_init_ops(ops) /* empty */
>> +#define soc_smp_ops(ops) /* empty */
>> +#define soc_smp_ops_register(a,b) do {} while(0)
>> +#endif
>
> I'm not sure if this bothers anyone else, but these macros mess up
> editors that know how to indent C code, since the comma ends up inside
> the macro. I'm not sure I have a better idea, though.
Emacs seem quite happy when I wrote the code... Shall we re-open the
editor war? ;-)
M.
--
Fast, cheap, reliable. Pick two.
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations
2012-02-09 1:00 ` Marc Zyngier
@ 2012-02-09 1:28 ` David Brown
0 siblings, 0 replies; 37+ messages in thread
From: David Brown @ 2012-02-09 1:28 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Feb 09, 2012 at 02:00:48AM +0100, Marc Zyngier wrote:
>
> On Wed, 8 Feb 2012 15:42:53 -0800, David Brown <davidb@codeaurora.org>
> wrote:
> > On Wed, Feb 08, 2012 at 12:30:46AM +0000, Marc Zyngier wrote:
> >
> >> +#ifdef CONFIG_SMP
> >> +#define soc_smp_init_ops(ops) .smp_init_ops = &(ops),
> >> +#define soc_smp_ops(ops) .smp_ops = &(ops),
> >> +extern void soc_smp_ops_register(struct arm_soc_smp_init_ops *,
> >> + struct arm_soc_smp_ops *);
> >> +#else
> >> +#define soc_smp_init_ops(ops) /* empty */
> >> +#define soc_smp_ops(ops) /* empty */
> >> +#define soc_smp_ops_register(a,b) do {} while(0)
> >> +#endif
> >
> > I'm not sure if this bothers anyone else, but these macros mess up
> > editors that know how to indent C code, since the comma ends up inside
> > the macro. I'm not sure I have a better idea, though.
>
> Emacs seem quite happy when I wrote the code... Shall we re-open the
> editor war? ;-)
It is interesting that emacs gets it right (seem to use both emacs and
vi depending on my mood). I guess treating it as a function call
isn't valid C, so either interpretation in an editor is really right.
I guess just leave it. The structs are small, and it isn't too hard
lo fix things up. As I said earlier, I can't think of a better way to
do it.
Davi
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 08/15] ARM: SoC: convert ux500 to SoC descriptor
2012-02-08 22:31 ` Linus Walleij
@ 2012-02-09 5:29 ` Srinidhi KASAGAR
0 siblings, 0 replies; 37+ messages in thread
From: Srinidhi KASAGAR @ 2012-02-09 5:29 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Feb 08, 2012 at 23:31:08 +0100, Linus Walleij wrote:
> On Wed, Feb 8, 2012 at 1:30 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
>
> > Convert ux500 platforms to use the SoC descriptor to provide
> > their SMP and CPU hotplug operations.
> >
> > Cc: Linus Walleij <linus.walleij@stericsson.com>
> > Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>
> Srinidhi, can you check this patch series? I feel you are better than
> me at the things Marc is consolidating. It looks good to me though.
Looks ok to me.
Acked-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com>
Srinidhi
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 13/15] ARM: hotplug: Introduce dummy_cpu_kill
2012-02-09 0:16 ` Nicolas Pitre
2012-02-09 0:57 ` Marc Zyngier
@ 2012-02-09 8:46 ` Russell King - ARM Linux
2012-02-09 22:48 ` Will Deacon
1 sibling, 1 reply; 37+ messages in thread
From: Russell King - ARM Linux @ 2012-02-09 8:46 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Feb 08, 2012 at 04:16:24PM -0800, Nicolas Pitre wrote:
> What avout this instead:
>
> int __weak __cpuinit platform_cpu_kill(unsigned int cpu)
> {
> if (!soc_smp_ops)
> return 0;
> if (!soc_smp_ops->cpu_kill)
> return 1;
> return soc_smp_ops->cpu_kill(cpu);
> }
>
> and get rid of the dummy handler entirely?
No. This is silly. Think about it - if you don't provide a cpu_kill
then you can't support the unplug operation. So you shouldn't even
allow the system to get anywhere near this.
So get rid of the tests for soc_smp_ops and soc_smp_ops->cpu_kill, and
just make this a simple:
return soc_smp_ops->cpu_kill(cpu);
I'm not sure that the call to platform_cpu_kill() in ipi_cpu_stop() is
correct - platform_cpu_kill() is supposed to run on a CPU which is not
the one going down, whereas platform_cpu_die() runs on the CPU which
is going down.
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 15/15] ARM: hotplug: add cpu_lowpower as an alternative to cpu_die
2012-02-08 0:30 ` [PATCH v6 15/15] ARM: hotplug: add cpu_lowpower as an alternative to cpu_die Marc Zyngier
2012-02-09 0:21 ` Nicolas Pitre
@ 2012-02-09 8:48 ` Russell King - ARM Linux
1 sibling, 0 replies; 37+ messages in thread
From: Russell King - ARM Linux @ 2012-02-09 8:48 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Feb 08, 2012 at 12:30:59AM +0000, Marc Zyngier wrote:
> Most platforms don't actually implement cpu_die, but instead
> a "go into low power mode" operation.
NAK. Don't encourage this broken low power stuff from platform
people.
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations
2012-02-08 0:30 ` [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations Marc Zyngier
2012-02-08 23:42 ` David Brown
2012-02-09 0:02 ` Nicolas Pitre
@ 2012-02-09 8:54 ` Russell King - ARM Linux
2 siblings, 0 replies; 37+ messages in thread
From: Russell King - ARM Linux @ 2012-02-09 8:54 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Feb 08, 2012 at 12:30:46AM +0000, Marc Zyngier wrote:
> Populate the SoC descriptor structure with the SMP and CPU hotplug
> operations. To allow the kernel to continue building, the platform
> hooks are defined as weak symbols which are overrided by the
> platform code. Once all platforms are converted, the "weak" attribute
> will be removed and the function made static.
NAK.
Why do we need two structures, one for init and one for non-init. Where
these are used, they're both marked with __initdata.
If anything, you want to separate out the hotplug stuff, because you'll
be referencing __cpu* marked functions from __initdata, which I believe
will give a section mismatch warning.
Also, you'll get section mismatch warnings for calling __cpuinit functions
from __cpuexit marked code.
You did build this with CONFIG_DEBUG_SECTION_MISMATCH=y before sending it
out?
So, all in all this causes a lot of additional section mismatches, and so
needs reworking.
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 13/15] ARM: hotplug: Introduce dummy_cpu_kill
2012-02-09 8:46 ` Russell King - ARM Linux
@ 2012-02-09 22:48 ` Will Deacon
0 siblings, 0 replies; 37+ messages in thread
From: Will Deacon @ 2012-02-09 22:48 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Feb 09, 2012 at 08:46:42AM +0000, Russell King - ARM Linux wrote:
> I'm not sure that the call to platform_cpu_kill() in ipi_cpu_stop() is
> correct - platform_cpu_kill() is supposed to run on a CPU which is not
> the one going down, whereas platform_cpu_die() runs on the CPU which
> is going down.
I added that call for the kexec down path, where we re-use the hotplug
code to kill a CPU and put it into a state where the new kernel can boot
it via the usual SMP bringup path.
If we need to ensure that the code runs on the CPU making the kexec then
we need to hack smp_send_stop to make the callback for each CPU that was
offlined (untested patch below). The only alternative I can think of is
to add a platform callback from machine_kexec before we tear down the
final processor but this precludes any reuse of the hotplug code.
Will
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index cdeb727..3d279f7 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -506,10 +506,6 @@ static void ipi_cpu_stop(unsigned int cpu)
local_fiq_disable();
local_irq_disable();
-#ifdef CONFIG_HOTPLUG_CPU
- platform_cpu_kill(cpu);
-#endif
-
while (1)
cpu_relax();
}
@@ -572,16 +568,25 @@ void smp_send_reschedule(int cpu)
smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE);
}
+#ifdef CONFIG_HOTPLUG_CPU
+static void smp_kill_cpus(cpumask_t *mask)
+{
+ unsigned int cpu;
+ for_each_cpu(cpu, mask)
+ platform_cpu_kill(cpu);
+}
+#else
+static void smp_kill_cpus(cpumask_t *mask) { }
+#endif
+
void smp_send_stop(void)
{
unsigned long timeout;
+ cpumask_t mask = cpu_online_map;
+ cpu_clear(smp_processor_id(), mask);
- if (num_online_cpus() > 1) {
- cpumask_t mask = cpu_online_map;
- cpu_clear(smp_processor_id(), mask);
-
+ if (num_online_cpus() > 1)
smp_cross_call(&mask, IPI_CPU_STOP);
- }
/* Wait up to one second for other CPUs to stop */
timeout = USEC_PER_SEC;
@@ -590,6 +595,8 @@ void smp_send_stop(void)
if (num_online_cpus() > 1)
pr_warning("SMP: failed to stop secondary CPUs\n");
+
+ smp_kill_cpus(&mask);
}
/*
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations
2012-02-08 23:42 ` David Brown
2012-02-09 1:00 ` Marc Zyngier
@ 2012-02-10 0:03 ` Arnd Bergmann
1 sibling, 0 replies; 37+ messages in thread
From: Arnd Bergmann @ 2012-02-10 0:03 UTC (permalink / raw)
To: linux-arm-kernel
On Wednesday 08 February 2012, David Brown wrote:
> On Wed, Feb 08, 2012 at 12:30:46AM +0000, Marc Zyngier wrote:
>
> > +#ifdef CONFIG_SMP
> > +#define soc_smp_init_ops(ops) .smp_init_ops = &(ops),
> > +#define soc_smp_ops(ops) .smp_ops = &(ops),
> > +extern void soc_smp_ops_register(struct arm_soc_smp_init_ops *,
> > + struct arm_soc_smp_ops *);
> > +#else
> > +#define soc_smp_init_ops(ops) /* empty */
> > +#define soc_smp_ops(ops) /* empty */
> > +#define soc_smp_ops_register(a,b) do {} while(0)
> > +#endif
>
> I'm not sure if this bothers anyone else, but these macros mess up
> editors that know how to indent C code, since the comma ends up inside
> the macro. I'm not sure I have a better idea, though.
>
I would recommend following the pattern from __devexit_p() and make this
#ifdef CONFIG_SMP
#define soc_smp_init_ops(ops) &(ops)
#else
#define soc_smp_init_ops(ops) NULL
#endif
Arnd
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH v6 11/15] ARM: SoC: convert imx6q to SoC descriptor
2012-02-08 0:30 ` [PATCH v6 11/15] ARM: SoC: convert imx6q " Marc Zyngier
@ 2012-02-11 3:32 ` Shawn Guo
0 siblings, 0 replies; 37+ messages in thread
From: Shawn Guo @ 2012-02-11 3:32 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Feb 08, 2012 at 12:30:55AM +0000, Marc Zyngier wrote:
> Convert the imx6q platform to use the SoC descriptor to provide
> its SMP and CPU hotplug operations.
>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
^ permalink raw reply [flat|nested] 37+ messages in thread
end of thread, other threads:[~2012-02-11 3:32 UTC | newest]
Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-08 0:30 [PATCH v6 00/15] Per SoC descriptor Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 01/15] ARM: SoC: Introduce per " Marc Zyngier
2012-02-08 23:59 ` Nicolas Pitre
2012-02-08 0:30 ` [PATCH v6 02/15] ARM: SoC: Add per SoC SMP and CPU hotplug operations Marc Zyngier
2012-02-08 23:42 ` David Brown
2012-02-09 1:00 ` Marc Zyngier
2012-02-09 1:28 ` David Brown
2012-02-10 0:03 ` Arnd Bergmann
2012-02-09 0:02 ` Nicolas Pitre
2012-02-09 8:54 ` Russell King - ARM Linux
2012-02-08 0:30 ` [PATCH v6 03/15] ARM: SoC: convert VExpress/RealView to SoC descriptor Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 04/15] ARM: SoC: convert OMAP4 " Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 05/15] ARM: SoC: convert Tegra " Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 06/15] ARM: SoC: convert Exynos4 " Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 07/15] ARM: SoC: convert MSM SMP " Marc Zyngier
2012-02-08 23:39 ` David Brown
2012-02-08 23:42 ` Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 08/15] ARM: SoC: convert ux500 " Marc Zyngier
2012-02-08 22:31 ` Linus Walleij
2012-02-09 5:29 ` Srinidhi KASAGAR
2012-02-08 0:30 ` [PATCH v6 09/15] ARM: SoC: convert shmobile SMP " Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 10/15] ARM: SoC: convert highbank " Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 11/15] ARM: SoC: convert imx6q " Marc Zyngier
2012-02-11 3:32 ` Shawn Guo
2012-02-08 0:30 ` [PATCH v6 12/15] ARM: smp: Make SoC descriptor mandatory for SMP platforms Marc Zyngier
2012-02-08 0:30 ` [PATCH v6 13/15] ARM: hotplug: Introduce dummy_cpu_kill Marc Zyngier
2012-02-09 0:16 ` Nicolas Pitre
2012-02-09 0:57 ` Marc Zyngier
2012-02-09 8:46 ` Russell King - ARM Linux
2012-02-09 22:48 ` Will Deacon
2012-02-08 0:30 ` [PATCH v6 14/15] ARM: hotplug: Introduce dummy_cpu_disable Marc Zyngier
2012-02-09 0:19 ` Nicolas Pitre
2012-02-08 0:30 ` [PATCH v6 15/15] ARM: hotplug: add cpu_lowpower as an alternative to cpu_die Marc Zyngier
2012-02-09 0:21 ` Nicolas Pitre
2012-02-09 8:48 ` Russell King - ARM Linux
2012-02-08 0:43 ` [PATCH v6 00/15] Per SoC descriptor Rob Herring
2012-02-08 0:49 ` Marc Zyngier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).