Commit cb3042d6 authored by David S. Miller's avatar David S. Miller

sparc64: Make sure %pil interrupts are enabled during hypervisor yield.

In arch_cpu_idle() we must enable %pil based interrupts before
potentially invoking the hypervisor cpu yield call.

As per the Hypervisor API documentation for cpu_yield:

	Interrupts which are blocked by some mechanism other that
	pstate.ie (for example %pil) are not guaranteed to cause
	a return from this service.

It seems that only first generation Niagara chips are hit by this
bug.  My best guess is that later chips implement this in hardware
and wake up anyways from %pil events, whereas in first generation
chips the yield is implemented completely in hypervisor code and
requires %pil to be enabled in order to wake properly from this
call.

Fixes: 87fa05ae ("sparc: Use generic idle loop")
Reported-by: default avatarFabio M. Di Nitto <fabbione@fabbione.net>
Reported-by: default avatarJan Engelhardt <jengelh@inai.de>
Tested-by: default avatarJan Engelhardt <jengelh@inai.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 151b628f
...@@ -58,9 +58,12 @@ void arch_cpu_idle(void) ...@@ -58,9 +58,12 @@ void arch_cpu_idle(void)
{ {
if (tlb_type != hypervisor) { if (tlb_type != hypervisor) {
touch_nmi_watchdog(); touch_nmi_watchdog();
local_irq_enable();
} else { } else {
unsigned long pstate; unsigned long pstate;
local_irq_enable();
/* The sun4v sleeping code requires that we have PSTATE.IE cleared over /* The sun4v sleeping code requires that we have PSTATE.IE cleared over
* the cpu sleep hypervisor call. * the cpu sleep hypervisor call.
*/ */
...@@ -82,7 +85,6 @@ void arch_cpu_idle(void) ...@@ -82,7 +85,6 @@ void arch_cpu_idle(void)
: "=&r" (pstate) : "=&r" (pstate)
: "i" (PSTATE_IE)); : "i" (PSTATE_IE));
} }
local_irq_enable();
} }
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
......
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