From patchwork Tue Jun 10 23:14:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 4332851 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A22B79F314 for ; Tue, 10 Jun 2014 23:19:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A22E82015E for ; Tue, 10 Jun 2014 23:19:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2B3E20158 for ; Tue, 10 Jun 2014 23:19:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WuVH2-0005mk-Dp; Tue, 10 Jun 2014 23:16:12 +0000 Received: from mail-qc0-x22a.google.com ([2607:f8b0:400d:c01::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WuVGz-0005ki-EC for linux-arm-kernel@lists.infradead.org; Tue, 10 Jun 2014 23:16:10 +0000 Received: by mail-qc0-f170.google.com with SMTP id l6so3337863qcy.15 for ; Tue, 10 Jun 2014 16:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=SRnZKvUS6/5AOsd/48krZ83hqw1K/Q2eWC8sQ8/zKe4=; b=xVS4joMqF8ea+prvN5jryOMPMwocus+LtA7GqyOwY0cKPEzraLMsxjxWFFYPVZ7PuP bGaGEyn8OSnuXhv09hdrDBaMXrykLWi+ulmJrcTvIEkZ/B9T29B7kk/RzjkWDNtlSOn3 T/EltjPJaliZfp0dXZ9kBncwjthb+dQfNhVzym7EGbE/YR1bYQFbEMAVqqx3oKkMIGoF ZfZ4uTZrwsDbeTpMObV7csKyOFjCknCxWM/XLdBxxlfwm6we+vZWZWqJhxflnI92z8qN LIn8Ak/Smye3zjHMuISsIoM5jMh78PI4QuuVBbJvByCgbnzw5etrAqyRFYP+3Eu+vHf+ PvEw== X-Received: by 10.224.130.196 with SMTP id u4mr47742660qas.13.1402442147324; Tue, 10 Jun 2014 16:15:47 -0700 (PDT) Received: from ld-irv-0074.broadcom.com (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by mx.google.com with ESMTPSA id r14sm14650810qga.4.2014.06.10.16.15.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Jun 2014 16:15:46 -0700 (PDT) From: Brian Norris To: Thomas Gleixner Subject: [RFC] irqchip: gic: always mask interrupts during suspend Date: Tue, 10 Jun 2014 16:14:58 -0700 Message-Id: <1402442098-21093-1-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140610_161609_554760_027CB346 X-CRM114-Status: GOOD ( 18.37 ) X-Spam-Score: -0.1 (/) Cc: Florian Fainelli , Jason Cooper , Stephen Warren , Tony Lindgren , Linus Walleij , Michal Simek , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, Thierry Reding , linux-tegra@vger.kernel.org, Brian Norris , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The core kernel IRQ code will disable all non-wakeup interrupts before suspend, but because the GIC uses lazy masking (i.e., it doesn't mask interrupts, but only disables them logically), we still might be processing interrupts after the last call for interrupts (check_wakeup_irqs()). This can cause various problems, so let's just always mask our interrupts before suspend. Several platforms already tweak the GIC irqchip flags to do this (and I'm working on bringing up another platform that needs this), so let's just set IRQCHIP_MASK_ON_SUSPEND by default. Signed-off-by: Brian Norris Cc: Tony Lindgren Cc: Stephen Warren Cc: Thierry Reding Cc: Linus Walleij Cc: Michal Simek Cc: Thomas Gleixner Cc: Jason Cooper Cc: linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-tegra@vger.kernel.org --- This is just an RFC. If it is acceptable, I'll need to break it up for application to each sub-arch tree. I really don't like the gic_arch_extn approach to customizing the GIC driver, so I thought this was one opportunity to unify some platform code. If this approach isn't accpetable, I can simply add this flag to my own machine init code. But I thought this was a good starting place for discussion about this odd piece of code. Other random thought: it seems like any irqchip driver which does lazy IRQ masking ought to use IRQCHIP_MASK_ON_SUSPEND. So maybe the IRQ core should just do something like: if (!chip->irq_disable) chip->flags |= IRQCHIP_MASK_ON_SUSPEND; arch/arm/mach-omap2/omap-wakeupgen.c | 2 +- arch/arm/mach-tegra/irq.c | 1 - arch/arm/mach-ux500/cpu.c | 2 +- arch/arm/mach-zynq/common.c | 2 +- drivers/irqchip/irq-gic.c | 1 + 5 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c index 37843a7d3639..c9c12ea6dd09 100644 --- a/arch/arm/mach-omap2/omap-wakeupgen.c +++ b/arch/arm/mach-omap2/omap-wakeupgen.c @@ -440,7 +440,7 @@ int __init omap_wakeupgen_init(void) */ gic_arch_extn.irq_mask = wakeupgen_mask; gic_arch_extn.irq_unmask = wakeupgen_unmask; - gic_arch_extn.flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_SKIP_SET_WAKE; + gic_arch_extn.flags = IRQCHIP_SKIP_SET_WAKE; /* * FIXME: Add support to set_smp_affinity() once the core diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c index 1a74d562dca1..6f0529021520 100644 --- a/arch/arm/mach-tegra/irq.c +++ b/arch/arm/mach-tegra/irq.c @@ -281,7 +281,6 @@ void __init tegra_init_irq(void) gic_arch_extn.irq_unmask = tegra_unmask; gic_arch_extn.irq_retrigger = tegra_retrigger; gic_arch_extn.irq_set_wake = tegra_set_wake; - gic_arch_extn.flags = IRQCHIP_MASK_ON_SUSPEND; /* * Check if there is a devicetree present, since the GIC will be diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index db16b5a04ad5..ce2bfe39dd82 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c @@ -52,7 +52,7 @@ void ux500_restart(enum reboot_mode mode, const char *cmd) */ void __init ux500_init_irq(void) { - gic_arch_extn.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND; + gic_arch_extn.flags = IRQCHIP_SKIP_SET_WAKE; irqchip_init(); /* diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 31a6fa40ba37..6defcea545d6 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -182,7 +182,7 @@ static void __init zynq_map_io(void) static void __init zynq_irq_init(void) { - gic_arch_extn.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND; + gic_arch_extn.flags = IRQCHIP_SKIP_SET_WAKE; irqchip_init(); } diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 7e11c9d6ae8c..0117e36a3bbd 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c @@ -1032,6 +1032,7 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start, } gic_chip.flags |= gic_arch_extn.flags; + gic_chip.flags |= IRQCHIP_MASK_ON_SUSPEND; gic_dist_init(gic); gic_cpu_init(gic); gic_pm_init(gic);