Skip to contentSkip to conversation

sparc32, leon: Enable interrupts before going idle to avoid getting stuck

PATCH Applied Andreas Larsson 2 participants 4 messages Jun 10, 2013 – Jun 19, 2013 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

Andreas Larsson

author maintainer
#0 lore raw

PATCH 1/1 sparc32, leon: Enable interrupts before going idle to avoid getting stuck

This enables interrupts for Leon before having the CPU enter power-down mode.

Commit 87fa05aeb3a5e8e21b1a5510eef6983650eff092, "sparc: Use generic idle loop", gets the CPU stuck on idle for Leon systems. On Leon, disabling interrupts and powering down the processor will get the processor stuck waiting for an interrupt that will never be reacted to.

---

I assume that going idle with interrupts disabled is the right thing to do for the other users of the sparc_idle function pointer. Otherwise, the right way to go is probably to enable interrupts in the 32-bit arch_cpu_idle before calling the idle function instead.

 arch/sparc/kernel/leon_pmc.c |    7 +++++++
 1 file changed, 7 insertions(+)
arch/sparc/kernel/leon_pmc.c +7 -0
index bdf53d9..b0b3967 100644
@@ -47,6 +47,10 @@ void pmc_leon_idle_fixup(void)
 	 * MMU does not get a TLB miss here by using the MMU BYPASS ASI.
 	 */
 	register unsigned int address = (unsigned int)leon3_irqctrl_regs;
+
+	/* Interrupts need to be enabled to not hang the CPU */
+	local_irq_enable();
+
 	__asm__ __volatile__ (
 		"wr	%%g0, %%asr19\n"
 		"lda	[%0] %1, %%g0\n"
@@ -60,6 +64,9 @@ void pmc_leon_idle_fixup(void)
  */
 void pmc_leon_idle(void)
 {
+	/* Interrupts need to be enabled to not hang the CPU */
+	local_irq_enable();
+
 	/* For systems without power-down, this will be no-op */
 	__asm__ __volatile__ ("wr	%g0, %asr19\n\t");
 }
Signature · 1 line
1.7.10.4
author maintainer
#1 lore raw
Quoted 6 lines · Andreas Larsson

This enables interrupts for Leon before having the CPU enter power-down mode.

Commit 87fa05aeb3a5e8e21b1a5510eef6983650eff092, "sparc: Use generic idle loop", gets the CPU stuck on idle for Leon systems. On Leon, disabling interrupts and powering down the processor will get the processor stuck waiting for an interrupt that will never be reacted to.

Anything stopping this from going into v3.10-rc7? The issue is critical. Commit 87fa05aeb3a5e8e21b1a5510eef6983650eff092 outright breaks the kernel for Leon systems.

Best Regards,
Andreas Larsson

Quoted 38 lines

---

I assume that going idle with interrupts disabled is the right thing to do for the other users of the sparc_idle function pointer. Otherwise, the right way to go is probably to enable interrupts in the 32-bit arch_cpu_idle before calling the idle function instead.

  arch/sparc/kernel/leon_pmc.c |    7 +++++++
  1 file changed, 7 insertions(+)
arch/sparc/kernel/leon_pmc.c +7 -0
index bdf53d9..b0b3967 100644
@@ -47,6 +47,10 @@ void pmc_leon_idle_fixup(void)
  	 * MMU does not get a TLB miss here by using the MMU BYPASS ASI.
  	 */
  	register unsigned int address = (unsigned int)leon3_irqctrl_regs;
+
+	/* Interrupts need to be enabled to not hang the CPU */
+	local_irq_enable();
+
  	__asm__ __volatile__ (
  		"wr	%%g0, %%asr19\n"
  		"lda	[%0] %1, %%g0\n"
@@ -60,6 +64,9 @@ void pmc_leon_idle_fixup(void)
   */
  void pmc_leon_idle(void)
  {
+	/* Interrupts need to be enabled to not hang the CPU */
+	local_irq_enable();
+
  	/* For systems without power-down, this will be no-op */
  	__asm__ __volatile__ ("wr	%g0, %asr19\n\t");
  }
maintainer
#2 lore raw
In reply to Andreas Larsson

From: Andreas Larsson <[email protected]>
Date: Mon, 17 Jun 2013 08:13:41 +0200

Quoted 12 lines · Andreas Larsson
Quoted 10 lines

This enables interrupts for Leon before having the CPU enter power-down mode.

Commit 87fa05aeb3a5e8e21b1a5510eef6983650eff092, "sparc: Use generic idle loop",
gets the CPU stuck on idle for Leon systems. On Leon, disabling interrupts and
powering down the processor will get the processor stuck waiting for an
interrupt that will never be reacted to.

Quoted 3 lines

Anything stopping this from going into v3.10-rc7? The issue is critical. Commit 87fa05aeb3a5e8e21b1a5510eef6983650eff092 outright breaks the kernel for Leon systems.

I'm just backlogged, I'll take care of this tomorrow.

Thanks.

maintainer Applied
#3 lore raw
In reply to Andreas Larsson

From: Andreas Larsson <[email protected]>
Date: Mon, 10 Jun 2013 08:56:41 +0200

Quoted 8 lines

This enables interrupts for Leon before having the CPU enter power-down mode.

Commit 87fa05aeb3a5e8e21b1a5510eef6983650eff092, "sparc: Use generic idle loop", gets the CPU stuck on idle for Leon systems. On Leon, disabling interrupts and powering down the processor will get the processor stuck waiting for an interrupt that will never be reacted to.

Applied.