From patchwork Sat Jan 23 09:39:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 60257 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp358314lbb; Sat, 23 Jan 2016 01:44:42 -0800 (PST) X-Received: by 10.66.90.133 with SMTP id bw5mr10747560pab.22.1453542282115; Sat, 23 Jan 2016 01:44:42 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id da6si16177271pad.156.2016.01.23.01.44.41; Sat, 23 Jan 2016 01:44:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755958AbcAWJoc (ORCPT + 30 others); Sat, 23 Jan 2016 04:44:32 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:8093 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751603AbcAWJoY (ORCPT ); Sat, 23 Jan 2016 04:44:24 -0500 Received: from 172.24.1.51 (EHLO szxeml426-hub.china.huawei.com) ([172.24.1.51]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DAK82842; Sat, 23 Jan 2016 17:40:32 +0800 (CST) Received: from localhost (10.177.17.188) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.235.1; Sat, 23 Jan 2016 17:40:23 +0800 From: Hanjun Guo To: "Rafael J. Wysocki" , Will Deacon , Catalin Marinas CC: , , , Ganapatrao Kulkarni , Lorenzo Pieralisi , Shannon Zhao , "Steve Capper" , Mark Rutland , Robert Richter , Hanjun Guo Subject: [PATCH v3 07/12] acpi, numa: move acpi_numa_slit_init() to common place Date: Sat, 23 Jan 2016 17:39:22 +0800 Message-ID: <1453541967-3744-8-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.10.msysgit.1 In-Reply-To: <1453541967-3744-1-git-send-email-guohanjun@huawei.com> References: <1453541967-3744-1-git-send-email-guohanjun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.17.188] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.56A34A92.0069, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: ba630d1164f58e3c465ac257310fe148 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hanjun Guo acpi_numa_slit_init() is used by both x86 and arm64, and the code is the same, move it to common place to simplify the code, and mark it as __weak because the different implimentation for ia64. Signed-off-by: Hanjun Guo --- arch/arm64/kernel/acpi_numa.c | 31 ------------------------------- arch/x86/mm/srat.c | 27 --------------------------- drivers/acpi/numa.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 58 deletions(-) -- 1.9.1 diff --git a/arch/arm64/kernel/acpi_numa.c b/arch/arm64/kernel/acpi_numa.c index f7f7533..15fb935 100644 --- a/arch/arm64/kernel/acpi_numa.c +++ b/arch/arm64/kernel/acpi_numa.c @@ -64,37 +64,6 @@ void __init acpi_numa_set_node_info(unsigned int cpu, u64 hwid) cpu_to_node_map[cpu] = nid; } -/* - * Callback for SLIT parsing. - * It will get the distance information presented by SLIT - * and init the distance matrix of numa nodes - */ -void __init acpi_numa_slit_init(struct acpi_table_slit *slit) -{ - int i, j; - - for (i = 0; i < slit->locality_count; i++) { - const int from_node = pxm_to_node(i); - - if (from_node == NUMA_NO_NODE) - continue; - - for (j = 0; j < slit->locality_count; j++) { - const int to_node = pxm_to_node(j); - - if (to_node == NUMA_NO_NODE) - continue; - - pr_debug("SLIT: Distance[%d][%d] = %d\n", - from_node, to_node, - slit->entry[ - slit->locality_count * i + j]); - numa_set_distance(from_node, to_node, - slit->entry[slit->locality_count * i + j]); - } - } -} - static int __init get_mpidr_in_madt(int acpi_id, u64 *mpidr) { unsigned long madt_end, entry; diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index 9fa1746..92a640a 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c @@ -42,33 +42,6 @@ static __init inline int srat_disabled(void) return acpi_numa < 0; } -/* - * Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for - * I/O localities since SRAT does not list them. I/O localities are - * not supported at this point. - */ -void __init acpi_numa_slit_init(struct acpi_table_slit *slit) -{ - int i, j; - - for (i = 0; i < slit->locality_count; i++) { - const int from_node = pxm_to_node(i); - - if (from_node == NUMA_NO_NODE) - continue; - - for (j = 0; j < slit->locality_count; j++) { - const int to_node = pxm_to_node(j); - - if (to_node == NUMA_NO_NODE) - continue; - - numa_set_distance(from_node, to_node, - slit->entry[slit->locality_count * i + j]); - } - } -} - /* Callback for Proximity Domain -> x2APIC mapping */ void __init acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 4728525..b33915e 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -209,6 +209,36 @@ static int __init slit_valid(struct acpi_table_slit *slit) return 1; } +/* + * Callback for SLIT parsing. It will get the distance information + * presented by SLIT and init the distance matrix of numa nodes + */ +void __init __weak acpi_numa_slit_init(struct acpi_table_slit *slit) +{ + int i, j; + + for (i = 0; i < slit->locality_count; i++) { + const int from_node = pxm_to_node(i); + + if (from_node == NUMA_NO_NODE) + continue; + + for (j = 0; j < slit->locality_count; j++) { + const int to_node = pxm_to_node(j); + + if (to_node == NUMA_NO_NODE) + continue; + + numa_set_distance(from_node, to_node, + slit->entry[slit->locality_count * i + j]); + + pr_debug("SLIT: Distance[%d][%d] = %d\n", + from_node, to_node, + slit->entry[slit->locality_count * i + j]); + } + } +} + static int __init acpi_parse_slit(struct acpi_table_header *table) { struct acpi_table_slit *slit = (struct acpi_table_slit *)table;