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

Commit f7b861b7 authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

arm: Use generic idle loop



Use the generic idle loop and replace enable/disable_hlt with the
respective core functions.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Reviewed-by: default avatarCc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Tested-by: Kevin Hilman <khilman@linaro.org> # OMAP
Link: http://lkml.kernel.org/r/20130321215233.826238797@linutronix.de
parent a123322d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ config ARM
	select GENERIC_IRQ_SHOW
	select GENERIC_PCI_IOMAP
	select GENERIC_SMP_IDLE_THREAD
	select GENERIC_IDLE_LOOP
	select GENERIC_IDLE_POLL_SETUP
	select GENERIC_STRNCPY_FROM_USER
	select GENERIC_STRNLEN_USER
	select HARDIRQS_SW_RESEND
+0 −3
Original line number Diff line number Diff line
@@ -21,9 +21,6 @@ extern void (*arm_pm_idle)(void);

extern unsigned int user_debug;

extern void disable_hlt(void);
extern void enable_hlt(void);

#endif /* !__ASSEMBLY__ */

#endif /* __ASM_ARM_SYSTEM_MISC_H */
+26 −70
Original line number Diff line number Diff line
@@ -57,34 +57,6 @@ static const char *isa_modes[] = {
  "ARM" , "Thumb" , "Jazelle", "ThumbEE"
};

static volatile int hlt_counter;

void disable_hlt(void)
{
	hlt_counter++;
}

void enable_hlt(void)
{
	hlt_counter--;
	BUG_ON(hlt_counter < 0);
}

static int __init nohlt_setup(char *__unused)
{
	hlt_counter = 1;
	return 1;
}

static int __init hlt_setup(char *__unused)
{
	hlt_counter = 0;
	return 1;
}

__setup("nohlt", nohlt_setup);
__setup("hlt", hlt_setup);

extern void call_with_stack(void (*fn)(void *), void *arg, void *sp);
typedef void (*phys_reset_t)(unsigned long);

@@ -168,54 +140,38 @@ static void default_idle(void)
	local_irq_enable();
}

/*
 * The idle thread.
 * We always respect 'hlt_counter' to prevent low power idle.
 */
void cpu_idle(void)
void arch_cpu_idle_prepare(void)
{
	local_fiq_enable();
}

	/* endless idle loop with no priority at all */
	while (1) {
		tick_nohz_idle_enter();
		rcu_idle_enter();
void arch_cpu_idle_enter(void)
{
	ledtrig_cpu(CPU_LED_IDLE_START);
		while (!need_resched()) {
#ifdef CONFIG_PL310_ERRATA_769419
	wmb();
#endif
}

void arch_cpu_idle_exit(void)
{
	ledtrig_cpu(CPU_LED_IDLE_END);
}

#ifdef CONFIG_HOTPLUG_CPU
			if (cpu_is_offline(smp_processor_id()))
void arch_cpu_idle_dead(void)
{
	cpu_die();
}
#endif

/*
			 * We need to disable interrupts here
			 * to ensure we don't miss a wakeup call.
 * Called from the core idle loop.
 */
			local_irq_disable();
#ifdef CONFIG_PL310_ERRATA_769419
			wmb();
#endif
			if (hlt_counter) {
				local_irq_enable();
				cpu_relax();
			} else if (!need_resched()) {
				stop_critical_timings();
void arch_cpu_idle(void)
{
	if (cpuidle_idle_call())
		default_idle();
				start_critical_timings();
				/*
				 * default_idle functions must always
				 * return with IRQs enabled.
				 */
				WARN_ON(irqs_disabled());
			} else
				local_irq_enable();
		}
		ledtrig_cpu(CPU_LED_IDLE_END);
		rcu_idle_exit();
		tick_nohz_idle_exit();
		schedule_preempt_disabled();
	}
}

static char reboot_mode = 'h';
+1 −1
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
	/*
	 * OK, it's off to the idle thread for us
	 */
	cpu_idle();
	cpu_startup_entry(CPUHP_ONLINE);
}

void __init smp_cpus_done(unsigned int max_cpus)
+3 −1
Original line number Diff line number Diff line
@@ -13,9 +13,11 @@ static void gemini_idle(void)
	 * will never wakeup... Acctualy it is not very good to enable
	 * interrupts first since scheduler can miss a tick, but there is
	 * no other way around this. Platforms that needs it for power saving
	 * should call enable_hlt() in init code, since by default it is
	 * should enable it in init code, since by default it is
	 * disabled.
	 */

	/* FIXME: Enabling interrupts here is racy! */
	local_irq_enable();
	cpu_do_idle();
}
Loading