Commit 4b52933b authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Russell King

[PATCH] 995/1: better EBSA110 idle

This should bring better performances as all interrupts are always run with 
clock switching enabled and the idle spinning always with the lower clock.

This also keeps the brokenness of that architecture localized while 
preserving the sanity of the common SA idle function.
parent 1b07391f
...@@ -17,29 +17,34 @@ ...@@ -17,29 +17,34 @@
* will stop our MCLK signal (which provides the clock for the glue * will stop our MCLK signal (which provides the clock for the glue
* logic, and therefore the timer interrupt). * logic, and therefore the timer interrupt).
* *
* Instead, we spin, waiting for either hlt_counter or need_resched() * Instead, we spin, polling the IRQ_STAT register for the occurrence
* to be set. If we have been spinning for 2cs, then we drop the * of any interrupt with core clock down to the memory clock.
* core clock down to the memory clock.
*/ */
static void arch_idle(void) static void arch_idle(void)
{ {
unsigned long start_idle; const char *irq_stat = (char *)0xff000000;
long flags;
start_idle = jiffies; if (!hlt_counter)
return;
do { do {
if (need_resched() || hlt_counter) /* disable interrupts */
goto slow_out; cli();
} while (time_before(jiffies, start_idle + HZ/50)); /* check need_resched here to avoid races */
if (need_resched()) {
cpu_do_idle(IDLE_CLOCK_SLOW); sti();
return;
while (!need_resched() && !hlt_counter) { }
/* do nothing slowly */ /* disable clock switching */
} asm volatile ("mcr%? p15, 0, ip, c15, c2, 2");
/* wait for an interrupt to occur */
cpu_do_idle(IDLE_CLOCK_FAST); while (!*irq_stat);
slow_out: /* enable clock switching */
asm volatile ("mcr%? p15, 0, ip, c15, c1, 2");
/* allow the interrupt to happen */
sti();
} while (!need_resched());
} }
#define arch_reset(mode) cpu_reset(0x80000000) #define arch_reset(mode) cpu_reset(0x80000000)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment