From patchwork Wed Apr 20 01:40:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 8885021 Return-Path: X-Original-To: patchwork-linux-arm@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 3C0549F36E for ; Wed, 20 Apr 2016 01:45:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4BCD02026D for ; Wed, 20 Apr 2016 01:45:16 +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 4C7C42024F for ; Wed, 20 Apr 2016 01:45:15 +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 1ashBO-0004Rt-Rp; Wed, 20 Apr 2016 01:43:58 +0000 Received: from mail-pa0-x230.google.com ([2607:f8b0:400e:c03::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ash8t-0000WA-GH for linux-arm-kernel@lists.infradead.org; Wed, 20 Apr 2016 01:41:24 +0000 Received: by mail-pa0-x230.google.com with SMTP id er2so12182467pad.3 for ; Tue, 19 Apr 2016 18:41:03 -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=4lAA6Yn1t5jSyw/HJf9dQxPxZiMUzHcmNGpHxswyE08=; b=RUC3ePqTgNDQk429heeEosxmPBBNag1RDy8YyE3q78eislbx3vMrCPRYxTONzYp2go uKp7GmUtMG28akNkvBWnmIe3NTH9nQ8DUoxDHFdUBFMO3m+vBUXPmc9JZJM0+vK+03Ym +RKumnas1/M9QOBV+jiFNSunZ8LaOhLAFzbtxmlw3P/0SkAgHTnig6cVGg7UnBtJvZx4 gDHFb8hOUw9BIXmxNTvq51m/nkd/xAdaLSL4Q3bQ++JhLk6L1onHznM/XBxm0GMlKS/i ecfILcTEh//G8YqMBFRg5s/v87FYrh2DhBK9js1BwFLmlAQ2FP+gj3FDfl1EgIh7wI0v FqIA== 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=4lAA6Yn1t5jSyw/HJf9dQxPxZiMUzHcmNGpHxswyE08=; b=RloO2NJds4igXbO1BAbWevF3NcD27BuD8M5LBRXf1JJTRYkpd6V7w/tF2TK6rDRMik kOLXhzRxrh12OjvHL9SWS3CO0SKKU9V5l9KBcj9WMgmujVLy0D0ckR+nCJC8ydbcAt3q 0f2McR7wSjEGFXQ76qe67wsj9HmAgHggEatjqJ5UJPJGJ6vaf63gpqiAmi4P2TxnJVcT +0EjOG4s+g6amqMz9ogOzQriEQtcJT4Av+ZKFh1wyT3OXSoHRun80+1OXrmRs89xazVj 03qdZAF8HJn1Ht4v7R+crCkjyoYkKJx1JTiLADPNROhK+dM+tSQtIxfmJamL/SHCFdt0 lxIg== X-Gm-Message-State: AOPr4FWv253aJ9uJZz0bJ+7Dn41sr6++dRiw2LCIfSwajqg/22EjVyrzpi3VZmg4EK+DHQ== X-Received: by 10.66.65.133 with SMTP id x5mr8655404pas.108.1461116462831; Tue, 19 Apr 2016 18:41:02 -0700 (PDT) Received: from dl.caveonetworks.com ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id t1sm68367193paa.17.2016.04.19.18.40.50 (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 u3K1enjs023092; Tue, 19 Apr 2016 18:40:49 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u3K1enR0023091; Tue, 19 Apr 2016 18:40:49 -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 v5 13/14] acpi, numa: Enable ACPI based NUMA on ARM64 Date: Tue, 19 Apr 2016 18:40:38 -0700 Message-Id: <1461116439-22991-14-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160419_184123_742973_C9B04154 X-CRM114-Status: GOOD ( 18.79 ) 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 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 d244018..02c6dd8 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. @@ -416,6 +449,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