From patchwork Mon Aug 26 16:33:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2849697 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 D62EABF546 for ; Mon, 26 Aug 2013 16:34:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB8EC203DF for ; Mon, 26 Aug 2013 16:34:51 +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 40D5A203AD for ; Mon, 26 Aug 2013 16:34:50 +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 1VDzkb-0006qo-3z; Mon, 26 Aug 2013 16:34:45 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VDzkY-0003nJ-RL; Mon, 26 Aug 2013 16:34:42 +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 1VDzkU-0003mn-2v for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2013 16:34:40 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) 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 <0MS500J1RCOJTID0@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2013 17:34:11 +0100 (BST) X-AuditID: cbfec7f4-b7f0a6d000007b1b-00-521b8383d389 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 20.03.31515.3838B125; Mon, 26 Aug 2013 17:34:11 +0100 (BST) Received: from amdc1227.digital.local ([106.116.147.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MS500C6BCOS1990@eusync1.samsung.com>; Mon, 26 Aug 2013 17:34:11 +0100 (BST) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Subject: [PATCH] clocksource: exynos_mct: Set IRQ affinity when the CPU goes online Date: Mon, 26 Aug 2013 18:33:56 +0200 Message-id: <1377534836-21682-1-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.8.3.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGJMWRmVeSWpSXmKPExsVy+t/xy7rNzdJBBttWclnM+yxr0bvgKpvF 2aY37BabHl9jtZhxfh+Txe3LvBanrn9ms/hxppvFYv2M1ywWmzdNZXbg8mhp7mHzuNzXy+Rx 59oeNo93586xe2xeUu9x5UQTq0ffllWMHp83yQVwRHHZpKTmZJalFunbJXBl3JqkXdAkUjF9 AWcD4zaBLkZODgkBE4n7D/cyQ9hiEhfurWcDsYUEljJKNP3U7GLkArL7mCRutf1mAUmwCahJ fG54BFYkIqAq8bltATtIEbPAOyaJjy9vsYMkhAVCJR60gEzi4GABKnrw3R8kzCvgJHFwYTPU MgWJZV/WMk9g5F7AyLCKUTS1NLmgOCk911CvODG3uDQvXS85P3cTIySsvuxgXHzM6hCjAAej Eg/viiKpICHWxLLiytxDjBIczEoivByp0kFCvCmJlVWpRfnxRaU5qcWHGJk4OKUaGFP0VZ4+ e+F/Lei1gRpnXvCJT/Y6Iptn79yRNbO0smpf/PrbD4OP1Drxlp5+VCbx47b0l4bsELNGX1EG 5d0Hk9aUd0tsmbuU71PVRo/Eh5PE1+lNv9uYrPaGWf+sYGVMVtiZWK145WAu3ps5p6YweFo3 Lvu29fHcBzmbhH/sn79a4oLyrg/nNJRYijMSDbWYi4oTAY16958JAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130826_123438_232889_A9869938 X-CRM114-Status: GOOD ( 14.09 ) X-Spam-Score: -9.3 (---------) Cc: Kukjin Kim , Russell King - ARM Linux , Tomasz Figa , Daniel Lezcano , Stephen Boyd , Kyungmin Park , Olof Johansson , Thomas Gleixner , linux-arm-kernel@lists.infradead.org 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=-6.6 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 Some variants of Exynos MCT, namely exynos4210-mct at the moment, use normal, shared interrupts for local timers. This means that each interrupt must have correct affinity set to fire only on CPU corresponding to given local timer. However after recent conversion of clocksource drivers to not use the local timer API for local timer initialization any more, the point of time when local timers get initialized changed and irq_set_affinity() fails because the CPU is not marked as online yet. This patch fixes this by moving the call to irq_set_affinity() to CPU_ONLINE notification, so the affinity is being set when the CPU goes online. This fixes a problem with Exynos4210 failing to boot, present since commit ee98d27df6 ARM: EXYNOS4: Divorce mct from local timer API due to failing irq_set_affinity(). Signed-off-by: Tomasz Figa Signed-off-by: Kyungmin Park Acked-by: Stephen Boyd --- drivers/clocksource/exynos_mct.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index 5b34768..62b0de6 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c @@ -428,7 +428,6 @@ static int exynos4_local_timer_setup(struct clock_event_device *evt) evt->irq); return -EIO; } - irq_set_affinity(evt->irq, cpumask_of(cpu)); } else { enable_percpu_irq(mct_irqs[MCT_L0_IRQ], 0); } @@ -449,6 +448,7 @@ static int exynos4_mct_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) { struct mct_clock_event_device *mevt; + unsigned int cpu; /* * Grab cpu pointer in each case to avoid spurious @@ -459,6 +459,12 @@ static int exynos4_mct_cpu_notify(struct notifier_block *self, mevt = this_cpu_ptr(&percpu_mct_tick); exynos4_local_timer_setup(&mevt->evt); break; + case CPU_ONLINE: + cpu = (unsigned long)hcpu; + if (mct_int_type == MCT_INT_SPI) + irq_set_affinity(mct_irqs[MCT_L0_IRQ + cpu], + cpumask_of(cpu)); + break; case CPU_DYING: mevt = this_cpu_ptr(&percpu_mct_tick); exynos4_local_timer_stop(&mevt->evt); @@ -500,6 +506,8 @@ static void __init exynos4_timer_resources(struct device_node *np, void __iomem &percpu_mct_tick); WARN(err, "MCT: can't request IRQ %d (%d)\n", mct_irqs[MCT_L0_IRQ], err); + } else { + irq_set_affinity(mct_irqs[MCT_L0_IRQ], cpumask_of(0)); } err = register_cpu_notifier(&exynos4_mct_cpu_nb);