ARM: SoC: convert VExpress/RealView to SMP operations
Convert both Realview and VExpress to use struct smp_operations to provide their SMP and CPU hotplug operation. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Acked-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Родитель
abcee5fb0d
Коммит
3695adc2fd
|
@ -56,4 +56,7 @@ extern void realview_init_early(void);
|
||||||
extern void realview_fixup(struct tag *tags, char **from,
|
extern void realview_fixup(struct tag *tags, char **from,
|
||||||
struct meminfo *meminfo);
|
struct meminfo *meminfo);
|
||||||
|
|
||||||
|
extern struct smp_operations realview_smp_ops;
|
||||||
|
extern void realview_cpu_die(unsigned int cpu);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -89,17 +89,12 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int platform_cpu_kill(unsigned int cpu)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* platform-specific code to shutdown a CPU
|
* platform-specific code to shutdown a CPU
|
||||||
*
|
*
|
||||||
* Called with IRQs disabled
|
* Called with IRQs disabled
|
||||||
*/
|
*/
|
||||||
void platform_cpu_die(unsigned int cpu)
|
void __ref realview_cpu_die(unsigned int cpu)
|
||||||
{
|
{
|
||||||
int spurious = 0;
|
int spurious = 0;
|
||||||
|
|
||||||
|
@ -118,12 +113,3 @@ void platform_cpu_die(unsigned int cpu)
|
||||||
if (spurious)
|
if (spurious)
|
||||||
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
|
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
|
||||||
}
|
}
|
||||||
|
|
||||||
int platform_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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
#include <mach/board-pb11mp.h>
|
#include <mach/board-pb11mp.h>
|
||||||
#include <mach/board-pbx.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)
|
static void __iomem *scu_base_addr(void)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ static void __iomem *scu_base_addr(void)
|
||||||
* Initialise the CPU possible map early - this describes the CPUs
|
* Initialise the CPU possible map early - this describes the CPUs
|
||||||
* which may be present or become present in the system.
|
* 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();
|
void __iomem *scu_base = scu_base_addr();
|
||||||
unsigned int i, ncores;
|
unsigned int i, ncores;
|
||||||
|
@ -63,7 +63,7 @@ void __init smp_init_cpus(void)
|
||||||
set_smp_cross_call(gic_raise_softirq);
|
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());
|
scu_enable(scu_base_addr());
|
||||||
|
@ -77,3 +77,13 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
|
||||||
__raw_writel(virt_to_phys(versatile_secondary_startup),
|
__raw_writel(virt_to_phys(versatile_secondary_startup),
|
||||||
__io_address(REALVIEW_SYS_FLAGSSET));
|
__io_address(REALVIEW_SYS_FLAGSSET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct smp_operations realview_smp_ops __initdata = {
|
||||||
|
.smp_init_cpus = realview_smp_init_cpus,
|
||||||
|
.smp_prepare_cpus = realview_smp_prepare_cpus,
|
||||||
|
.smp_secondary_init = versatile_secondary_init,
|
||||||
|
.smp_boot_secondary = versatile_boot_secondary,
|
||||||
|
#ifdef CONFIG_HOTPLUG_CPU
|
||||||
|
.cpu_die = realview_cpu_die,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
|
@ -366,6 +366,7 @@ static void __init realview_pb11mp_init(void)
|
||||||
MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore")
|
MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore")
|
||||||
/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
|
/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
|
||||||
.atag_offset = 0x100,
|
.atag_offset = 0x100,
|
||||||
|
.smp = smp_ops(realview_smp_ops),
|
||||||
.fixup = realview_fixup,
|
.fixup = realview_fixup,
|
||||||
.map_io = realview_pb11mp_map_io,
|
.map_io = realview_pb11mp_map_io,
|
||||||
.init_early = realview_init_early,
|
.init_early = realview_init_early,
|
||||||
|
|
|
@ -403,6 +403,7 @@ static void __init realview_pbx_init(void)
|
||||||
MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX")
|
MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX")
|
||||||
/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
|
/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
|
||||||
.atag_offset = 0x100,
|
.atag_offset = 0x100,
|
||||||
|
.smp = smp_ops(realview_smp_ops),
|
||||||
.fixup = realview_pbx_fixup,
|
.fixup = realview_pbx_fixup,
|
||||||
.map_io = realview_pbx_map_io,
|
.map_io = realview_pbx_map_io,
|
||||||
.init_early = realview_init_early,
|
.init_early = realview_init_early,
|
||||||
|
|
|
@ -5,3 +5,7 @@
|
||||||
#define V2T_PERIPH 0xf8200000
|
#define V2T_PERIPH 0xf8200000
|
||||||
|
|
||||||
void vexpress_dt_smp_map_io(void);
|
void vexpress_dt_smp_map_io(void);
|
||||||
|
|
||||||
|
extern struct smp_operations vexpress_smp_ops;
|
||||||
|
|
||||||
|
extern void vexpress_cpu_die(unsigned int cpu);
|
||||||
|
|
|
@ -84,17 +84,12 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int platform_cpu_kill(unsigned int cpu)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* platform-specific code to shutdown a CPU
|
* platform-specific code to shutdown a CPU
|
||||||
*
|
*
|
||||||
* Called with IRQs disabled
|
* Called with IRQs disabled
|
||||||
*/
|
*/
|
||||||
void platform_cpu_die(unsigned int cpu)
|
void __ref vexpress_cpu_die(unsigned int cpu)
|
||||||
{
|
{
|
||||||
int spurious = 0;
|
int spurious = 0;
|
||||||
|
|
||||||
|
@ -113,12 +108,3 @@ void platform_cpu_die(unsigned int cpu)
|
||||||
if (spurious)
|
if (spurious)
|
||||||
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
|
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
|
||||||
}
|
}
|
||||||
|
|
||||||
int platform_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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
#include <mach/motherboard.h>
|
#include <mach/motherboard.h>
|
||||||
|
|
||||||
#include "core.h"
|
#include <plat/platsmp.h>
|
||||||
|
|
||||||
extern void versatile_secondary_startup(void);
|
#include "core.h"
|
||||||
|
|
||||||
#if defined(CONFIG_OF)
|
#if defined(CONFIG_OF)
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ void __init vexpress_dt_smp_prepare_cpus(unsigned int max_cpus)
|
||||||
* Initialise the CPU possible map early - this describes the CPUs
|
* Initialise the CPU possible map early - this describes the CPUs
|
||||||
* which may be present or become present in the system.
|
* which may be present or become present in the system.
|
||||||
*/
|
*/
|
||||||
void __init smp_init_cpus(void)
|
static void __init vexpress_smp_init_cpus(void)
|
||||||
{
|
{
|
||||||
if (ct_desc)
|
if (ct_desc)
|
||||||
ct_desc->init_cpu_map();
|
ct_desc->init_cpu_map();
|
||||||
|
@ -176,7 +176,7 @@ void __init smp_init_cpus(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
* Initialise the present map, which describes the set of CPUs
|
||||||
|
@ -195,3 +195,13 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
|
||||||
*/
|
*/
|
||||||
v2m_flags_set(virt_to_phys(versatile_secondary_startup));
|
v2m_flags_set(virt_to_phys(versatile_secondary_startup));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct smp_operations __initdata vexpress_smp_ops = {
|
||||||
|
.smp_init_cpus = vexpress_smp_init_cpus,
|
||||||
|
.smp_prepare_cpus = vexpress_smp_prepare_cpus,
|
||||||
|
.smp_secondary_init = versatile_secondary_init,
|
||||||
|
.smp_boot_secondary = versatile_boot_secondary,
|
||||||
|
#ifdef CONFIG_HOTPLUG_CPU
|
||||||
|
.cpu_die = vexpress_cpu_die,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <linux/amba/bus.h>
|
#include <linux/amba/bus.h>
|
||||||
#include <linux/amba/mmci.h>
|
#include <linux/amba/mmci.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
|
#include <linux/smp.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/of_address.h>
|
#include <linux/of_address.h>
|
||||||
#include <linux/of_fdt.h>
|
#include <linux/of_fdt.h>
|
||||||
|
@ -38,6 +39,7 @@
|
||||||
#include <mach/motherboard.h>
|
#include <mach/motherboard.h>
|
||||||
|
|
||||||
#include <plat/sched_clock.h>
|
#include <plat/sched_clock.h>
|
||||||
|
#include <plat/platsmp.h>
|
||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
|
|
||||||
|
@ -530,6 +532,7 @@ static void __init v2m_init(void)
|
||||||
|
|
||||||
MACHINE_START(VEXPRESS, "ARM-Versatile Express")
|
MACHINE_START(VEXPRESS, "ARM-Versatile Express")
|
||||||
.atag_offset = 0x100,
|
.atag_offset = 0x100,
|
||||||
|
.smp = smp_ops(vexpress_smp_ops),
|
||||||
.map_io = v2m_map_io,
|
.map_io = v2m_map_io,
|
||||||
.init_early = v2m_init_early,
|
.init_early = v2m_init_early,
|
||||||
.init_irq = v2m_init_irq,
|
.init_irq = v2m_init_irq,
|
||||||
|
@ -663,6 +666,7 @@ const static char *v2m_dt_match[] __initconst = {
|
||||||
|
|
||||||
DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
|
DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
|
||||||
.dt_compat = v2m_dt_match,
|
.dt_compat = v2m_dt_match,
|
||||||
|
.smp = smp_ops(vexpress_smp_ops),
|
||||||
.map_io = v2m_dt_map_io,
|
.map_io = v2m_dt_map_io,
|
||||||
.init_early = v2m_dt_init_early,
|
.init_early = v2m_dt_init_early,
|
||||||
.init_irq = v2m_dt_init_irq,
|
.init_irq = v2m_dt_init_irq,
|
||||||
|
|
|
@ -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);
|
|
@ -40,7 +40,7 @@ static void __cpuinit write_pen_release(int val)
|
||||||
|
|
||||||
static DEFINE_SPINLOCK(boot_lock);
|
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
|
* 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);
|
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;
|
unsigned long timeout;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче