From patchwork Mon Apr 15 17:49:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 162244 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3218200jan; Mon, 15 Apr 2019 10:49:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0WtV19YlRy+d/CG1j9aFxRsPLinui+9VNGdmPkBXJq8Gn7IAtHKIsI+gc+WgyMaC8Utp2 X-Received: by 2002:a62:3849:: with SMTP id f70mr77917122pfa.46.1555350590988; Mon, 15 Apr 2019 10:49:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555350590; cv=none; d=google.com; s=arc-20160816; b=WOaj3SWUMBd55xwU04/4nxEkG3Wg286FARBurUpZFBmlyWz4jZVpCk9LqXsqSL1utO G9WbCt7mHAyOyMMeOD5l5e3JGjGBnNWB/zuUXvd5uyXnu8P5WDesd7yxoZnBgPdBM4MP 3S/VwfSznFsDpKddxWyD4swqm/cd4Vhwe7ohm1M3ax96cG6e4XmGatOFF4TNRfmr4JmK 5jfxSaCKBJuAX7y1th35jLuKAbLaH2KA+VJe5fVrruVDyhRD6x0CGZa+4RmGYaEj1JoD 4/MYUBDaLWr+izjcGAdYcCmkXqTvfU7t1ZHbPhrZTvGIv3wJk0rAkmxo7eeFFsc9/Raq NV4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ow+Ul3i0SMFqzj5C3FIRZsbVoU8F8je6HR5OyLi3CXo=; b=syAESt18Gn/ZxrkjLBsz8FItA20+RdCRzd9JHpxmnIj2vVvI5Bv0Dv5P315aK5ZImN cELf4igK6SPXph1JLO2OXpaGTzDbLPiMfJhyNsHfhIB4iV2K5joCFCv+TSJVZt17pdtf OdtJ3GLxfDrQ31GTu15KiD31QPmwYTbQVyjwF2jOEnTiVh/7Jp/UGGrY9NCS0nwk0XOF RsFG4gWeD2/89zbHzV6xiHXIGQtlhsKpFS3A3bINa/kzGipnQh+ziV86pXRpnX1sAccl KjRMl2x7vQkP2VnhN6o6Jhxb4db0YEZ1Zu8DtUX93XlWf156ViWxAzlmHgfIQgttTcPv GKGA== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be8si45920789plb.72.2019.04.15.10.49.50; Mon, 15 Apr 2019 10:49:50 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728037AbfDORtt (ORCPT + 30 others); Mon, 15 Apr 2019 13:49:49 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:49624 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727918AbfDORtr (ORCPT ); Mon, 15 Apr 2019 13:49:47 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D55DD2A446898EE82B5D; Tue, 16 Apr 2019 01:49:41 +0800 (CST) Received: from FRA1000014316.huawei.com (100.126.230.97) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Tue, 16 Apr 2019 01:49:34 +0800 From: Jonathan Cameron To: , , , CC: =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Keith Busch , "Rafael J . Wysocki" , , Andrew Morton , "Jonathan Cameron" Subject: [PATCH 1/4 V3] ACPI: Support Generic Initiator only domains Date: Tue, 16 Apr 2019 01:49:04 +0800 Message-ID: <20190415174907.102307-2-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190415174907.102307-1-Jonathan.Cameron@huawei.com> References: <20190415174907.102307-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [100.126.230.97] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Generic Initiators are a new ACPI concept that allows for the description of proximity domains that contain a device which performs memory access (such as a network card) but neither host CPU nor Memory. This patch has the parsing code and provides the infrastructure for an architecture to associate these new domains with their nearest memory processing node. Signed-off-by: Jonathan Cameron --- drivers/acpi/numa.c | 62 +++++++++++++++++++++++++++++++++- drivers/base/node.c | 3 ++ include/asm-generic/topology.h | 3 ++ include/linux/nodemask.h | 1 + include/linux/topology.h | 7 ++++ 5 files changed, 75 insertions(+), 1 deletion(-) -- 2.19.1 diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 867f6e3f2b4f..b08ceea5e546 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -184,6 +184,38 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header) } break; + case ACPI_SRAT_TYPE_GENERIC_AFFINITY: + { + struct acpi_srat_generic_affinity *p = + (struct acpi_srat_generic_affinity *)header; + char name[9] = {}; + + if (p->device_handle_type == 0) { + /* + * For pci devices this may be the only place they + * are assigned a proximity domain + */ + pr_debug("SRAT Generic Initiator(Seg:%u BDF:%u) in proximity domain %d %s\n", + *(u16 *)(&p->device_handle[0]), + *(u16 *)(&p->device_handle[2]), + p->proximity_domain, + (p->flags & ACPI_SRAT_GENERIC_AFFINITY_ENABLED) ? + "enabled" : "disabled"); + } else { + /* + * In this case we can rely on the device having a + * proximity domain reference + */ + memcpy(name, p->device_handle, 8); + pr_info("SRAT Generic Initiator(HID=%.8s UID=%.4s) in proximity domain %d %s\n", + (char *)(&p->device_handle[0]), + (char *)(&p->device_handle[8]), + p->proximity_domain, + (p->flags & ACPI_SRAT_GENERIC_AFFINITY_ENABLED) ? + "enabled" : "disabled"); + } + } + break; default: pr_warn("Found unsupported SRAT entry (type = 0x%x)\n", header->type); @@ -392,6 +424,32 @@ acpi_parse_gicc_affinity(struct acpi_subtable_header *header, return 0; } +static int __init +acpi_parse_gi_affinity(struct acpi_subtable_header *header, + const unsigned long end) +{ + struct acpi_srat_generic_affinity *gi_affinity; + int node; + + gi_affinity = (struct acpi_srat_generic_affinity *)header; + if (!gi_affinity) + return -EINVAL; + acpi_table_print_srat_entry(header); + + if (!(gi_affinity->flags & ACPI_SRAT_GENERIC_AFFINITY_ENABLED)) + return -EINVAL; + + node = acpi_map_pxm_to_node(gi_affinity->proximity_domain); + if (node == NUMA_NO_NODE || node >= MAX_NUMNODES) { + pr_err("SRAT: Too many proximity domains.\n"); + return -EINVAL; + } + node_set(node, numa_nodes_parsed); + node_set_state(node, N_GENERIC_INITIATOR); + + return 0; +} + static int __initdata parsed_numa_memblks; static int __init @@ -447,7 +505,7 @@ int __init acpi_numa_init(void) /* SRAT: System Resource Affinity Table */ if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { - struct acpi_subtable_proc srat_proc[3]; + struct acpi_subtable_proc srat_proc[4]; memset(srat_proc, 0, sizeof(srat_proc)); srat_proc[0].id = ACPI_SRAT_TYPE_CPU_AFFINITY; @@ -456,6 +514,8 @@ int __init acpi_numa_init(void) srat_proc[1].handler = acpi_parse_x2apic_affinity; srat_proc[2].id = ACPI_SRAT_TYPE_GICC_AFFINITY; srat_proc[2].handler = acpi_parse_gicc_affinity; + srat_proc[3].id = ACPI_SRAT_TYPE_GENERIC_AFFINITY; + srat_proc[3].handler = acpi_parse_gi_affinity; acpi_table_parse_entries_array(ACPI_SIG_SRAT, sizeof(struct acpi_table_srat), diff --git a/drivers/base/node.c b/drivers/base/node.c index 86d6cd92ce3d..f59b9d4ca5d5 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -634,6 +634,8 @@ static struct node_attr node_state_attr[] = { #endif [N_MEMORY] = _NODE_ATTR(has_memory, N_MEMORY), [N_CPU] = _NODE_ATTR(has_cpu, N_CPU), + [N_GENERIC_INITIATOR] = _NODE_ATTR(has_generic_initiator, + N_GENERIC_INITIATOR), }; static struct attribute *node_state_attrs[] = { @@ -645,6 +647,7 @@ static struct attribute *node_state_attrs[] = { #endif &node_state_attr[N_MEMORY].attr.attr, &node_state_attr[N_CPU].attr.attr, + &node_state_attr[N_GENERIC_INITIATOR].attr.attr, NULL }; diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h index 238873739550..54d0b4176a45 100644 --- a/include/asm-generic/topology.h +++ b/include/asm-generic/topology.h @@ -71,6 +71,9 @@ #ifndef set_cpu_numa_mem #define set_cpu_numa_mem(cpu, node) #endif +#ifndef set_gi_numa_mem +#define set_gi_numa_mem(gi, node) +#endif #endif /* !CONFIG_NUMA || !CONFIG_HAVE_MEMORYLESS_NODES */ diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 27e7fa36f707..1aebf766fb52 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h @@ -399,6 +399,7 @@ enum node_states { #endif N_MEMORY, /* The node has memory(regular, high, movable) */ N_CPU, /* The node has one or more cpus */ + N_GENERIC_INITIATOR, /* The node is a GI only node */ NR_NODE_STATES }; diff --git a/include/linux/topology.h b/include/linux/topology.h index cb0775e1ee4b..9d5f8501efcf 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h @@ -125,6 +125,13 @@ static inline void set_numa_mem(int node) } #endif +#ifndef set_gi_numa_mem +static inline void set_gi_numa_mem(int gi, int node) +{ + _node_numa_mem_[gi] = node; +} +#endif + #ifndef node_to_mem_node static inline int node_to_mem_node(int node) { From patchwork Mon Apr 15 17:49:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 162245 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3218281jan; Mon, 15 Apr 2019 10:49:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoZVjEEGPmJGPMIKE2jIDiCoGF1J/CYGNgXoInZFUowJNLI52RLAqg6qPgnCZQmjyiFp2Y X-Received: by 2002:a17:902:110c:: with SMTP id d12mr49435310pla.47.1555350595412; Mon, 15 Apr 2019 10:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555350595; cv=none; d=google.com; s=arc-20160816; b=mWUQoU2vAQ2yaIChKqFgb5UVmlKOkdnRKQR2N7P52ALkbQSF+EHNaSK2B3Dm0hQEo1 1ZB0cW3ipf2dm2lG8xAUC9MI6NnjzDs605KSmpQ/mgtidV6njjDb9Uwu42oQgZvpVVIn sIRo8jX2gZVJ4ppIy7XS+QGxYqX1IjFpP/rJYfvGQT22hcn8M+aq4s8JJsIjtePZn5Qx wJZ4lHjqNdyCCyUz0tiVzJEYbsmAN5HEm3T+wbHZZtUeN9yQmWqQCJMv0gbChYljavWj HJBvAcPHt53cWBSHyFs9gOOwrpOaHgtp/5RHGf0sWcLeolXkSa4k79c+lYdF0vxZSuAv 0CDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=c8Oa8if3Ah0YDZHoU72RxzlhFP90iXNpwesyngeW7fE=; b=c6S7Mr4LVEuTzvDp5vWucFPhWJvrQiD56oUy++3tHDAaZU3krXZxRF8k6N1RdQr4ms gLTbJwp0KMVSQ5TV2dCnIkd+4yVlpzZGg0yuxBLkm4c8T6P1uYUTo1mix0vx/zB8hzWX Fn0M4t7RYAQILL9njj+nwONUUSTc9rP3LvX/Tef8EokFYZKmP+s+gpkXbEkdmMy5wCxv wMPfJ1s8ZEs9a9ilXo3G1TsItrqx7g3SbZlJeXmOMgVHS2WO+l60GKNgKQb73mQrCHbc Zm8V72W6IwYNxSCj7/x16hL0cJo6ihs/NsqRPpM7N2Of12u3MpoFdp7N6veuxo+w6NzX KN7A== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be8si45920789plb.72.2019.04.15.10.49.55; Mon, 15 Apr 2019 10:49:55 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728102AbfDORty (ORCPT + 30 others); Mon, 15 Apr 2019 13:49:54 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6747 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727992AbfDORtt (ORCPT ); Mon, 15 Apr 2019 13:49:49 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E4BA485083B4B38C348A; Tue, 16 Apr 2019 01:49:46 +0800 (CST) Received: from FRA1000014316.huawei.com (100.126.230.97) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Tue, 16 Apr 2019 01:49:37 +0800 From: Jonathan Cameron To: , , , CC: =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Keith Busch , "Rafael J . Wysocki" , , Andrew Morton , "Jonathan Cameron" Subject: [PATCH 2/4 V3] arm64: Support Generic Initiator only domains Date: Tue, 16 Apr 2019 01:49:05 +0800 Message-ID: <20190415174907.102307-3-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190415174907.102307-1-Jonathan.Cameron@huawei.com> References: <20190415174907.102307-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [100.126.230.97] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The one thing that currently needs doing from an architecture point of view is associating the GI domain with its nearest memory domain. This allows all the standard NUMA aware code to get a 'reasonable' answer. A clever driver might elect to do load balancing etc if there are multiple host / memory domains nearby, but that's a decision for the driver. Signed-off-by: Jonathan Cameron --- arch/arm64/kernel/smp.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.19.1 diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 824de7038967..7c419bf92374 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -731,6 +731,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) { int err; unsigned int cpu; + unsigned int node; unsigned int this_cpu; init_cpu_topology(); @@ -769,6 +770,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus) set_cpu_present(cpu, true); numa_store_cpu_info(cpu); } + + /* + * Walk the numa domains and set the node to numa memory reference + * for any that are Generic Initiator Only. + */ + for_each_node_state(node, N_GENERIC_INITIATOR) + set_gi_numa_mem(node, local_memory_node(node)); } void (*__smp_cross_call)(const struct cpumask *, unsigned int); From patchwork Mon Apr 15 17:49:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 162246 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3218345jan; Mon, 15 Apr 2019 10:49:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAeOxTzY9pDGcV1ErHM+260tVDdPQDNQl/htNnkoQcdBDIcTgz4nmrzKtDc8Bb5hY0EQWh X-Received: by 2002:aa7:8252:: with SMTP id e18mr76231526pfn.105.1555350599713; Mon, 15 Apr 2019 10:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555350599; cv=none; d=google.com; s=arc-20160816; b=JfDvHdxdv6ofy2ZAezcaJhHMTkBm8wyAWzV3sDhqRN1walna9ZlEQtc537LtDhdTiy i2RYsNX1NNZhxJ0RAn50Q5EpreoLstM0q8rByMhoZiPNHbJRp3QXn81msnOoqinw+H51 PczUSmSjN3wNUhwVqHyFzIj7Mkr4VfSpDKdjNZhRL3jhgM5JkTrZGmI3l1TSBZs4h1pG vG8rm9mwCsfsahHOaUkKf++YvB5twjMb8yLSaMCiEgdJ/3+T1e0IhPH88BjF6ruUDRdc naI6hW+vOUYyeysNwlPplSTwVYKslNxhjtARNIBbfTRJFuP5fclSA6+7YaYUWZMfA/0K b28w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hF0XPxmSlriUa3biRRCnOMC8/O51OfJgLGjA5b/WPw4=; b=xiEMQQDq6V9QaT110V/8LmND9d5TbxHZz7SzxB1BnhJ7hf67MNPgbT61PMzeDlnXz3 W3W9uDfajT+l2+vpRTDIkcCuph0o0/4WJqumweS3l5kloKvZFh/L5E8Z4UvXVWJ0f2AY 2RC3j3ZdICFFw3OoSbGuWwWK7J0L+fRQtuf26roYO+NPqJkYCtnnWWwlLPMGQcucg5QA OwvyBcOWUbW9TcWuYnr15b8UaQ1KCerz9TipKzABEAhor7Oiqad2MXx23Z22MN7DwiFA J4Uy8Zh7tkyhWDGOMnOK+syRToBxOeJwwajswL8JVulkGcmlcMtgOwH0wopsisz9KSOg 93Kg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u70si35242118pgu.119.2019.04.15.10.49.59; Mon, 15 Apr 2019 10:49:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728086AbfDORty (ORCPT + 30 others); Mon, 15 Apr 2019 13:49:54 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6748 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727994AbfDORtt (ORCPT ); Mon, 15 Apr 2019 13:49:49 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E9F36BCDACFC859002AD; Tue, 16 Apr 2019 01:49:46 +0800 (CST) Received: from FRA1000014316.huawei.com (100.126.230.97) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Tue, 16 Apr 2019 01:49:40 +0800 From: Jonathan Cameron To: , , , CC: =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Keith Busch , "Rafael J . Wysocki" , , Andrew Morton , "Jonathan Cameron" Subject: [PATCH 3/4 V3] x86: Support Generic Initiator only proximity domains Date: Tue, 16 Apr 2019 01:49:06 +0800 Message-ID: <20190415174907.102307-4-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190415174907.102307-1-Jonathan.Cameron@huawei.com> References: <20190415174907.102307-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [100.126.230.97] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Done in a somewhat different fashion to arm64. Here the infrastructure for memoryless domains was already in place. That infrastruture applies just as well to domains that also don't have a CPU, hence it works for Generic Initiator Domains. In common with memoryless domains we only register GI domains if the proximity node is not online. If a domain is already a memory containing domain, or a memoryless domain there is nothing to do just because it also contains a Generic Initiator. Signed-off-by: Jonathan Cameron --- arch/x86/include/asm/numa.h | 2 ++ arch/x86/kernel/setup.c | 1 + arch/x86/mm/numa.c | 14 ++++++++++++++ 3 files changed, 17 insertions(+) -- 2.19.1 diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index bbfde3d2662f..f631467272a3 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h @@ -62,12 +62,14 @@ extern void numa_clear_node(int cpu); extern void __init init_cpu_to_node(void); extern void numa_add_cpu(int cpu); extern void numa_remove_cpu(int cpu); +extern void init_gi_nodes(void); #else /* CONFIG_NUMA */ static inline void numa_set_node(int cpu, int node) { } static inline void numa_clear_node(int cpu) { } static inline void init_cpu_to_node(void) { } static inline void numa_add_cpu(int cpu) { } static inline void numa_remove_cpu(int cpu) { } +static inline void init_gi_nodes(void) { } #endif /* CONFIG_NUMA */ #ifdef CONFIG_DEBUG_PER_CPU_MAPS diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 3d872a527cd9..240568c3ac60 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1245,6 +1245,7 @@ void __init setup_arch(char **cmdline_p) prefill_possible_map(); init_cpu_to_node(); + init_gi_nodes(); io_apic_init_mappings(); diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index dfb6c4df639a..5770d2dcad29 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -732,6 +732,20 @@ static void __init init_memory_less_node(int nid) */ } +/* + * Generic Initiator Nodes may have neither CPU nor Memory. + * At this stage if either of the others were present we would + * already be online. + */ +void __init init_gi_nodes(void) +{ + int nid; + + for_each_node_state(nid, N_GENERIC_INITIATOR) + if (!node_online(nid)) + init_memory_less_node(nid); +} + /* * Setup early cpu_to_node. * From patchwork Mon Apr 15 17:49:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 162247 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3218393jan; Mon, 15 Apr 2019 10:50:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmR5aYzflhlnX7/vdTYiYuDfApS7+a9zYsh/BdiR5fYUcz9ESqXoheWkVG11duZVBzVhMh X-Received: by 2002:a17:902:599c:: with SMTP id p28mr14544253pli.70.1555350603223; Mon, 15 Apr 2019 10:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555350603; cv=none; d=google.com; s=arc-20160816; b=n86VMQ4/IqilpNFpFO8Q1dvf9yHW3ZlRU+ZMgbNXst+E1sdh+dv+WIDxh3r/vxiMwt 44EgPWtfhQAErD2HikAzKeYzgrPb4o0A7IreRWXR8+Pw69+qDiWNlBbNE9oDvm5v+APv iFFJueErCauOhYyLIOjDq8duNbc7ZYFnaACTmVbYC2rvRO7XAotIZQEK40s4ccBYq4XY QPeU+1cDSRoXQN9pRXzXWljwLDTuDpizrbQJgLxfDnKmhaFnNN7BuQLtnbRtt5na23UN A871Y74ZhVEcFgPRjZ6RQJn82XlSCCZ8apWMSShwexU+HaMVEc4pPdzyW0SCBAlwwpJq ftCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/ctch9BIG/gBXs/UumXXhUGfeedoBTKJpXlhlTSkdIA=; b=iLoIIUUGd12K+0zqiehvGLp8s2LnO17YN8wnJunXnJ9TGKL04OcQaEGlCQO7oNQaIw RiXT6uMy/bJwz/0ytmD+piTbE+Xq0Q75UnxBsrlqgJSXMMMcOB2+UsnoakQuPonsv20H rmbHUf3PMfZ9C1YIFKPrkVfmOKWaNOk0mvHUl/fEEpYeeclMHLFKrDS2h4heVfCA5Uu8 DPXJxuWoXRxvWsF6gSIH5LO6JXpLIraSUm+IJAboJJm4CZcD0Y3eW89/PJ8FMFV5GP+V CShBVfDDXfGb/ovuEuxo4IMMUlDby3nUPvM4GSDmsghSDC6nLwCszcfR07/C7aNhe0yL okGw== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u70si35242118pgu.119.2019.04.15.10.50.02; Mon, 15 Apr 2019 10:50:03 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728116AbfDORuB (ORCPT + 30 others); Mon, 15 Apr 2019 13:50:01 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:49796 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728036AbfDORtx (ORCPT ); Mon, 15 Apr 2019 13:49:53 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 02E473ED7A4E7FCD7631; Tue, 16 Apr 2019 01:49:52 +0800 (CST) Received: from FRA1000014316.huawei.com (100.126.230.97) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Tue, 16 Apr 2019 01:49:42 +0800 From: Jonathan Cameron To: , , , CC: =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Keith Busch , "Rafael J . Wysocki" , , Andrew Morton , "Jonathan Cameron" Subject: [PATCH 4/4 V3] ACPI: Let ACPI know we support Generic Initiator Affinity Structures Date: Tue, 16 Apr 2019 01:49:07 +0800 Message-ID: <20190415174907.102307-5-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190415174907.102307-1-Jonathan.Cameron@huawei.com> References: <20190415174907.102307-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [100.126.230.97] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Until we tell ACPI that we support generic initiators, it will have to operate in fall back domain mode and all _PXM entries should be on existing non GI domains. This patch sets the relevant OSC bit to make that happen. Note that this currently doesn't take into account whether we have the relevant setup code for a given architecture. Do we want to make this optional, or should the initial patch set just enable it for all ACPI supporting architectures? Signed-off-by: Jonathan Cameron --- drivers/acpi/bus.c | 1 + include/linux/acpi.h | 1 + 2 files changed, 2 insertions(+) -- 2.19.1 diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index eec263c9019e..ef251f454a5b 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -315,6 +315,7 @@ static void acpi_bus_osc_support(void) capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT; capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PCLPI_SUPPORT; + capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_GENERIC_INITIATOR_SUPPORT; #ifdef CONFIG_X86 if (boot_cpu_has(X86_FEATURE_HWP)) { diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d5dcebd7aad3..cc68b2ad0630 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -503,6 +503,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); #define OSC_SB_PCLPI_SUPPORT 0x00000080 #define OSC_SB_OSLPI_SUPPORT 0x00000100 #define OSC_SB_CPC_DIVERSE_HIGH_SUPPORT 0x00001000 +#define OSC_SB_GENERIC_INITIATOR_SUPPORT 0x00002000 extern bool osc_sb_apei_support_acked; extern bool osc_pc_lpi_support_confirmed;