From patchwork Tue Aug 20 16:11:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2847177 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AA91FBF546 for ; Tue, 20 Aug 2013 16:12:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B8CF20517 for ; Tue, 20 Aug 2013 16:12:08 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B485420513 for ; Tue, 20 Aug 2013 16:12:06 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VBoXC-0001pL-M4; Tue, 20 Aug 2013 16:11:54 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VBoXA-0000YG-F4; Tue, 20 Aug 2013 16:11:52 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VBoX6-0000Wx-Ke for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2013 16:11:50 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MRU00F5Z7MZB1C0@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2013 17:11:23 +0100 (BST) X-AuditID: cbfec7f5-b7f5f6d00000105f-0c-5213952b1809 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id AD.70.04191.B2593125; Tue, 20 Aug 2013 17:11:23 +0100 (BST) Received: from amdc1227.digital.local ([106.116.147.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MRU00FLB7MWZ870@eusync2.samsung.com>; Tue, 20 Aug 2013 17:11:23 +0100 (BST) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] irqchip: gic: Allow setting affinity to offline CPUs Date: Tue, 20 Aug 2013 18:11:10 +0200 Message-id: <1377015070-26320-1-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.8.3.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJJMWRmVeSWpSXmKPExsVy+t/xK7raU4WDDG6vZbc42/SG3WLT42us FjPO72Oy+HGmm8Vi/YzXLBabN01ldmDzuNzXy+Tx7tw5do/NS+o9+rasYvT4vEkugDWKyyYl NSezLLVI3y6BK+P31J0sBZO4K5Z1/GVpYOzh7GLk5JAQMJFYe+snI4QtJnHh3nq2LkYuDiGB pYwSFx70Qjl9TBJz1i8Bq2ITUJP43PCIDcQWEdCQmNL1mB2kiFngIKPE1MmnmEASwgKuEo9v 3GQGsVkEVCX+N94Ba+YVcJJY2nyTHWKdgsSyL2uZJzByL2BkWMUomlqaXFCclJ5rpFecmFtc mpeul5yfu4kREhxfdzAuPWZ1iFGAg1GJh5ejRDhIiDWxrLgy9xCjBAezkgjvtgygEG9KYmVV alF+fFFpTmrxIUYmDk6pBkb98pAdj641T5rLrd8p+khix68/Xw+GvjlevLK3y+LIvowlFjXv PDOX3P/B9fin/6lLRpdf+1WqfdDorb7EEMAatrpRMaTjudK+Iu4v32y+cwhZW55aLnFK6G3T 9MsVUjdfXcraypZnExXdIml3rCh9xjefNWv9/9vc2rJfnunT2e2bTOVeckxSYinOSDTUYi4q TgQAGYMsGOwBAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130820_121148_853487_424584E0 X-CRM114-Status: GOOD ( 10.08 ) X-Spam-Score: -9.7 (---------) Cc: Kyungmin Park , Thomas Gleixner , linux-samsung-soc@vger.kernel.org, Stephen Boyd , Tomasz Figa X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 Sometimes it is necessary to fix interrupt affinity to an offline CPU, for example in initialization of local timers. This patch modifies .set_affinity() operation of irq-gic driver to fall back to any possible CPU if no online CPU can be found in requested CPU mask. This fixes broken Exynos4210 support since commit ee98d27df6 ARM: EXYNOS4: Divorce mct from local timer API caused by timer initialization code unable to set affinity for local timer interrupts. Signed-off-by: Tomasz Figa Signed-off-by: Kyungmin Park --- drivers/irqchip/irq-gic.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index ee7c503..5f0797e 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c @@ -250,6 +250,15 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask); u32 val, mask, bit; + /* + * If no online CPU could be found, fall back to any possible CPU. + * + * This is to allow setting affinity of some interrupts to a CPU + * before it is marked as online, i.e. local timer initialization. + */ + if (cpu >= nr_cpu_ids) + cpu = cpumask_any_and(mask_val, cpu_possible_mask); + if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids) return -EINVAL;