Per SoC descriptor
Subsystems (10)
v6 cover Per SoC descriptor
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:
Quoted 1 line
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
Quoted 1 line
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.
Quoted 1 line
From v3:
- Converted all SMP platforms
- Added some cleanup as a last patch
Quoted 1 line
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.
Quoted 1 line
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
Signature · 1 line
1.7.3.4
PATCH v6 1/15 ARM: SoC: Introduce per SoC descriptor
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.
--- 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
arch/arm/include/asm/mach/arch.h +2 -0
@@ -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 */
arch/arm/include/asm/soc.h new file +19 -0
@@ -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 */
arch/arm/kernel/setup.c +7 -0
@@ -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) {
Signature · 1 line
1.7.3.4
PATCH v6 1/15 ARM: SoC: Introduce per SoC descriptor
Quoted 11 lines · Marc Zyngier
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).
Quoted 6 lines
This patch introduce this SoC descriptor, with the only field being the name of the SoC.
Cc Arnd Bergmann <[email protected]>Cc Nicolas Pitre <[email protected]>Signed-off-by Marc Zyngier <[email protected]>
Quoted 87 lines
--- 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.harch/arm/include/asm/mach/arch.h +2
-0@@ -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 */ arch/arm/include/asm/soc.h new file +19
-0@@ -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 */ arch/arm/kernel/setup.c +7
-0@@ -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) {Signature · 1 line
1.7.3.4
PATCH v6 2/15 ARM: SoC: Add per SoC SMP and CPU hotplug operations
In reply to Marc ZyngierPopulate 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.
--- 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(-)
arch/arm/include/asm/soc.h +45 -0
@@ -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 */
arch/arm/kernel/setup.c +1 -0
@@ -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 ;
arch/arm/kernel/smp.c +69 -0
84 lines not on this page · raw message
Signature · 1 line
1.7.3.4
PATCH v6 2/15 ARM: SoC: Add per SoC SMP and CPU hotplug operations
arch/arm/include/asm/soc.h line 62
Quoted 10 lines · Marc Zyngier
arch/arm/include/asm/soc.h +10
-0+#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
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH v6 2/15 ARM: SoC: Add per SoC SMP and CPU hotplug operations
Quoted 16 lines · David Brown
arch/arm/include/asm/soc.h line 62
Quoted 10 lines · Marc Zyngier
arch/arm/include/asm/soc.h +10
-0+#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.
Signature · 1 line
Fast, cheap, reliable. Pick two.
PATCH v6 2/15 ARM: SoC: Add per SoC SMP and CPU hotplug operations
Quoted 20 lines · Marc Zyngier
Quoted 16 lines · David Brown
arch/arm/include/asm/soc.h line 62
Quoted 10 lines · Marc Zyngier
arch/arm/include/asm/soc.h +10
-0+#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.
Quoted 2 lines
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
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH v6 2/15 ARM: SoC: Add per SoC SMP and CPU hotplug operations
In reply to David BrownQuoted 17 lines · David Brown
arch/arm/include/asm/soc.h line 62
Quoted 10 lines · Marc Zyngier
arch/arm/include/asm/soc.h +10
-0+#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
PATCH v6 2/15 ARM: SoC: Add per SoC SMP and CPU hotplug operations
In reply to Marc ZyngierQuoted 9 lines · Marc Zyngier
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 <[email protected]>Cc Nicolas Pitre <[email protected]>Signed-off-by Marc Zyngier <[email protected]>
You should be able to replace __attribute__((weak)) with simply __weak.
Otherwise:
Quoted 169 lines
--- 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(-)arch/arm/include/asm/soc.h +45
-0@@ -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 */ arch/arm/kernel/setup.c +1
-0@@ -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 ;arch/arm/kernel/smp.c +69
-0@@ -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. */ Signature · 1 line
1.7.3.4
PATCH v6 2/15 ARM: SoC: Add per SoC SMP and CPU hotplug operations
In reply to Marc ZyngierQuoted 5 lines · Marc Zyngier
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.
PATCH v6 3/15 ARM: SoC: convert VExpress/RealView to SoC descriptor
In reply to Marc ZyngierConvert both Realview and VExpress to use the SoC descriptor to provide their SMP and CPU hotplug operation.
--- 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
arch/arm/mach-realview/core.c +7 -0
@@ -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) +};
arch/arm/mach-realview/core.h +9 -0
@@ -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
arch/arm/mach-realview/hotplug.c +3 -3
@@ -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
arch/arm/mach-realview/platsmp.c +20 -4
@@ -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 +};
arch/arm/mach-realview/realview_eb.c +1 -0
@@ -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,
arch/arm/mach-realview/realview_pb1176.c +1 -0
@@ -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,
arch/arm/mach-realview/realview_pb11mp.c +1 -0
@@ -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,
arch/arm/mach-realview/realview_pba8.c +1 -0
@@ -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,
arch/arm/mach-realview/realview_pbx.c +1 -0
@@ -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,
arch/arm/mach-vexpress/core.h +10 -0
@@ -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);
arch/arm/mach-vexpress/hotplug.c +3 -3
@@ -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
arch/arm/mach-vexpress/platsmp.c +21 -4
@@ -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 +};
arch/arm/mach-vexpress/v2m.c +9 -0
@@ -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,
arch/arm/plat-versatile/include/plat/platsmp.h new file +14 -0
@@ -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);
arch/arm/plat-versatile/platsmp.c +2 -2
@@ -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;
Signature · 1 line
1.7.3.4
PATCH v6 4/15 ARM: SoC: convert OMAP4 to SoC descriptor
In reply to Marc ZyngierConvert OMAP4 to use the SoC descriptor to provide its SMP and CPU hotplug operations.
Tested on both Panda and IGEPv2 (MULTI_OMAP kernel)
--- 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(-)
arch/arm/mach-omap2/board-4430sdp.c +1 -0
@@ -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,
arch/arm/mach-omap2/board-omap4panda.c +1 -0
@@ -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,
arch/arm/mach-omap2/common.h +13 -0
@@ -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);
arch/arm/mach-omap2/omap-hotplug.c +3 -3
@@ -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
arch/arm/mach-omap2/omap-smp.c +20 -4
@@ -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 +};
arch/arm/mach-omap2/omap4-common.c +7 -0
@@ -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) +};
Signature · 1 line
1.7.3.4
PATCH v6 5/15 ARM: SoC: convert Tegra to SoC descriptor
In reply to Marc ZyngierConvert Tegra to use the SoC descriptor to provide its SMP and CPU hotplug operations.
Tested on Harmony.
--- 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
arch/arm/mach-tegra/board-dt-tegra20.c +2 -0
@@ -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,
arch/arm/mach-tegra/board-dt-tegra30.c +1 -0
@@ -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,
arch/arm/mach-tegra/board-harmony.c +2 -0
@@ -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,
arch/arm/mach-tegra/board-paz00.c +2 -0
@@ -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,
arch/arm/mach-tegra/board-seaboard.c +4 -0
@@ -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_ENDMACHINE_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_ENDMACHINE_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,
arch/arm/mach-tegra/board-trimslice.c +2 -0
@@ -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,
arch/arm/mach-tegra/common.c +8 -0
@@ -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) +};
arch/arm/mach-tegra/common.h new file +11 -0
@@ -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);
arch/arm/mach-tegra/hotplug.c +3 -3
@@ -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
arch/arm/mach-tegra/platsmp.c +22 -4
@@ -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 +};
Signature · 1 line
1.7.3.4
PATCH v6 6/15 ARM: SoC: convert Exynos4 to SoC descriptor
In reply to Marc ZyngierConvert Exynos4 to use the SoC descriptor to provide its SMP and CPU hotplug operations.
--- 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(-)
arch/arm/mach-exynos/common.c +6 -0
@@ -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) +};
arch/arm/mach-exynos/common.h +10 -0
@@ -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 );
arch/arm/mach-exynos/hotplug.c +5 -3
@@ -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
arch/arm/mach-exynos/mach-armlex4210.c +1 -0
@@ -210,6 +210,7 @@ static void __init armlex4210_machine_init(void)MACHINE_START (ARMLEX4210 ,"ARMLEX4210" )/* Maintainer: Alim Akhtar <[email protected]> */ .atag_offset = 0x100, + .soc = &exynos4_soc_desc, .init_irq = exynos4_init_irq, .map_io = armlex4210_map_io, .handle_irq = gic_handle_irq,
arch/arm/mach-exynos/mach-nuri.c +1 -0
@@ -1328,6 +1328,7 @@ static void __init nuri_machine_init(void)MACHINE_START (NURI ,"NURI" )/* Maintainer: Kyungmin Park <[email protected]> */ .atag_offset = 0x100, + .soc = &exynos4_soc_desc, .init_irq = exynos4_init_irq, .map_io = nuri_map_io, .handle_irq = gic_handle_irq,
arch/arm/mach-exynos/mach-origen.c +1 -0
@@ -708,6 +708,7 @@ static void __init origen_machine_init(void)MACHINE_START (ORIGEN ,"ORIGEN" )/* Maintainer: JeongHyeon Kim <[email protected]> */ .atag_offset = 0x100, + .soc = &exynos4_soc_desc, .init_irq = exynos4_init_irq, .map_io = origen_map_io, .handle_irq = gic_handle_irq,
arch/arm/mach-exynos/mach-smdk4x12.c +2 -0
@@ -287,6 +287,7 @@ static void __init smdk4x12_machine_init(void)MACHINE_START (SMDK4212 ,"SMDK4212" )/* Maintainer: Kukjin Kim <[email protected]> */ .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 <[email protected]> */ /* Maintainer: Changhwan Youn <[email protected]> */ .atag_offset = 0x100, + .soc = &exynos4_soc_desc, .init_irq = exynos4_init_irq, .map_io = smdk4x12_map_io, .handle_irq = gic_handle_irq,
arch/arm/mach-exynos/mach-smdkv310.c +2 -0
@@ -386,6 +386,7 @@ MACHINE_START(SMDKV310, "SMDKV310")/* Maintainer: Kukjin Kim <[email protected]> */ /* Maintainer: Changhwan Youn <[email protected]> */ .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_ENDMACHINE_START (SMDKC210 ,"SMDKC210" )/* Maintainer: Kukjin Kim <[email protected]> */ .atag_offset = 0x100, + .soc = &exynos4_soc_desc, .init_irq = exynos4_init_irq, .map_io = smdkv310_map_io, .handle_irq = gic_handle_irq,
arch/arm/mach-exynos/mach-universal_c210.c +1 -0
@@ -1054,6 +1054,7 @@ static void __init universal_machine_init(void)MACHINE_START (UNIVERSAL_C210 ,"UNIVERSAL_C210" )/* Maintainer: Kyungmin Park <[email protected]> */ .atag_offset = 0x100, + .soc = &exynos4_soc_desc, .init_irq = exynos4_init_irq, .map_io = universal_map_io, .handle_irq = gic_handle_irq,
arch/arm/mach-exynos/platsmp.c +21 -4
@@ -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 +};
Signature · 1 line
1.7.3.4
PATCH v6 7/15 ARM: SoC: convert MSM SMP to SoC descriptor
In reply to Marc ZyngierConvert MSM SMP platforms to use the SoC descriptor to provide their SMP and CPU hotplug operations.
--- 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
arch/arm/mach-msm/Makefile +1 -1
@@ -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
arch/arm/mach-msm/board-msm8960.c +3 -0
@@ -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,
arch/arm/mach-msm/board-msm8x60.c +9 -0
@@ -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,
arch/arm/mach-msm/core.c new file +17 -0
@@ -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) +};
arch/arm/mach-msm/core.h new file +9 -0
@@ -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);
arch/arm/mach-msm/hotplug.c +5 -3
@@ -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
arch/arm/mach-msm/platsmp.c +20 -4
@@ -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 +};
Signature · 1 line
1.7.3.4
PATCH v6 7/15 ARM: SoC: convert MSM SMP to SoC descriptor
arch/arm/mach-msm/board-msm8x60.c MACHINE_END · line 160
Quoted 10 lines · Marc Zyngier
arch/arm/mach-msm/board-msm8x60.c +3
-0@@ -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.
David
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH v6 7/15 ARM: SoC: convert MSM SMP to SoC descriptor
Quoted 17 lines · David Brown
arch/arm/mach-msm/board-msm8x60.c MACHINE_END · line 160
Quoted 10 lines · Marc Zyngier
arch/arm/mach-msm/board-msm8x60.c +3
-0@@ -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.
Quoted 3 lines
Otherwise, the MSM part looks ok.
Acked-by David Brown <[email protected]>
Thanks David.
M.
Signature · 1 line
Fast, cheap, reliable. Pick two.
PATCH v6 8/15 ARM: SoC: convert ux500 to SoC descriptor
In reply to Marc ZyngierConvert ux500 platforms to use the SoC descriptor to provide their SMP and CPU hotplug operations.
--- 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(-)
arch/arm/mach-ux500/board-mop500.c +3 -0
@@ -692,6 +692,7 @@ static void __init hrefv60_init_machine(void)MACHINE_START (U8500 ,"ST-Ericsson MOP500 platform" )/* Maintainer: Srinidhi Kasagar <[email protected]> */ .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_ENDMACHINE_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_ENDMACHINE_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 */
arch/arm/mach-ux500/board-u5500.c +1 -0
@@ -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,
arch/arm/mach-ux500/cpu.c +6 -1
@@ -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) +};
arch/arm/mach-ux500/hotplug.c +5 -3
@@ -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
arch/arm/mach-ux500/include/mach/setup.h +9 -0
@@ -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 */
arch/arm/mach-ux500/platsmp.c +19 -4
@@ -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 +};
Signature · 1 line
1.7.3.4
PATCH v6 8/15 ARM: SoC: convert ux500 to SoC descriptor
Quoted 5 lines · Marc Zyngier
Convert ux500 platforms to use the SoC descriptor to provide their SMP and CPU hotplug operations.
Cc Linus Walleij <[email protected]>Signed-off-by Marc Zyngier <[email protected]>
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
PATCH v6 8/15 ARM: SoC: convert ux500 to SoC descriptor
Quoted 10 lines · Linus Walleij
Quoted 5 lines · Marc Zyngier
Convert ux500 platforms to use the SoC descriptor to provide their SMP and CPU hotplug operations.
Cc Linus Walleij <[email protected]>Signed-off-by Marc Zyngier <[email protected]>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.
Srinidhi
PATCH v6 9/15 ARM: SoC: convert shmobile SMP to SoC descriptor
In reply to Marc ZyngierConvert shmobile SMP platforms to use the SoC descriptor to provide their SMP and CPU hotplug operations.
--- 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
arch/arm/mach-shmobile/Makefile +1 -1
@@ -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
arch/arm/mach-shmobile/board-ag5evm.c +1 -0
@@ -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,
arch/arm/mach-shmobile/board-kota2.c +1 -0
@@ -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,
arch/arm/mach-shmobile/board-marzen.c +1 -0
@@ -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,
arch/arm/mach-shmobile/hotplug.c +9 -4
@@ -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);/*
arch/arm/mach-shmobile/include/mach/common.h +4 -10
@@ -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 */
arch/arm/mach-shmobile/include/mach/r8a7779.h +6 -0
@@ -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__ */
arch/arm/mach-shmobile/include/mach/sh73a0.h +6 -0
@@ -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__ */
arch/arm/mach-shmobile/platsmp.c deleted +0 -97
97 lines not on this page · raw message
arch/arm/mach-shmobile/setup-r8a7779.c +6 -0
@@ -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) +};
arch/arm/mach-shmobile/setup-sh73a0.c +6 -0
@@ -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) +};
arch/arm/mach-shmobile/smp-r8a7779.c +36 -4
@@ -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 +};
arch/arm/mach-shmobile/smp-sh73a0.c +37 -4
72 lines not on this page · raw message
Signature · 1 line
1.7.3.4
PATCH v6 10/15 ARM: SoC: convert highbank to SoC descriptor
In reply to Marc ZyngierConvert the highbank platform to use the SoC descriptor to provide its SMP and CPU hotplug operations.
--- 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(-)
arch/arm/mach-highbank/core.h +8 -0
@@ -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;
arch/arm/mach-highbank/highbank.c +7 -0
@@ -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,
arch/arm/mach-highbank/hotplug.c +3 -3
@@ -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
arch/arm/mach-highbank/platsmp.c +19 -4
@@ -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 +};
Signature · 1 line
1.7.3.4
PATCH v6 11/15 ARM: SoC: convert imx6q to SoC descriptor
In reply to Marc ZyngierConvert the imx6q platform to use the SoC descriptor to provide its SMP and CPU hotplug operations.
--- 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(-)
arch/arm/mach-imx/hotplug.c +3 -3
@@ -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
arch/arm/mach-imx/mach-imx6q.c +8 -0
@@ -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,
arch/arm/mach-imx/platsmp.c +20 -4
@@ -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 +};
arch/arm/plat-mxc/include/mach/common.h +10 -0
@@ -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
Signature · 1 line
1.7.3.4
PATCH v6 11/15 ARM: SoC: convert imx6q to SoC descriptor
Quoted 5 lines · Marc Zyngier
Convert the imx6q platform to use the SoC descriptor to provide its SMP and CPU hotplug operations.
Cc Shawn Guo <[email protected]>Signed-off-by Marc Zyngier <[email protected]>
PATCH v6 12/15 ARM: smp: Make SoC descriptor mandatory for SMP platforms
In reply to Marc ZyngierNow 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.
--- arch/arm/include/asm/smp.h | 15 --------------- arch/arm/kernel/smp.c | 18 +++++++++--------- 2 files changed, 9 insertions(+), 24 deletions(-)
arch/arm/include/asm/smp.h +0 -15
@@ -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);
arch/arm/kernel/smp.c +9 -9
@@ -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);
Signature · 1 line
1.7.3.4
PATCH v6 13/15 ARM: hotplug: Introduce dummy_cpu_kill
In reply to Marc ZyngierMost 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.
--- 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(-)
arch/arm/include/asm/smp_plat.h +3 -0
@@ -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
arch/arm/kernel/smp.c +5 -0
@@ -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)
arch/arm/mach-exynos/common.h +0 -1
@@ -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);
arch/arm/mach-exynos/hotplug.c +0 -5
@@ -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 *
arch/arm/mach-exynos/platsmp.c +1 -1
@@ -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
arch/arm/mach-highbank/core.h +0 -1
@@ -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);
arch/arm/mach-highbank/hotplug.c +0 -5
@@ -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 *
arch/arm/mach-highbank/platsmp.c +2 -1
@@ -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
arch/arm/mach-imx/hotplug.c +0 -5
@@ -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 *
arch/arm/mach-imx/platsmp.c +2 -1
@@ -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
arch/arm/mach-msm/core.h +0 -1
@@ -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);
arch/arm/mach-msm/hotplug.c +0 -5
@@ -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 *
arch/arm/mach-msm/platsmp.c +1 -1
@@ -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
arch/arm/mach-omap2/common.h +0 -1
@@ -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);
arch/arm/mach-omap2/omap-hotplug.c +0 -5
@@ -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
arch/arm/mach-omap2/omap-smp.c +2 -1
@@ -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
arch/arm/mach-realview/core.h +0 -1
@@ -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);
arch/arm/mach-realview/hotplug.c +0 -5
@@ -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 *
arch/arm/mach-realview/platsmp.c +2 -1
@@ -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
arch/arm/mach-tegra/common.h +0 -1
@@ -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);
arch/arm/mach-tegra/hotplug.c +0 -5
@@ -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 *
arch/arm/mach-tegra/platsmp.c +2 -1
@@ -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
arch/arm/mach-ux500/hotplug.c +0 -5
@@ -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 *
arch/arm/mach-ux500/include/mach/setup.h +0 -1
@@ -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);
arch/arm/mach-ux500/platsmp.c +1 -1
@@ -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
arch/arm/mach-vexpress/core.h +0 -1
@@ -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);
arch/arm/mach-vexpress/hotplug.c +0 -5
@@ -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 *
arch/arm/mach-vexpress/platsmp.c +2 -1
@@ -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
arch/arm/plat-mxc/include/mach/common.h +0 -1
@@ -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);
Signature · 1 line
1.7.3.4
PATCH v6 13/15 ARM: hotplug: Introduce dummy_cpu_kill
Quoted 9 lines · Marc Zyngier
Most platforms don't implement their
cpu_killmethod. 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_killmethod and convert all SMP (but shmobile) to use it. Hopefully the "dummy" prefix will be an incentive for people to do the right thing.
Quoted 13 lines
Cc Arnd Bergmann <[email protected]>Cc Colin Cross <[email protected]>Cc David Brown <[email protected]>Cc Kukjin Kim <[email protected]>Cc Linus Walleij <[email protected]>Cc Magnus Damm <[email protected]>Cc Nicolas Pitre <[email protected]>Cc Paul Mundt <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc Stephen Warren <[email protected]>Cc Shawn Guo <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Marc Zyngier <[email protected]>
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?
Quoted 477 lines
--- 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(-)arch/arm/include/asm/smp_plat.h +3
-0@@ -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 arch/arm/kernel/smp.c +5
-0@@ -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)arch/arm/mach-exynos/common.h +0
-1@@ -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);arch/arm/mach-exynos/hotplug.c +0
-5@@ -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 * arch/arm/mach-exynos/platsmp.c +1
-1@@ -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, #endifarch/arm/mach-highbank/core.h +0
-1@@ -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);arch/arm/mach-highbank/hotplug.c +0
-5@@ -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 * arch/arm/mach-highbank/platsmp.c +2
-1@@ -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, #endifarch/arm/mach-imx/hotplug.c +0
-5@@ -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 * arch/arm/mach-imx/platsmp.c +2
-1@@ -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, #endifarch/arm/mach-msm/core.h +0
-1@@ -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);arch/arm/mach-msm/hotplug.c +0
-5@@ -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 * arch/arm/mach-msm/platsmp.c +1
-1@@ -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, #endifarch/arm/mach-omap2/common.h +0
-1@@ -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);arch/arm/mach-omap2/omap-hotplug.c +0
-5@@ -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 arch/arm/mach-omap2/omap-smp.c +2
-1@@ -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, #endifarch/arm/mach-realview/core.h +0
-1@@ -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);arch/arm/mach-realview/hotplug.c +0
-5@@ -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 * arch/arm/mach-realview/platsmp.c +2
-1@@ -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, #endifarch/arm/mach-tegra/common.h +0
-1@@ -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);arch/arm/mach-tegra/hotplug.c +0
-5@@ -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 * arch/arm/mach-tegra/platsmp.c +2
-1@@ -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, #endifarch/arm/mach-ux500/hotplug.c +0
-5@@ -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 * arch/arm/mach-ux500/include/mach/setup.h +0
-1@@ -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);arch/arm/mach-ux500/platsmp.c +1
-1@@ -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, #endifarch/arm/mach-vexpress/core.h +0
-1@@ -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);arch/arm/mach-vexpress/hotplug.c +0
-5@@ -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 * arch/arm/mach-vexpress/platsmp.c +2
-1@@ -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, #endifarch/arm/plat-mxc/include/mach/common.h +0
-1@@ -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);Signature · 1 line
1.7.3.4
PATCH v6 13/15 ARM: hotplug: Introduce dummy_cpu_kill
Quoted 36 lines · Nicolas Pitre
Quoted 9 lines · Marc Zyngier
Most platforms don't implement their
cpu_killmethod. 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_killmethod and convert all SMP (but shmobile) to use it. Hopefully the "dummy" prefix will be an incentive for people to do the right thing.Quoted 13 lines
Cc Arnd Bergmann <[email protected]>Cc Colin Cross <[email protected]>Cc David Brown <[email protected]>Cc Kukjin Kim <[email protected]>Cc Linus Walleij <[email protected]>Cc Magnus Damm <[email protected]>Cc Nicolas Pitre <[email protected]>Cc Paul Mundt <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc Stephen Warren <[email protected]>Cc Shawn Guo <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Marc Zyngier <[email protected]>What avout this instead:
int
__weak__cpuinitplatform_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); }
Quoted 1 line
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.
Signature · 1 line
Fast, cheap, reliable. Pick two.
PATCH v6 13/15 ARM: hotplug: Introduce dummy_cpu_kill
In reply to Nicolas PitreQuoted 11 lines · Nicolas Pitre
What avout this instead:
int
__weak__cpuinitplatform_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); }
Quoted 1 line
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.
PATCH v6 13/15 ARM: hotplug: Introduce dummy_cpu_kill
Quoted 4 lines · Russell King - ARM Linux
I'm not sure that the call to
platform_cpu_kill()inipi_cpu_stop()is correct -platform_cpu_kill()is supposed to run on a CPU which is not the one going down, whereasplatform_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
arch/arm/kernel/smp.c +16 -9
@@ -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); }/*
PATCH v6 14/15 ARM: hotplug: Introduce dummy_cpu_disable
In reply to Marc ZyngierMost 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.
--- 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(-)
arch/arm/include/asm/smp_plat.h +1 -0
@@ -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
arch/arm/kernel/smp.c +9 -0
@@ -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)
arch/arm/mach-exynos/common.h +0 -1
@@ -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 );
arch/arm/mach-exynos/hotplug.c +0 -9
@@ -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 ; -}
arch/arm/mach-exynos/platsmp.c +1 -1
@@ -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 };
arch/arm/mach-highbank/core.h +0 -1
@@ -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;
arch/arm/mach-highbank/hotplug.c +0 -9
@@ -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 ; -}
arch/arm/mach-highbank/platsmp.c +1 -1
@@ -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 };
arch/arm/mach-imx/hotplug.c +0 -9
@@ -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 ; -}
arch/arm/mach-imx/platsmp.c +1 -1
@@ -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 };
arch/arm/mach-msm/core.h +0 -1
@@ -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);
arch/arm/mach-msm/hotplug.c +0 -9
@@ -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 ; -}
arch/arm/mach-msm/platsmp.c +1 -1
@@ -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 };
arch/arm/mach-omap2/common.h +0 -1
@@ -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 ;
arch/arm/mach-omap2/omap-hotplug.c +0 -9
@@ -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 ; -}
arch/arm/mach-omap2/omap-smp.c +1 -1
@@ -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 };
arch/arm/mach-realview/core.h +0 -1
@@ -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
arch/arm/mach-realview/hotplug.c +0 -9
@@ -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 ; -}
arch/arm/mach-realview/platsmp.c +1 -1
@@ -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 };
arch/arm/mach-tegra/common.h +0 -1
@@ -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);
arch/arm/mach-tegra/hotplug.c +0 -9
@@ -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 ; -}
arch/arm/mach-tegra/platsmp.c +1 -1
@@ -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 };
arch/arm/mach-ux500/hotplug.c +0 -9
@@ -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 ; -}
arch/arm/mach-ux500/include/mach/setup.h +0 -1
@@ -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 */
arch/arm/mach-ux500/platsmp.c +1 -1
@@ -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 };
arch/arm/mach-vexpress/core.h +0 -1
@@ -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);
arch/arm/mach-vexpress/hotplug.c +0 -9
@@ -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 ; -}
arch/arm/mach-vexpress/platsmp.c +1 -1
@@ -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 };
arch/arm/plat-mxc/include/mach/common.h +0 -1
@@ -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 );
Signature · 1 line
1.7.3.4
PATCH v6 14/15 ARM: hotplug: Introduce dummy_cpu_disable
Quoted 9 lines · Marc Zyngier
Most platforms don't implement their
cpu_disablemethod. 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_disablemethod and convert all SMP (but shmobile) to use it. Hopefully the "dummy" prefix will be an incentive for people to do the right thing.
Quoted 11 lines
Cc Arnd Bergmann <[email protected]>Cc Colin Cross <[email protected]>Cc David Brown <[email protected]>Cc Kukjin Kim <[email protected]>Cc Linus Walleij <[email protected]>Cc Nicolas Pitre <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc Stephen Warren <[email protected]>Cc Shawn Guo <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Marc Zyngier <[email protected]>
Couldn't the same strategy as I suggested for cpu_kill be used here too?
Quoted 424 lines
--- 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(-)arch/arm/include/asm/smp_plat.h +1
-0@@ -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 arch/arm/kernel/smp.c +9
-0@@ -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)arch/arm/mach-exynos/common.h +0
-1@@ -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 );arch/arm/mach-exynos/hotplug.c +0
-9@@ -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 ; -}arch/arm/mach-exynos/platsmp.c +1
-1@@ -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 };arch/arm/mach-highbank/core.h +0
-1@@ -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;arch/arm/mach-highbank/hotplug.c +0
-9@@ -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 ; -}arch/arm/mach-highbank/platsmp.c +1
-1@@ -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 };arch/arm/mach-imx/hotplug.c +0
-9@@ -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 ; -}arch/arm/mach-imx/platsmp.c +1
-1@@ -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 };arch/arm/mach-msm/core.h +0
-1@@ -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);arch/arm/mach-msm/hotplug.c +0
-9@@ -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 ; -}arch/arm/mach-msm/platsmp.c +1
-1@@ -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 };arch/arm/mach-omap2/common.h +0
-1@@ -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 ;arch/arm/mach-omap2/omap-hotplug.c +0
-9@@ -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 ; -}arch/arm/mach-omap2/omap-smp.c +1
-1@@ -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 };arch/arm/mach-realview/core.h +0
-1@@ -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 arch/arm/mach-realview/hotplug.c +0
-9@@ -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 ; -}arch/arm/mach-realview/platsmp.c +1
-1@@ -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 };arch/arm/mach-tegra/common.h +0
-1@@ -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);arch/arm/mach-tegra/hotplug.c +0
-9@@ -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 ; -}arch/arm/mach-tegra/platsmp.c +1
-1@@ -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 };arch/arm/mach-ux500/hotplug.c +0
-9@@ -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 ; -}arch/arm/mach-ux500/include/mach/setup.h +0
-1@@ -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 */ arch/arm/mach-ux500/platsmp.c +1
-1@@ -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 };arch/arm/mach-vexpress/core.h +0
-1@@ -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);arch/arm/mach-vexpress/hotplug.c +0
-9@@ -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 ; -}arch/arm/mach-vexpress/platsmp.c +1
-1@@ -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 };arch/arm/plat-mxc/include/mach/common.h +0
-1@@ -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 );Signature · 1 line
1.7.3.4
PATCH v6 15/15 ARM: hotplug: add cpu_lowpower as an alternative to cpu_die
In reply to Marc ZyngierMost 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().
--- 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(-)
arch/arm/include/asm/soc.h +1 -0
@@ -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 };
arch/arm/kernel/smp.c +14 -2
@@ -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)
arch/arm/mach-exynos/common.h +1 -1
@@ -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 );
arch/arm/mach-exynos/hotplug.c +2 -25
@@ -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); }
arch/arm/mach-exynos/platsmp.c +1 -1
@@ -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 };
arch/arm/mach-msm/core.h +1 -1
@@ -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);
arch/arm/mach-msm/hotplug.c +2 -20
@@ -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 (); }
arch/arm/mach-msm/platsmp.c +1 -1
@@ -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 };
arch/arm/mach-realview/core.h +1 -1
@@ -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
arch/arm/mach-realview/hotplug.c +2 -25
@@ -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); }
arch/arm/mach-realview/platsmp.c +1 -1
@@ -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 };
arch/arm/mach-tegra/common.h +1 -1
@@ -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);
arch/arm/mach-tegra/hotplug.c +7 -46
68 lines not on this page · raw message
arch/arm/mach-tegra/platsmp.c +1 -1
@@ -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 };
arch/arm/mach-ux500/hotplug.c +2 -12
@@ -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); -}
arch/arm/mach-ux500/include/mach/setup.h +1 -1
@@ -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 */
arch/arm/mach-ux500/platsmp.c +1 -1
@@ -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 };
arch/arm/mach-vexpress/core.h +1 -1
@@ -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)
arch/arm/mach-vexpress/hotplug.c +2 -25
@@ -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); }
arch/arm/mach-vexpress/platsmp.c +1 -1
@@ -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 };
Signature · 1 line
1.7.3.4
PATCH v6 15/15 ARM: hotplug: add cpu_lowpower as an alternative to cpu_die
Quoted 6 lines · Marc Zyngier
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().
Quoted 9 lines
Cc Arnd Bergmann <[email protected]>Cc Colin Cross <[email protected]>Cc David Brown <[email protected]>Cc Kukjin Kim <[email protected]>Cc Linus Walleij <[email protected]>Cc Nicolas Pitre <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc Stephen Warren <[email protected]>Signed-off-by Marc Zyngier <[email protected]>
Quoted 500 lines
--- 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(-)arch/arm/include/asm/soc.h +1
-0@@ -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 };arch/arm/kernel/smp.c +14
-2@@ -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)arch/arm/mach-exynos/common.h +1
-1@@ -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 );arch/arm/mach-exynos/hotplug.c +2
-25@@ -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); }arch/arm/mach-exynos/platsmp.c +1
-1@@ -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 };arch/arm/mach-msm/core.h +1
-1@@ -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);arch/arm/mach-msm/hotplug.c +2
-20@@ -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 (); }arch/arm/mach-msm/platsmp.c +1
-1@@ -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 };arch/arm/mach-realview/core.h +1
-1@@ -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 arch/arm/mach-realview/hotplug.c +2
-25@@ -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); }arch/arm/mach-realview/platsmp.c +1
-1@@ -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 };arch/arm/mach-tegra/common.h +1
-1@@ -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);arch/arm/mach-tegra/hotplug.c +7
-46@@ -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 (); }arch/arm/mach-tegra/platsmp.c +1
-1@@ -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 };arch/arm/mach-ux500/hotplug.c +2
-12@@ -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); -}arch/arm/mach-ux500/include/mach/setup.h +1
-1@@ -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 */ arch/arm/mach-ux500/platsmp.c +1
-1@@ -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 };arch/arm/mach-vexpress/core.h +1
-1@@ -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)arch/arm/mach-vexpress/hotplug.c +2
-25@@ -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); }arch/arm/mach-vexpress/platsmp.c +1
-1@@ -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 };Signature · 1 line
1.7.3.4
PATCH v6 15/15 ARM: hotplug: add cpu_lowpower as an alternative to cpu_die
In reply to Marc ZyngierQuoted 2 lines · Marc Zyngier
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.
v6 cover Per SoC descriptor
In reply to Marc ZyngierQuoted 7 lines · Marc Zyngier
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_descstructure, adds per-soc SMP and CPU hotplug operations, and converts all SMP platform to this new scheme.
Quoted 6 lines
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
v6 cover Per SoC descriptor
Quoted 11 lines · Rob Herring
Quoted 10 lines · Marc Zyngier
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_descstructure, 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.
Quoted 6 lines
Quoted 4 lines
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 togit://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.
Signature · 1 line
Fast, cheap, reliable. Pick two.