From patchwork Mon Apr 18 21:14:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 8875411 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2BB21BF29F for ; Mon, 18 Apr 2016 21:18:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2008F20121 for ; Mon, 18 Apr 2016 21:18:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1AADC20251 for ; Mon, 18 Apr 2016 21:18:28 +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 1asGXU-0005qn-Mg; Mon, 18 Apr 2016 21:17:00 +0000 Received: from mail-pf0-x230.google.com ([2607:f8b0:400e:c00::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1asGVX-0002EB-TT for linux-arm-kernel@lists.infradead.org; Mon, 18 Apr 2016 21:15:01 +0000 Received: by mail-pf0-x230.google.com with SMTP id e128so84323941pfe.3 for ; Mon, 18 Apr 2016 14:14:39 -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=Z5d3Tv0AQCW4qR52hK3WRKMs/NEV1SXu7WSAX0JHp7c=; b=CMfGw7e4OkPlQmIIE4pmwnRKiyEU+RoK9X5S2lh1DtKBBky9TTx1eTM+UVd15i2Q7t eLfY52TOmk7BbARhGdSllpCO4nR/TIYowd9H34fzhM1jAQ2/pXlaWr7FQsTJeaaOpclv ffPfma7X7KMa8oJKQ8vD2CiZ5+iW6UfRZAj10YEgDzecwIiqy6Oqw0K4+ZG6XWG0kpPX 7yoq69OBbEU/E9r/BC7muKnPJR+7hxNStTgy72CVlSY2ZnBUMYBfnK34So/zwIAjYzm9 9fq3kHp1ZugXPVGNbTmBFhZA4DHfeJFzrWuYxL/OtD7THyrxVSzysv12I9kAzO0lpJ+J vuQg== 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=Z5d3Tv0AQCW4qR52hK3WRKMs/NEV1SXu7WSAX0JHp7c=; b=WFheqgNhEFSYRif7JnPhjpisScNfVWAAV538LPMweKxs6IYAJuEosjoQSpKfLny9py q/zEblSVwDAjJn4Ly5eLXNDnkuRVNEhN1SiIN6jjccs1LhxSNCtmNIHcnkp2+p8tmcaN t7jfVRPKmM9D2Y9ni5pMIAF7NMNsInjQDhNkcIC/IT3T6ygwp4GHhmsSstE1fyPsO8sh d94j8hKkH++vDf8G5HfBEER3EGO1bCSnLTuCyg4Febei6rZ0HjOxkLkYgq+6xN2Ar0GL Zl9L8G+485mbvm1oHe/vfJ1PKMDA6l636pUc7EGN0qUCj2JtuYKY1Ok3dDNt4R0f9g3R UpuQ== X-Gm-Message-State: AOPr4FWtLMF5ytHGwP9HktGCPz2zBKDrET7pCdXo+V1aAfKrzu9ll7ibB7M+Y4Z77SMqUg== X-Received: by 10.98.87.200 with SMTP id i69mr28304781pfj.26.1461014079153; Mon, 18 Apr 2016 14:14:39 -0700 (PDT) Received: from dl.caveonetworks.com ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id to9sm86043714pab.27.2016.04.18.14.14.29 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Apr 2016 14:14:34 -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 u3ILETVt030877; Mon, 18 Apr 2016 14:14:29 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u3ILEShd030876; Mon, 18 Apr 2016 14:14:28 -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 Subject: [PATCH v4 10/14] acpi, numa: Move acpi_numa_memory_affinity_init() to drivers/acpi/numa.c Date: Mon, 18 Apr 2016 14:14:08 -0700 Message-Id: <1461014052-30788-11-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1461014052-30788-1-git-send-email-ddaney.cavm@gmail.com> References: <1461014052-30788-1-git-send-email-ddaney.cavm@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160418_141500_156433_BC6ACD01 X-CRM114-Status: GOOD ( 17.75 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Richter , linux-kernel@vger.kernel.org, David Daney 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=-5.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, 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 | 56 ------------------------------------------------- drivers/acpi/numa.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 56 deletions(-) diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index 30460f5..cbd792f 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -104,61 +103,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 9b35ba9..c4ea877 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include #include @@ -225,6 +227,64 @@ void __init __weak acpi_numa_slit_init(struct acpi_table_slit *slit) } } +/* + * Default callback for parsing of the Proximity Domain <-> Memory + * Area mappings + */ +int __init __weak +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; +} + static int __init acpi_parse_slit(struct acpi_table_header *table) { struct acpi_table_slit *slit = (struct acpi_table_slit *)table;