From patchwork Tue Feb 2 10:09:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapatrao Kulkarni X-Patchwork-Id: 8188041 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 77EA1BEEE5 for ; Tue, 2 Feb 2016 10:13:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8B4D8202BE for ; Tue, 2 Feb 2016 10:13:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 88D6B2025B for ; Tue, 2 Feb 2016 10:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754641AbcBBKLR (ORCPT ); Tue, 2 Feb 2016 05:11:17 -0500 Received: from mail-bn1bon0073.outbound.protection.outlook.com ([157.56.111.73]:11632 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754371AbcBBKLL (ORCPT ); Tue, 2 Feb 2016 05:11:11 -0500 Authentication-Results: lists.infradead.org; dkim=none (message not signed) header.d=none; lists.infradead.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from mypc.cavium.com.com (111.93.218.67) by CY1PR0701MB1696.namprd07.prod.outlook.com (10.163.20.30) with Microsoft SMTP Server (TLS) id 15.1.396.15; Tue, 2 Feb 2016 10:10:55 +0000 From: Ganapatrao Kulkarni To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH v10 4/8] arm64, numa : Enable numa dt for arm64 platforms. Date: Tue, 2 Feb 2016 15:39:19 +0530 Message-ID: <1454407763-1017-5-git-send-email-gkulkarni@caviumnetworks.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1454407763-1017-1-git-send-email-gkulkarni@caviumnetworks.com> References: <1454407763-1017-1-git-send-email-gkulkarni@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0067.INDPRD01.PROD.OUTLOOK.COM (25.163.199.39) To CY1PR0701MB1696.namprd07.prod.outlook.com (25.163.20.30) X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1696; 2:6cklu/5QrBeP9DgqQ4W3gAv1ZOTn9jlNwRhC24AEQ63hPQnM0DG5gCGlHwvr/XX4L5ll/I0dp8yrlaG70V3HigFUf5JZ4kkx/YLCQpN9jkM413+Y1dhd+75zz07iHTDsyQ7pSHCE16OA7wuosINJGA==; 3:oxNFxQDGt8jWoav6vBRxvllYLWtg6rjq3fSLZdm0u71FawRdWm3nWY/4BxEBrWkmNOSXbL53wt+PQS6VFrwbqNBmbTjeG1V5DnKOwqgEjwU2J342xsYd7TtlM1E1W6a5; 25:sxY7rT9uZnrj5hyBvirTrFhCMa3H5D0RrL4L9LmBRN4IIUcXwg+6vbRcLD8VWBFiO8/EIacvGGY/zZzgfBKKgxWO2Txzd6d2XZPkhBbWAmc75xTsLNQEDhs9KNabhKKSdL3A6etaiMB6syuPyjL9kZRrDRRaVjIX4mqSNvicwo/rRO+wIs5HdAeOXwhte1hW4nqpkEgEEhH9C10raC7uBWSV96gsIUaPkfg0ORG91WdIT1p945mj2gomsW15mE2A X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0701MB1696; X-MS-Office365-Filtering-Correlation-Id: bd90a0a8-23af-4eea-e797-08d32bb92acb X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1696; 20:Y06yqgQ3POqRHJdmHceLWoGK+IVNgPDj23LHFb6dtCArNZFuBBx6OdfPtsKnYPWeiWdNo5tpWybcyk5u9v/oY9YYjssIooar500BfKn2xU275rfWp8m5Q/w7/rD8adzk/tTQ++mKu0NpkPiH96M6w5EW8VPpxemz8N4CK/oHRtG7UvUf0DA827/HHsuxXDIHazeYItREZAuUpjk3L7nOahLTuC4vqzlcx1jjNfjpvmtYlplnQtrc3JV30wHgsob1MUBu8lsc521vx8CfIgE+iLrgdi3MewTUoDpZu1D7JqRMj3cMzyWbfZNbTHhDsK3to1TpOInRSX5TYl6W1jTKgwqxI9sa86lZfa2lv/zby9Fk3Ug/xfUU7tww9BI+h+yEcnd7eUTSriP8Y/lDZwMixiHh6QSF3NmOuaeBp0HIxovqAXE05rzCUxXMBaG5MB/KHj3GtjWpFZwpE5Vkvfj6os2JEKqD0yueW2SzT0sd3ypW9EXFmvanD6qoMty717P3gZPi3z5aZuw/ycZmWrkiEeYvA5bhHaraH4WO37ifV3Pu2884WnZOdDzmRnNKS2wAvtgK8VDyOKEnoo2tXgAdWILTqBoXj0bUt84sHI1slV0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:CY1PR0701MB1696; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0701MB1696; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1696; 4:NNgUJ9kjIE6NTl5feKkEGKYOekDzvmm+cwjVe4XwSkl0nhfFyBmIN+QxzdAE8eR6JQ/luobVIfcjh9o+Xs/VpjUy7E0Im9g2xx91gba+2OHj+qOBio389VzzTyFbzV4CKkQ3aFNOK/TOGol+5rqOb4ee1q0BNqa2FZoETcpjFA2zS3ArYN1LA4pKW/i8KukdzvJEWWOF7plLYkPUMOhxoKR/DxrrqLsjpif+cCbKBNjPnnjR6EKJ9gyAudvuXQSiSrk+3VR64lN+4iT75O3J0Ebgw0LdIqVSVi7O/xlRYcl2FS4C5i4EoDS5erEpdbFq+louVUp0gjp91DnOhFxa71DN/BhWYKZ1MTFHtjNgJDIR++i/B6S1jeHCwtzUNzxJ X-Forefront-PRVS: 084080FC15 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(87976001)(229853001)(2950100001)(47776003)(189998001)(66066001)(76176999)(42186005)(50226001)(19580405001)(77096005)(5001770100001)(50986999)(4001450100002)(5004730100002)(92566002)(36756003)(586003)(19580395003)(40100003)(5008740100001)(5009440100003)(6116002)(1096002)(3846002)(3470700001)(5003940100001)(2906002)(50466002)(4326007)(33646002)(2441003)(122386002)(48376002)(2201001)(7099028)(921003)(1121003)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0701MB1696; H:mypc.cavium.com.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0701MB1696; 23:a0RIomzynmE55rOdO6sjhIY1YXoTpn4fi25fIpW?= =?us-ascii?Q?Pqo15hrQJ9MLCTpP7cxBfS2ZOcVXn4srjP9lCv/e/YGSafipovSRLuQe/C9S?= =?us-ascii?Q?eEQ2GDeGuW74/uTcgypvJcSTO+blMzJlM30UBjNzLxj80jrCoqkB1rdQ65wi?= =?us-ascii?Q?ePcWfHRnmuwaIlJ5ri1RL0nT4cWlACzfGAcuOBPZtQoBSX0nRBU1ZEQGEHU9?= =?us-ascii?Q?6Pcs9tmtgCXOrhs674l2vu/0u7aNWa4iSK/dolHPWidL0LB+OXTdfGyWQ5Bn?= =?us-ascii?Q?llWqFgJJ5+M7Ltp2ktZL59LEHxoy/2L3llCWBsE/Rit4WwMzZdG39ttvG7wL?= =?us-ascii?Q?aiJfK3zBiDm88jxs+lV96TfH8+uGAMZSeiyylY2pwZ+UzX6e24pz/7hixABM?= =?us-ascii?Q?Bzexx8MmJ1xIftzBsWfGugoPOGZsIfgibpJ91Jygqj0f/gqSVePMtPhNWL69?= =?us-ascii?Q?/CdRbgaqlxIAq8E4x963x8yJDWYaFjR15ldyhH6E9teTQ58GOCqD5wr1I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rg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2016 10:10:55.4129 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB1696 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Adding numa dt binding support for arm64 based platforms. Reviewed-by: Robert Richter Signed-off-by: Ganapatrao Kulkarni --- arch/arm64/include/asm/numa.h | 2 ++ arch/arm64/kernel/smp.c | 2 ++ arch/arm64/mm/numa.c | 17 +++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h index 574267f..e9b4f29 100644 --- a/arch/arm64/include/asm/numa.h +++ b/arch/arm64/include/asm/numa.h @@ -31,12 +31,14 @@ void __init arm64_numa_init(void); int __init numa_add_memblk(int nodeid, u64 start, u64 end); void __init numa_set_distance(int from, int to, int distance); void __init numa_free_distance(void); +void __init early_map_cpu_to_node(unsigned int cpu, int nid); void numa_store_cpu_info(unsigned int cpu); #else /* CONFIG_NUMA */ static inline void numa_store_cpu_info(unsigned int cpu) { } static inline void arm64_numa_init(void) { } +static inline void early_map_cpu_to_node(unsigned int cpu, int nid) { } #endif /* CONFIG_NUMA */ diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index d6e7d6a..46c45c8 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -520,6 +520,8 @@ static void __init of_parse_and_init_cpus(void) pr_debug("cpu logical map 0x%llx\n", hwid); cpu_logical_map(cpu_count) = hwid; + + early_map_cpu_to_node(cpu_count, of_node_to_nid(dn)); next: cpu_count++; } diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index 60f19a2..7aad5d4 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -20,6 +20,7 @@ #include #include #include +#include struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; EXPORT_SYMBOL(node_data); @@ -122,6 +123,15 @@ void numa_store_cpu_info(unsigned int cpu) map_cpu_to_node(cpu, numa_off ? 0 : cpu_to_node_map[cpu]); } +void __init early_map_cpu_to_node(unsigned int cpu, int nid) +{ + /* fallback to node 0 */ + if (nid < 0 || nid >= MAX_NUMNODES) + nid = 0; + + cpu_to_node_map[cpu] = nid; +} + /** * numa_add_memblk - Set node id to memblk * @nid: NUMA node ID of the new memblk @@ -383,5 +393,12 @@ static int __init dummy_numa_init(void) */ void __init arm64_numa_init(void) { + if (!numa_off) { +#ifdef CONFIG_OF_NUMA + if (!numa_init(of_numa_init)) + return; +#endif + } + numa_init(dummy_numa_init); }