From patchwork Wed Apr 20 01:40:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 8884861 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4297B9F39A for ; Wed, 20 Apr 2016 01:43:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F8862026D for ; Wed, 20 Apr 2016 01:43:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D0ED2024F for ; Wed, 20 Apr 2016 01:43:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932437AbcDTBnK (ORCPT ); Tue, 19 Apr 2016 21:43:10 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:33737 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932629AbcDTBk6 (ORCPT ); Tue, 19 Apr 2016 21:40:58 -0400 Received: by mail-pa0-f48.google.com with SMTP id zm5so12206390pac.0; Tue, 19 Apr 2016 18:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SV12TSQjABfCK9OEzCkK9uR4zJfushFh5Vz6vvXANUc=; b=Wa5g8RNlQOPUsMOVJ9fL3XUk6oEI5cnXQRBidZMzv2D1Saku917Aam0SOM+etjb1mn W42NDa5hkCaaawHuXHQ5yZyGuZgAr0bsBD3k58oHluGId2ITRyzj7qbfpYwyyW94nXA9 4tHquzIHn6U0RaEffFLhcOP6ewwbQBlfrh2votKsgE0DG7GI1UVeq8C71jwMusrVSUB7 +gWkhZhuIf1hD/Acc4v5SkFS9rEV/oZisMuGsgBoC1yFFt8wcLjxY+lkgJ9SjcwWBWg8 ZUweEtgpS6OXXniVR0DNwqnLoaJzm9owLUTeEr2GZsmZcoXYlEjDbD6BFHjBa0khYbKB 3otw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SV12TSQjABfCK9OEzCkK9uR4zJfushFh5Vz6vvXANUc=; b=KhUi7pUS1GzU1zlRtE1lNTyNDLHZWgfnLioJGb7wW0cXR054bSBqTdtVcwSPktKZ0B TugFMMwXf0ERo20zuXRj/BkdZacWq1eqQvJyez1NG5EtA6C0rtRm3YwfldZtMuDLa5xc yZkszi2wbMJUdrCxg8Hl6UNph6xwWw4t19To0r5WsWvbExptHzoihby1e9qTVMrgKAWv 8C/kRPWu7sK05p2i/s8vpTEUKNMYvtV5ZBCBoQrsi27NL6wPbPtLJAwLC1IVByLf1xci 1hZgD/JX33l2LIUXZ4ucbQD6j/iOq0vs7TvR6HbCOtpmAFbAec/zN3eXvWKvyqxgj/rB KXpQ== X-Gm-Message-State: AOPr4FWcdWfh7ncyTujWvDfgv3dRZf4p9AmD01SViYq/PSFkJDnmjOuoAPOryvx7Hy9cwA== X-Received: by 10.66.149.194 with SMTP id uc2mr8719632pab.116.1461116457693; Tue, 19 Apr 2016 18:40:57 -0700 (PDT) Received: from dl.caveonetworks.com ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id g80sm24341525pfd.25.2016.04.19.18.40.49 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 19 Apr 2016 18:40:52 -0700 (PDT) Received: from dl.caveonetworks.com (localhost.localdomain [127.0.0.1]) by dl.caveonetworks.com (8.14.5/8.14.5) with ESMTP id u3K1emHF023079; Tue, 19 Apr 2016 18:40:48 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u3K1emr1023078; Tue, 19 Apr 2016 18:40:48 -0700 From: David Daney To: Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Catalin Marinas , Tony Luck , Fenghua Yu , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, "Rafael J. Wysocki" , Len Brown , Rob Herring , Frank Rowand , Grant Likely , Robert Moore , Lv Zheng , Hanjun Guo , Marc Zyngier , linux-ia64@vger.kernel.org, linux-acpi@vger.kernel.org, devel@acpica.org Cc: linux-kernel@vger.kernel.org, Robert Richter , David Daney Subject: [PATCH v5 10/14] acpi, numa: Move acpi_numa_memory_affinity_init() to drivers/acpi/numa.c Date: Tue, 19 Apr 2016 18:40:35 -0700 Message-Id: <1461116439-22991-11-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1461116439-22991-1-git-send-email-ddaney.cavm@gmail.com> References: <1461116439-22991-1-git-send-email-ddaney.cavm@gmail.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Hanjun Guo acpi_numa_memory_affinity_init() will be reused by arm64. Move it to drivers/acpi/numa.c to facilitate reuse. No code change. Signed-off-by: Hanjun Guo Signed-off-by: Robert Richter Signed-off-by: David Daney --- arch/x86/mm/srat.c | 57 -------------------------------------------------- drivers/acpi/numa.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 57 deletions(-) diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index 30460f5..b1ecff4 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c @@ -15,8 +15,6 @@ #include #include #include -#include -#include #include #include #include @@ -104,61 +102,6 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) pxm, apic_id, node); } -/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ -int __init -acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) -{ - u64 start, end; - u32 hotpluggable; - int node, pxm; - - if (srat_disabled()) - goto out_err; - if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) - goto out_err_bad_srat; - if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0) - goto out_err; - hotpluggable = ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE; - if (hotpluggable && !IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) - goto out_err; - - start = ma->base_address; - end = start + ma->length; - pxm = ma->proximity_domain; - if (acpi_srat_revision <= 1) - pxm &= 0xff; - - node = acpi_map_pxm_to_node(pxm); - if (node < 0) { - printk(KERN_ERR "SRAT: Too many proximity domains.\n"); - goto out_err_bad_srat; - } - - if (numa_add_memblk(node, start, end) < 0) - goto out_err_bad_srat; - - node_set(node, numa_nodes_parsed); - - pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s%s\n", - node, pxm, - (unsigned long long) start, (unsigned long long) end - 1, - hotpluggable ? " hotplug" : "", - ma->flags & ACPI_SRAT_MEM_NON_VOLATILE ? " non-volatile" : ""); - - /* Mark hotplug range in memblock. */ - if (hotpluggable && memblock_mark_hotplug(start, ma->length)) - pr_warn("SRAT: Failed to mark hotplug range [mem %#010Lx-%#010Lx] in memblock\n", - (unsigned long long)start, (unsigned long long)end - 1); - - max_possible_pfn = max(max_possible_pfn, PFN_UP(end - 1)); - - return 0; -out_err_bad_srat: - bad_srat(); -out_err: - return -EINVAL; -} - int __init x86_acpi_numa_init(void) { int ret; diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 7174a38..8ba90ad 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include #include @@ -236,6 +238,64 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit) } } } + +/* + * Default callback for parsing of the Proximity Domain <-> Memory + * Area mappings + */ +int __init +acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) +{ + u64 start, end; + u32 hotpluggable; + int node, pxm; + + if (srat_disabled()) + goto out_err; + if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) + goto out_err_bad_srat; + if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0) + goto out_err; + hotpluggable = ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE; + if (hotpluggable && !IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) + goto out_err; + + start = ma->base_address; + end = start + ma->length; + pxm = ma->proximity_domain; + if (acpi_srat_revision <= 1) + pxm &= 0xff; + + node = acpi_map_pxm_to_node(pxm); + if (node < 0) { + printk(KERN_ERR "SRAT: Too many proximity domains.\n"); + goto out_err_bad_srat; + } + + if (numa_add_memblk(node, start, end) < 0) + goto out_err_bad_srat; + + node_set(node, numa_nodes_parsed); + + pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s%s\n", + node, pxm, + (unsigned long long) start, (unsigned long long) end - 1, + hotpluggable ? " hotplug" : "", + ma->flags & ACPI_SRAT_MEM_NON_VOLATILE ? " non-volatile" : ""); + + /* Mark hotplug range in memblock. */ + if (hotpluggable && memblock_mark_hotplug(start, ma->length)) + pr_warn("SRAT: Failed to mark hotplug range [mem %#010Lx-%#010Lx] in memblock\n", + (unsigned long long)start, (unsigned long long)end - 1); + + max_possible_pfn = max(max_possible_pfn, PFN_UP(end - 1)); + + return 0; +out_err_bad_srat: + bad_srat(); +out_err: + return -EINVAL; +} #endif /* defined(CONFIG_X86) || defined (CONFIG_ARM64) */ static int __init acpi_parse_slit(struct acpi_table_header *table)