Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 763142d1 authored by Paul Mundt's avatar Paul Mundt
Browse files

sh: CPU hotplug support.



This adds preliminary support for CPU hotplug for SH SMP systems.

Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 8db2bc45
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -706,6 +706,13 @@ config NR_CPUS
	  This is purely to save memory - each supported CPU adds
	  approximately eight kilobytes to the kernel image.

config HOTPLUG_CPU
	bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
	depends on SMP && HOTPLUG && EXPERIMENTAL
	help
	  Say Y here to experiment with turning CPUs off and on.  CPUs
	  can be controlled through /sys/devices/system/cpu.

source "kernel/Kconfig.preempt"

config GUSA
+3 −0
Original line number Diff line number Diff line
#ifndef __ASM_SH_IRQ_H
#define __ASM_SH_IRQ_H

#include <linux/cpumask.h>
#include <asm/machvec.h>

/*
@@ -50,6 +51,8 @@ static inline int generic_irq_demux(int irq)
#define irq_demux(irq)		sh_mv.mv_irq_demux(irq)

void init_IRQ(void);
void migrate_irqs(void);

asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs);

#ifdef CONFIG_IRQSTACKS
+14 −2
Original line number Diff line number Diff line
@@ -7,20 +7,27 @@ struct plat_smp_ops {
	void (*prepare_cpus)(unsigned int max_cpus);
	void (*start_cpu)(unsigned int cpu, unsigned long entry_point);
	void (*send_ipi)(unsigned int cpu, unsigned int message);
	int (*cpu_disable)(unsigned int cpu);
	void (*cpu_die)(unsigned int cpu);
	void (*play_dead)(void);
};

extern struct plat_smp_ops *mp_ops;
extern struct plat_smp_ops shx3_smp_ops;

#ifdef CONFIG_SMP

static inline void plat_smp_setup(void)
{
	extern struct plat_smp_ops *mp_ops;	/* private */

	BUG_ON(!mp_ops);
	mp_ops->smp_setup();
}

static inline void play_dead(void)
{
	mp_ops->play_dead();
}

extern void register_smp_ops(struct plat_smp_ops *ops);

#else
@@ -34,6 +41,11 @@ static inline void register_smp_ops(struct plat_smp_ops *ops)
{
}

static inline void play_dead(void)
{
	BUG();
}

#endif /* CONFIG_SMP */

#endif /* __ASM_SH_SMP_OPS_H */
+18 −1
Original line number Diff line number Diff line
@@ -38,9 +38,26 @@ void smp_timer_broadcast(const struct cpumask *mask);

void local_timer_interrupt(void);
void local_timer_setup(unsigned int cpu);
void local_timer_stop(unsigned int cpu);

void arch_send_call_function_single_ipi(int cpu);
extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
void arch_send_call_function_ipi_mask(const struct cpumask *mask);

void native_play_dead(void);
void native_cpu_die(unsigned int cpu);
int native_cpu_disable(unsigned int cpu);

#ifdef CONFIG_HOTPLUG_CPU
void play_dead_common(void);
extern int __cpu_disable(void);

static inline void __cpu_die(unsigned int cpu)
{
	extern struct plat_smp_ops *mp_ops;     /* private */

	mp_ops->cpu_die(cpu);
}
#endif

static inline int hard_smp_processor_id(void)
{
+5 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <asm/pgalloc.h>
#include <asm/system.h>
#include <asm/atomic.h>
#include <asm/smp.h>

void (*pm_idle)(void) = NULL;

@@ -89,10 +90,13 @@ void cpu_idle(void)
	while (1) {
		tick_nohz_stop_sched_tick(1);

		while (!need_resched() && cpu_online(cpu)) {
		while (!need_resched()) {
			check_pgt_cache();
			rmb();

			if (cpu_is_offline(cpu))
				play_dead();

			local_irq_disable();
			/* Don't trace irqs off for idle */
			stop_critical_timings();
Loading