From patchwork Thu Jul 17 15:23:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 4576261 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 CA623C0514 for ; Thu, 17 Jul 2014 15:27:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 05CBD20107 for ; Thu, 17 Jul 2014 15:27:37 +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 E5BCA200D0 for ; Thu, 17 Jul 2014 15:27:35 +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 1X7nYJ-00070s-09; Thu, 17 Jul 2014 15:24:59 +0000 Received: from mailout4.w1.samsung.com ([210.118.77.14]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X7nYF-0006z2-Nv for linux-arm-kernel@lists.infradead.org; Thu, 17 Jul 2014 15:24:56 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8V0044444NCL00@mailout4.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 17 Jul 2014 16:24:23 +0100 (BST) X-AuditID: cbfec7f5-b7f626d000004b39-31-53c7eaaf16d0 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id F3.7E.19257.FAAE7C35; Thu, 17 Jul 2014 16:24:31 +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 <0N8V004QV44S7J70@eusync1.samsung.com>; Thu, 17 Jul 2014 16:24:31 +0100 (BST) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Subject: [PATCH] irqchip: gic: Fix core ID calculation when topology is read from DT Date: Thu, 17 Jul 2014 17:23:44 +0200 Message-id: <1405610624-18722-1-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.9.3 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFJMWRmVeSWpSXmKPExsVy+t/xy7rrXx0PNvh0ysBi44z1rBaNSy6z WPQuuMpmsenxNVaLy7vmsFnMOL+PyeLN7xfsFmuP3GW3WD/jNYvF5k1TmS1W7frD6MDtsWbe GkaPnbPusns0HDjP4vHu3Dl2j81L6j36tqxi9Pi8SS6APYrLJiU1J7MstUjfLoEr43pfdsEB /orL0x+wNTB+5+li5OSQEDCR+Lz/PiOELSZx4d56ti5GLg4hgaWMEltPbmGEcPqYJC5d/AlW xSagJvG54REbiC0ioCrxuW0BO0gRs8AMZokZu1YygSSEBcIkvn39zwpiswAVfV93n6WLkYOD V8BJom0DG8Q2OYnebW+YJzByL2BkWMUomlqaXFCclJ5rpFecmFtcmpeul5yfu4kREl5fdzAu PWZ1iFGAg1GJh/cH1/FgIdbEsuLK3EOMEhzMSiK82feBQrwpiZVVqUX58UWlOanFhxiZODil Ghhb1KMNQ2LOZAp6Gk7jiD9y6935nrVeKwV9ufTcrH+U3hHbWJr5Levif48F+qvq3z/bVeQ/ ycxTlb9qzanM6oBMzbC4uZY210I45ht8aRa87BX3sNTXhM9FKOb22ff883dXTDjpUbiw48Kp Cb1Rs8vXF4eXPnmfvDWC8chd/3XKoZNatkn3LldiKc5INNRiLipOBABX1GDHDQIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140717_082455_932085_2C35801F X-CRM114-Status: UNSURE ( 9.98 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.0 (-----) Cc: Kukjin Kim , Jason Cooper , Bartlomiej Zolnierkiewicz , Tomasz Figa , Tomasz Figa , linux-kernel@vger.kernel.org, Lorenzo Pieralisi , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Marek Szyprowski 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=-1.9 required=5.0 tests=BAYES_00,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 Certain GIC implementation, namely those found on earlier, single cluster, Exynos SoCs, have registers mapped without per-CPU banking, which means that the driver needs to use different offset for each CPU. Currently the driver calculates the offset by multiplying value returned by cpu_logical_map() by CPU offset parsed from DT. This is correct when CPU topology is not specified in DT and aforementioned function returns core ID alone. However when DT contains CPU topology, the function changes to return cluster ID as well, which is non-zero on mentioned SoCs and so breaks the calculation in GIC driver. This patch fixes this by masking out cluster ID in CPU offset calculation so that only core ID is considered. Multi-cluster Exynos SoCs already have banked GIC implementations, so this simple fix should be enough. Reported-by: Lorenzo Pieralisi Reported-by: Bartlomiej Zolnierkiewicz Signed-off-by: Tomasz Figa --- drivers/irqchip/irq-gic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index ddee133..5c15a09 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -901,7 +902,9 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start, } for_each_possible_cpu(cpu) { - unsigned long offset = percpu_offset * cpu_logical_map(cpu); + u32 mpidr = cpu_logical_map(cpu); + u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); + unsigned long offset = percpu_offset * core_id; *per_cpu_ptr(gic->dist_base.percpu_base, cpu) = dist_base + offset; *per_cpu_ptr(gic->cpu_base.percpu_base, cpu) = cpu_base + offset; }