Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1315564
| From | Hanjun Guo <guohanjun@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 07/12] acpi, numa: move acpi_numa_slit_init() to common place |
| Date | 2016-01-23 10:50 +0100 |
| Message-ID | <qU2Zs-K2-35@gated-at.bofh.it> (permalink) |
| References | <qU2Zr-K2-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Hanjun Guo <hanjun.guo@linaro.org>
acpi_numa_slit_init() is used by both x86 and arm64, and
the code is the same, move it to common place to simplify
the code, and mark it as __weak because the different
implimentation for ia64.
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
arch/arm64/kernel/acpi_numa.c | 31 -------------------------------
arch/x86/mm/srat.c | 27 ---------------------------
drivers/acpi/numa.c | 30 ++++++++++++++++++++++++++++++
3 files changed, 30 insertions(+), 58 deletions(-)
diff --git a/arch/arm64/kernel/acpi_numa.c b/arch/arm64/kernel/acpi_numa.c
index f7f7533..15fb935 100644
--- a/arch/arm64/kernel/acpi_numa.c
+++ b/arch/arm64/kernel/acpi_numa.c
@@ -64,37 +64,6 @@ void __init acpi_numa_set_node_info(unsigned int cpu, u64 hwid)
cpu_to_node_map[cpu] = nid;
}
-/*
- * Callback for SLIT parsing.
- * It will get the distance information presented by SLIT
- * and init the distance matrix of numa nodes
- */
-void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
-{
- int i, j;
-
- for (i = 0; i < slit->locality_count; i++) {
- const int from_node = pxm_to_node(i);
-
- if (from_node == NUMA_NO_NODE)
- continue;
-
- for (j = 0; j < slit->locality_count; j++) {
- const int to_node = pxm_to_node(j);
-
- if (to_node == NUMA_NO_NODE)
- continue;
-
- pr_debug("SLIT: Distance[%d][%d] = %d\n",
- from_node, to_node,
- slit->entry[
- slit->locality_count * i + j]);
- numa_set_distance(from_node, to_node,
- slit->entry[slit->locality_count * i + j]);
- }
- }
-}
-
static int __init get_mpidr_in_madt(int acpi_id, u64 *mpidr)
{
unsigned long madt_end, entry;
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index 9fa1746..92a640a 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -42,33 +42,6 @@ static __init inline int srat_disabled(void)
return acpi_numa < 0;
}
-/*
- * Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for
- * I/O localities since SRAT does not list them. I/O localities are
- * not supported at this point.
- */
-void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
-{
- int i, j;
-
- for (i = 0; i < slit->locality_count; i++) {
- const int from_node = pxm_to_node(i);
-
- if (from_node == NUMA_NO_NODE)
- continue;
-
- for (j = 0; j < slit->locality_count; j++) {
- const int to_node = pxm_to_node(j);
-
- if (to_node == NUMA_NO_NODE)
- continue;
-
- numa_set_distance(from_node, to_node,
- slit->entry[slit->locality_count * i + j]);
- }
- }
-}
-
/* Callback for Proximity Domain -> x2APIC mapping */
void __init
acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 4728525..b33915e 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -209,6 +209,36 @@ static int __init slit_valid(struct acpi_table_slit *slit)
return 1;
}
+/*
+ * Callback for SLIT parsing. It will get the distance information
+ * presented by SLIT and init the distance matrix of numa nodes
+ */
+void __init __weak acpi_numa_slit_init(struct acpi_table_slit *slit)
+{
+ int i, j;
+
+ for (i = 0; i < slit->locality_count; i++) {
+ const int from_node = pxm_to_node(i);
+
+ if (from_node == NUMA_NO_NODE)
+ continue;
+
+ for (j = 0; j < slit->locality_count; j++) {
+ const int to_node = pxm_to_node(j);
+
+ if (to_node == NUMA_NO_NODE)
+ continue;
+
+ numa_set_distance(from_node, to_node,
+ slit->entry[slit->locality_count * i + j]);
+
+ pr_debug("SLIT: Distance[%d][%d] = %d\n",
+ from_node, to_node,
+ slit->entry[slit->locality_count * i + j]);
+ }
+ }
+}
+
static int __init acpi_parse_slit(struct acpi_table_header *table)
{
struct acpi_table_slit *slit = (struct acpi_table_slit *)table;
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v3 00/12] ACPI NUMA support for ARM64 Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
[PATCH v3 08/12] arm64, numa: rework numa_add_memblk() Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
Re: [PATCH v3 08/12] arm64, numa: rework numa_add_memblk() Robert Richter <robert.richter@caviumnetworks.com> - 2016-01-25 11:10 +0100
Re: [PATCH v3 08/12] arm64, numa: rework numa_add_memblk() Hanjun Guo <guohanjun@huawei.com> - 2016-01-27 07:30 +0100
[PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT and SLIT Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT and SLIT Robert Richter <robert.richter@caviumnetworks.com> - 2016-01-25 11:30 +0100
Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT and SLIT Hanjun Guo <guohanjun@huawei.com> - 2016-01-27 08:20 +0100
Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT and SLIT Robert Richter <robert.richter@caviumnetworks.com> - 2016-01-27 15:40 +0100
[PATCH v3 12/12] acpi, numa: reuse acpi_numa_memory_affinity_init() Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
Re: [PATCH v3 12/12] acpi, numa: reuse acpi_numa_memory_affinity_init() Robert Richter <robert.richter@caviumnetworks.com> - 2016-01-25 11:30 +0100
Re: [PATCH v3 12/12] acpi, numa: reuse acpi_numa_memory_affinity_init() Hanjun Guo <guohanjun@huawei.com> - 2016-01-27 07:20 +0100
Re: [PATCH v3 12/12] acpi, numa: reuse acpi_numa_memory_affinity_init() Robert Richter <robert.richter@caviumnetworks.com> - 2016-01-27 15:20 +0100
[PATCH v3 10/12] acpi, numa: move bad_srat() and srat_disabled() to common place Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
[PATCH v3 02/12] acpi, numa: Replace ACPI_DEBUG_PRINT() with pr_debug() Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
[PATCH v3 07/12] acpi, numa: move acpi_numa_slit_init() to common place Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
csiph-web