sh: provide percpu CPU states for hotplug notifiers.
This provides percpu CPU states in preparation for CPU hotplug and the associated notifier chains. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <asm/atomic.h>
|
#include <asm/atomic.h>
|
||||||
#include <asm/current.h>
|
#include <asm/current.h>
|
||||||
|
#include <asm/percpu.h>
|
||||||
|
|
||||||
#define raw_smp_processor_id() (current_thread_info()->cpu)
|
#define raw_smp_processor_id() (current_thread_info()->cpu)
|
||||||
|
|
||||||
@@ -30,6 +31,8 @@ enum {
|
|||||||
SMP_MSG_NR, /* must be last */
|
SMP_MSG_NR, /* must be last */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DECLARE_PER_CPU(int, cpu_state);
|
||||||
|
|
||||||
void smp_message_recv(unsigned int msg);
|
void smp_message_recv(unsigned int msg);
|
||||||
void smp_timer_broadcast(const struct cpumask *mask);
|
void smp_timer_broadcast(const struct cpumask *mask);
|
||||||
|
|
||||||
|
@@ -33,6 +33,9 @@ int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */
|
|||||||
|
|
||||||
struct plat_smp_ops *mp_ops = NULL;
|
struct plat_smp_ops *mp_ops = NULL;
|
||||||
|
|
||||||
|
/* State of each CPU */
|
||||||
|
DEFINE_PER_CPU(int, cpu_state) = { 0 };
|
||||||
|
|
||||||
void __cpuinit register_smp_ops(struct plat_smp_ops *ops)
|
void __cpuinit register_smp_ops(struct plat_smp_ops *ops)
|
||||||
{
|
{
|
||||||
if (mp_ops)
|
if (mp_ops)
|
||||||
@@ -72,11 +75,13 @@ void __devinit smp_prepare_boot_cpu(void)
|
|||||||
|
|
||||||
set_cpu_online(cpu, true);
|
set_cpu_online(cpu, true);
|
||||||
set_cpu_possible(cpu, true);
|
set_cpu_possible(cpu, true);
|
||||||
|
|
||||||
|
per_cpu(cpu_state, cpu) = CPU_ONLINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage void __cpuinit start_secondary(void)
|
asmlinkage void __cpuinit start_secondary(void)
|
||||||
{
|
{
|
||||||
unsigned int cpu;
|
unsigned int cpu = smp_processor_id();
|
||||||
struct mm_struct *mm = &init_mm;
|
struct mm_struct *mm = &init_mm;
|
||||||
|
|
||||||
enable_mmu();
|
enable_mmu();
|
||||||
@@ -90,12 +95,10 @@ asmlinkage void __cpuinit start_secondary(void)
|
|||||||
|
|
||||||
preempt_disable();
|
preempt_disable();
|
||||||
|
|
||||||
notify_cpu_starting(smp_processor_id());
|
notify_cpu_starting(cpu);
|
||||||
|
|
||||||
local_irq_enable();
|
local_irq_enable();
|
||||||
|
|
||||||
cpu = smp_processor_id();
|
|
||||||
|
|
||||||
/* Enable local timers */
|
/* Enable local timers */
|
||||||
local_timer_setup(cpu);
|
local_timer_setup(cpu);
|
||||||
calibrate_delay();
|
calibrate_delay();
|
||||||
@@ -103,6 +106,7 @@ asmlinkage void __cpuinit start_secondary(void)
|
|||||||
smp_store_cpu_info(cpu);
|
smp_store_cpu_info(cpu);
|
||||||
|
|
||||||
set_cpu_online(cpu, true);
|
set_cpu_online(cpu, true);
|
||||||
|
per_cpu(cpu_state, cpu) = CPU_ONLINE;
|
||||||
|
|
||||||
cpu_idle();
|
cpu_idle();
|
||||||
}
|
}
|
||||||
@@ -127,6 +131,8 @@ int __cpuinit __cpu_up(unsigned int cpu)
|
|||||||
return PTR_ERR(tsk);
|
return PTR_ERR(tsk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
|
||||||
|
|
||||||
/* Fill in data in head.S for secondary cpus */
|
/* Fill in data in head.S for secondary cpus */
|
||||||
stack_start.sp = tsk->thread.sp;
|
stack_start.sp = tsk->thread.sp;
|
||||||
stack_start.thread_info = tsk->stack;
|
stack_start.thread_info = tsk->stack;
|
||||||
|
Reference in New Issue
Block a user