From patchwork Tue May 24 22:35:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 68534 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp891613qge; Tue, 24 May 2016 15:37:11 -0700 (PDT) X-Received: by 10.66.167.40 with SMTP id zl8mr943579pab.8.1464129431272; Tue, 24 May 2016 15:37:11 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c74si1696240pfk.221.2016.05.24.15.37.10; Tue, 24 May 2016 15:37:11 -0700 (PDT) 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; dkim=pass header.i=@gmail.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; dmarc=pass (p=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754190AbcEXWgn (ORCPT + 30 others); Tue, 24 May 2016 18:36:43 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:34645 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753624AbcEXWgS (ORCPT ); Tue, 24 May 2016 18:36:18 -0400 Received: by mail-pa0-f68.google.com with SMTP id yl2so3274138pac.1; Tue, 24 May 2016 15:36:17 -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=ipmt/J5AMyZqIvqOrhS5fO+IGjG6OKwJnBXspbU0bmM=; b=L0PhSZeZ4XAt42JpXM5rO8uZmUXTGrFFXR8uhxNjJ1YQQ+1rLIfjqCf4Q49l/ZKVji Np3m4RLtSfVzjNTyCvppP19muDxWzluZEIKk57PLJoTW2Ax5+UU4g+0VAHTCZRYQZ/5n +evN72HNZ/FyeFAprT6w4gLCNpd4rSBP0UXRdipAlMUsuD4DY0WI3WV9rGsufmDvLwp5 tCdSjRcQ6bYYHVz8p5k2ebfehAOyR7LmAv9Bgajn6bXwPAdQ3g5mhVC3NT8L3zl9++xX MvXHcZ+L9Iw79WEJ/MW3vmSae3tzhVufasH13oWwBfy6lgGqM0WL9fhp7bnxU7ajH+/q NQ5A== 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=ipmt/J5AMyZqIvqOrhS5fO+IGjG6OKwJnBXspbU0bmM=; b=geS2t9ntxEOSdpAA4g8a9dXL7w2/4sRM6TD3oSfVIpumlSwUpBCap6sxNm+MdJqrxe maAvYi5iDpWdh2DrUX/db+wXV6dKZ7XXw7EJndZCVfmP6Jia1zDkOwuI98vvye2Y57yY l0hV0MBfsmH+sQW0KtmFBzQAOT5460c+qXebd3yn0t1PcRs7EF0DDH7LdM3qcoSkLwOA H6Ftx48VtRme4obdAslhlijE3d2/ZUt5UmBxnBI/T9h/+EFJT/VgYGwzjWo6Qo6/9EXW NY/8OdrKvh/L8FyCiDtGqu02Do1XQaz4FW8AVMfR68p2cwFatxXAXLsTelFxome2HWFr 1X8Q== X-Gm-Message-State: ALyK8tK7wHi3FvZN7txiyc+tzUjNcRC2ImS/gUXXCl5c7+e+bfVVJJgipqJYblZGHI1Aug== X-Received: by 10.66.126.147 with SMTP id my19mr894053pab.92.1464129376843; Tue, 24 May 2016 15:36:16 -0700 (PDT) Received: from dl.caveonetworks.com ([50.233.148.158]) by smtp.gmail.com with ESMTPSA id qm10sm7564995pac.33.2016.05.24.15.36.05 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 24 May 2016 15:36:09 -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 u4OMa5wE019096; Tue, 24 May 2016 15:36:05 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u4OMa48J019095; Tue, 24 May 2016 15:36:04 -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 v7 15/15] acpi, numa: Enable ACPI based NUMA on ARM64 Date: Tue, 24 May 2016 15:35:45 -0700 Message-Id: <1464129345-18985-16-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1464129345-18985-1-git-send-email-ddaney.cavm@gmail.com> References: <1464129345-18985-1-git-send-email-ddaney.cavm@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 [david.daney@cavium.com added ACPI_NUMA default to y for ARM64] Signed-off-by: David Daney Acked-by: Catalin Marinas --- drivers/acpi/Kconfig | 4 ++-- drivers/acpi/numa.c | 37 ++++++++++++++++++++++++++++++++++++- include/linux/acpi.h | 17 ++++++++++++++++- 3 files changed, 54 insertions(+), 4 deletions(-) -- 1.7.11.7 diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index b7e2e77..dd76b36 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -291,8 +291,8 @@ config ACPI_THERMAL config ACPI_NUMA bool "NUMA support" depends on NUMA - depends on (X86 || IA64) - default y if IA64_GENERIC || IA64_SGI_SN2 + depends on (X86 || IA64 || ARM64) + default y if IA64_GENERIC || IA64_SGI_SN2 || ARM64 config ACPI_CUSTOM_DSDT_FILE string "Custom DSDT Table file to include" diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index fad6d28..9b7ce40 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); @@ -360,6 +372,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 @@ -404,6 +434,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. @@ -412,13 +445,15 @@ int __init acpi_numa_init(void) /* SRAT: Static Resource Affinity Table */ if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { - struct acpi_subtable_proc srat_proc[2]; + struct acpi_subtable_proc srat_proc[3]; memset(srat_proc, 0, sizeof(srat_proc)); srat_proc[0].id = ACPI_SRAT_TYPE_CPU_AFFINITY; srat_proc[0].handler = acpi_parse_processor_affinity; srat_proc[1].id = ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY; srat_proc[1].handler = acpi_parse_x2apic_affinity; + srat_proc[1].id = ACPI_SRAT_TYPE_GICC_AFFINITY; + srat_proc[1].handler = acpi_parse_gicc_affinity; acpi_table_parse_entries_array(ACPI_SIG_SRAT, sizeof(struct acpi_table_srat), diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 8010b26..9515db6 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -232,10 +232,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