From patchwork Sat Jan 23 09:39:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 60260 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp358410lbb; Sat, 23 Jan 2016 01:45:00 -0800 (PST) X-Received: by 10.98.87.196 with SMTP id i65mr10732428pfj.72.1453542300283; Sat, 23 Jan 2016 01:45:00 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hw5si16208858pac.152.2016.01.23.01.44.58; Sat, 23 Jan 2016 01:45:00 -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 S1756138AbcAWJoy (ORCPT + 30 others); Sat, 23 Jan 2016 04:44:54 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:49967 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751866AbcAWJop (ORCPT ); Sat, 23 Jan 2016 04:44:45 -0500 Received: from 172.24.1.51 (EHLO szxeml426-hub.china.huawei.com) ([172.24.1.51]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BVC83055; Sat, 23 Jan 2016 17:40:36 +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:26 +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 10/12] acpi, numa: move bad_srat() and srat_disabled() to common place Date: Sat, 23 Jan 2016 17:39:25 +0800 Message-ID: <1453541967-3744-11-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.56A34A95.000E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 35c46f1977b95dd4e1bb26ead71b31d1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hanjun Guo bad_srat() and srat_disabled() are shared by arm64 and x86, move it to common place to reduce duplication. Signed-off-by: Hanjun Guo --- arch/arm64/kernel/acpi_numa.c | 12 ------------ arch/x86/include/asm/acpi.h | 1 - arch/x86/mm/numa.c | 2 +- arch/x86/mm/srat.c | 13 ------------- drivers/acpi/numa.c | 1 + include/acpi/acpi_numa.h | 12 ++++++++++++ 6 files changed, 14 insertions(+), 27 deletions(-) -- 1.9.1 diff --git a/arch/arm64/kernel/acpi_numa.c b/arch/arm64/kernel/acpi_numa.c index 3bcf058..fb1556f 100644 --- a/arch/arm64/kernel/acpi_numa.c +++ b/arch/arm64/kernel/acpi_numa.c @@ -28,7 +28,6 @@ #include #include -int acpi_numa __initdata; static int cpus_in_srat; struct __node_cpu_hwid { @@ -39,17 +38,6 @@ struct __node_cpu_hwid { static struct __node_cpu_hwid early_node_cpu_hwid[NR_CPUS] = { [0 ... NR_CPUS - 1] = {NUMA_NO_NODE, PHYS_CPUID_INVALID} }; -static __init void bad_srat(void) -{ - pr_err("SRAT not used.\n"); - acpi_numa = -1; -} - -static __init inline int srat_disabled(void) -{ - return acpi_numa < 0; -} - void __init acpi_numa_set_node_info(unsigned int cpu, u64 hwid) { int nid = 0, i; diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index 94c18eb..65f1e95 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h @@ -145,7 +145,6 @@ static inline void disable_acpi(void) { } #define ARCH_HAS_POWER_INIT 1 #ifdef CONFIG_ACPI_NUMA -extern int acpi_numa; extern int x86_acpi_numa_init(void); #endif /* CONFIG_ACPI_NUMA */ diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index c3b3f65..fd59371 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -1,4 +1,5 @@ /* Common code for 32 and 64-bit NUMA */ +#include #include #include #include @@ -15,7 +16,6 @@ #include #include #include -#include #include #include "numa_internal.h" diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index 304cdf2..7078b3f 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c @@ -24,19 +24,6 @@ #include #include -int acpi_numa __initdata; - -static __init void bad_srat(void) -{ - printk(KERN_ERR "SRAT: SRAT not used.\n"); - acpi_numa = -1; -} - -static __init inline int srat_disabled(void) -{ - return acpi_numa < 0; -} - /* 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 b33915e..05e3795 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -40,6 +40,7 @@ static int node_to_pxm_map[MAX_NUMNODES] = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; unsigned char acpi_srat_revision __initdata; +int acpi_numa __initdata; int pxm_to_node(int pxm) { diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h index 94a37cd..28f06a6 100644 --- a/include/acpi/acpi_numa.h +++ b/include/acpi/acpi_numa.h @@ -15,6 +15,18 @@ extern int pxm_to_node(int); extern int node_to_pxm(int); extern int acpi_map_pxm_to_node(int); extern unsigned char acpi_srat_revision; +extern int acpi_numa __initdata; + +static inline void bad_srat(void) +{ + pr_err("SRAT: SRAT not used.\n"); + acpi_numa = -1; +} + +static inline int srat_disabled(void) +{ + return acpi_numa < 0; +} #endif /* CONFIG_ACPI_NUMA */ #endif /* __ACP_NUMA_H */