From patchwork Mon Apr 18 21:14:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 8875071 Return-Path: X-Original-To: patchwork-linux-acpi@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 1946BBF29F for ; Mon, 18 Apr 2016 21:15:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1448C201C0 for ; Mon, 18 Apr 2016 21:15:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D7762010F for ; Mon, 18 Apr 2016 21:15:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751830AbcDRVPA (ORCPT ); Mon, 18 Apr 2016 17:15:00 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:35681 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751805AbcDRVOm (ORCPT ); Mon, 18 Apr 2016 17:14:42 -0400 Received: by mail-pa0-f49.google.com with SMTP id fs9so63780037pac.2; Mon, 18 Apr 2016 14:14:42 -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=gkNu/xfyjcg8ARhAIxoIQ/7pMIavz+6E26WyUJjliCo=; b=b6jA6qACiPm4HN/OmeNfDeo9vVyVBiBCO3KZAKcTLM1VJRdxbJvsDBOw2IACDm1Lrw Wsh5yr9Lb2poPKDQcJaiX8o/aK+uW6vwHi59KMOypZqPh7n4RSI7BeOXnJoYOB12Hhcu GnRH2Kv/0Xk5d2oFhUxCxE12JjpLeamgcadT7GNeUqVSMxSLBbjOvmuhKDwINachJTBo TK1Yk/GLHWsbzoYRYBE3Vx3H0pcxefIfeVpTod744eePjZyvRQN6BMDBMWRALsn2HNSb 8EQR3P2+sZdxnDlg+8TalDgv1mj9Pu7grX2KrghY7jTUwB7xEk0iqWeRlMiBpJGDCScK 9xAg== 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=gkNu/xfyjcg8ARhAIxoIQ/7pMIavz+6E26WyUJjliCo=; b=cH65EnpNCEbq09KF29L6qI7aizzyYZC7bBFKTD/cQ1hSolD3kXNV9U7ca9OqAlmlk1 DzvQ1yWeGSq0Ywg3FwPpbkzMuQ7PB1cjom0cYMFZa/y+hzGBkbDxnZf0/dWhGGAqRxwn TZeHBoBiSVRHhullMtAPpNSQxo/OuoPkwWUk3zqlmywT/wPKpv6xQWpVlFwbtl91cQoK y505kRUtrBZORCZ4PFpKAlhzVrgwaMncsIBXfmECNVnUwP2UpXr7QrAXGaC/0BlWEfO7 ujPAFjd3ZHZKLfQUpvy4QvvrQeJt+JKvk7RQLTUdZbpErNFVDFeUVPOaR//5zHNycmSh TB9Q== X-Gm-Message-State: AOPr4FU3VFS1iqPv8gitZzxSme4vi/oZ7URbIZPk7daOnZpDfV1a/ZaNDt/GtSQ7jvn41g== X-Received: by 10.66.150.163 with SMTP id uj3mr52793106pab.23.1461014081711; Mon, 18 Apr 2016 14:14:41 -0700 (PDT) Received: from dl.caveonetworks.com ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id q26sm85811413pfi.57.2016.04.18.14.14.31 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Apr 2016 14:14:36 -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 u3ILEUR4030889; Mon, 18 Apr 2016 14:14:30 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u3ILEUDw030888; Mon, 18 Apr 2016 14:14:30 -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 v4 13/14] acpi, numa: Enable ACPI based NUMA on ARM64 Date: Mon, 18 Apr 2016 14:14:11 -0700 Message-Id: <1461014052-30788-14-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> 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 Add function needed for cpu to node mapping, and enable ACPI based NUMA for ARM64 in Kconfig Signed-off-by: Hanjun Guo Signed-off-by: Robert Richter Signed-off-by: David Daney --- drivers/acpi/Kconfig | 2 +- drivers/acpi/numa.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/acpi.h | 17 ++++++++++++++++- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 82b96ee..5ce9f66 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -291,7 +291,7 @@ config ACPI_THERMAL config ACPI_NUMA bool "NUMA support" depends on NUMA - depends on (X86 || IA64) + depends on (X86 || IA64 || ARM64) default y if IA64_GENERIC || IA64_SGI_SN2 config ACPI_CUSTOM_DSDT_FILE diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 6133eb1..0862ccd 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -170,6 +170,18 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header) } break; + case ACPI_SRAT_TYPE_GICC_AFFINITY: + { + struct acpi_srat_gicc_affinity *p = + (struct acpi_srat_gicc_affinity *)header; + pr_debug("SRAT Processor (acpi id[0x%04x]) in proximity domain %d %s\n", + p->acpi_processor_uid, + p->proximity_domain, + (p->flags & ACPI_SRAT_GICC_ENABLED) ? + "enabled" : "disabled"); + } + break; + default: pr_warn("Found unsupported SRAT entry (type = 0x%x)\n", header->type); @@ -347,6 +359,24 @@ acpi_parse_processor_affinity(struct acpi_subtable_header *header, return 0; } +static int __init +acpi_parse_gicc_affinity(struct acpi_subtable_header *header, + const unsigned long end) +{ + struct acpi_srat_gicc_affinity *processor_affinity; + + processor_affinity = (struct acpi_srat_gicc_affinity *)header; + if (!processor_affinity) + return -EINVAL; + + acpi_table_print_srat_entry(header); + + /* let architecture-dependent part to do it */ + acpi_numa_gicc_affinity_init(processor_affinity); + + return 0; +} + static int __initdata parsed_numa_memblks; static int __init @@ -391,6 +421,9 @@ int __init acpi_numa_init(void) { int cnt = 0; + if (acpi_disabled) + return -EINVAL; + /* * Should not limit number with cpu num that is from NR_CPUS or nr_cpus= * SRAT cpu entries could have different order with that in MADT. @@ -403,6 +436,8 @@ int __init acpi_numa_init(void) acpi_parse_x2apic_affinity, 0); acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, acpi_parse_processor_affinity, 0); + acpi_table_parse_srat(ACPI_SRAT_TYPE_GICC_AFFINITY, + acpi_parse_gicc_affinity, 0); cnt = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, acpi_parse_memory_affinity, NR_NODE_MEMBLKS); diff --git a/include/linux/acpi.h b/include/linux/acpi.h index ab6fd96..af34064 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -239,10 +239,25 @@ int acpi_table_parse_madt(enum acpi_madt_type id, int acpi_parse_mcfg (struct acpi_table_header *header); void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); -/* the following four functions are architecture-dependent */ +/* the following numa functions are architecture-dependent */ void acpi_numa_slit_init (struct acpi_table_slit *slit); + +#if defined(CONFIG_X86) || defined(CONFIG_IA64) void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); +#else +static inline void +acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) { } +#endif + void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa); + +#ifdef CONFIG_ARM64 +void acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa); +#else +static inline void +acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { } +#endif + int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); #ifndef PHYS_CPUID_INVALID