From patchwork Mon Jun 10 06:56:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Larsson X-Patchwork-Id: 250181 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 806B42C02C7 for ; Mon, 10 Jun 2013 16:56:50 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751471Ab3FJG4s (ORCPT ); Mon, 10 Jun 2013 02:56:48 -0400 Received: from vsp-authed02.binero.net ([195.74.38.226]:22813 "HELO vsp-authed-02-02.binero.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751419Ab3FJG4s (ORCPT ); Mon, 10 Jun 2013 02:56:48 -0400 Received: from smtp01.binero.se (unknown [195.74.38.28]) by vsp-authed-02-02.binero.net (Halon Mail Gateway) with ESMTP; Mon, 10 Jun 2013 08:56:41 +0200 (CEST) Received: from localhost.localdomain (static-92-33-28-242.sme.bredbandsbolaget.se [92.33.28.242]) (Authenticated sender: andreas@gaisler.com) by smtp-04-01.atm.binero.net (Postfix) with ESMTPA id B6D153A15F; Mon, 10 Jun 2013 08:56:40 +0200 (CEST) From: Andreas Larsson To: davem@davemloft.net, sam@ravnborg.org Cc: sparclinux@vger.kernel.org, software@gaisler.com Subject: [PATCH] sparc32, leon: Enable interrupts before going idle to avoid getting stuck Date: Mon, 10 Jun 2013 08:56:41 +0200 Message-Id: <1370847401-766-1-git-send-email-andreas@gaisler.com> X-Mailer: git-send-email 1.7.10.4 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org 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. Signed-off-by: Andreas Larsson --- 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(+) diff --git a/arch/sparc/kernel/leon_pmc.c b/arch/sparc/kernel/leon_pmc.c index bdf53d9..b0b3967 100644 --- a/arch/sparc/kernel/leon_pmc.c +++ b/arch/sparc/kernel/leon_pmc.c @@ -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"); }