[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH v3 20/24] ACPI: Move arch specific SRAT parsing



From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxx>

SRAT's X2APIC_CPU_AFFINITY and CPU_AFFINITY types are not used
by ARM. Hence move handling of this SRAT types to arch specific
file and handle them under arch_table_parse_srat().

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxx>
---
 xen/arch/arm/numa/acpi_numa.c |  5 +++++
 xen/arch/x86/srat.c           | 44 +++++++++++++++++++++++++++++++++++++++++++
 xen/drivers/acpi/numa.c       | 43 ++----------------------------------------
 xen/include/xen/acpi.h        |  6 ++++++
 4 files changed, 57 insertions(+), 41 deletions(-)

diff --git a/xen/arch/arm/numa/acpi_numa.c b/xen/arch/arm/numa/acpi_numa.c
index d9ad547..341e20b7 100644
--- a/xen/arch/arm/numa/acpi_numa.c
+++ b/xen/arch/arm/numa/acpi_numa.c
@@ -82,6 +82,11 @@ void __init acpi_map_uid_to_mpidr(void)
                     acpi_parse_madt_handler, NR_CPUS);
 }
 
+void __init arch_table_parse_srat(void)
+{
+    return;
+}
+
 void __init acpi_numa_arch_fixup(void) {}
 
 /*
diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
index d5caccf..a5fdedd 100644
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -205,3 +205,47 @@ uint8_t __node_distance(nodeid_t a, nodeid_t b)
 }
 
 EXPORT_SYMBOL(__node_distance);
+
+static int __init
+acpi_parse_x2apic_affinity(struct acpi_subtable_header *header,
+                          const unsigned long end)
+{
+       const struct acpi_srat_x2apic_cpu_affinity *processor_affinity
+               = container_of(header, struct acpi_srat_x2apic_cpu_affinity,
+                              header);
+
+       if (!header)
+               return -EINVAL;
+
+       acpi_table_print_srat_entry(header);
+
+       /* let architecture-dependent part to do it */
+       acpi_numa_x2apic_affinity_init(processor_affinity);
+
+       return 0;
+}
+
+static int __init
+acpi_parse_processor_affinity(struct acpi_subtable_header *header,
+                             const unsigned long end)
+{
+       const struct acpi_srat_cpu_affinity *processor_affinity
+               = container_of(header, struct acpi_srat_cpu_affinity, header);
+
+       if (!header)
+               return -EINVAL;
+
+       acpi_table_print_srat_entry(header);
+
+       acpi_numa_processor_affinity_init(processor_affinity);
+
+       return 0;
+}
+
+void __init arch_table_parse_srat(void)
+{
+       acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY,
+                             acpi_parse_x2apic_affinity, 0);
+       acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
+                             acpi_parse_processor_affinity, 0);
+}
diff --git a/xen/drivers/acpi/numa.c b/xen/drivers/acpi/numa.c
index 85f8917..0adc32c 100644
--- a/xen/drivers/acpi/numa.c
+++ b/xen/drivers/acpi/numa.c
@@ -120,43 +120,6 @@ static int __init acpi_parse_slit(struct acpi_table_header 
*table)
 }
 
 static int __init
-acpi_parse_x2apic_affinity(struct acpi_subtable_header *header,
-                          const unsigned long end)
-{
-       const struct acpi_srat_x2apic_cpu_affinity *processor_affinity
-               = container_of(header, struct acpi_srat_x2apic_cpu_affinity,
-                              header);
-
-       if (!header)
-               return -EINVAL;
-
-       acpi_table_print_srat_entry(header);
-
-       /* let architecture-dependent part to do it */
-       acpi_numa_x2apic_affinity_init(processor_affinity);
-
-       return 0;
-}
-
-static int __init
-acpi_parse_processor_affinity(struct acpi_subtable_header *header,
-                             const unsigned long end)
-{
-       const struct acpi_srat_cpu_affinity *processor_affinity
-               = container_of(header, struct acpi_srat_cpu_affinity, header);
-
-       if (!header)
-               return -EINVAL;
-
-       acpi_table_print_srat_entry(header);
-
-       /* let architecture-dependent part to do it */
-       acpi_numa_processor_affinity_init(processor_affinity);
-
-       return 0;
-}
-
-static int __init
 acpi_parse_memory_affinity(struct acpi_subtable_header *header,
                           const unsigned long end)
 {
@@ -197,13 +160,11 @@ int __init acpi_numa_init(void)
 {
        /* SRAT: Static Resource Affinity Table */
        if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
-               acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY,
-                                     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_MEMORY_AFFINITY,
                                      acpi_parse_memory_affinity,
                                      NR_NODE_MEMBLKS);
+               /* This call handles architecture dependant SRAT */
+               arch_table_parse_srat();
        }
 
        /* SLIT: System Locality Information Table */
diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h
index 9409350..53795ff 100644
--- a/xen/include/xen/acpi.h
+++ b/xen/include/xen/acpi.h
@@ -95,7 +95,13 @@ void acpi_numa_slit_init (struct acpi_table_slit *slit);
 void acpi_numa_processor_affinity_init(const struct acpi_srat_cpu_affinity *);
 void acpi_numa_x2apic_affinity_init(const struct acpi_srat_x2apic_cpu_affinity 
*);
 void acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *);
+#ifdef CONFIG_ACPI_NUMA
 void acpi_numa_arch_fixup(void);
+void arch_table_parse_srat(void);
+#else
+static inline void acpi_numa_arch_fixup(void) { }
+static inline void arch_table_parse_srat(void) { }
+#endif
 
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
 /* Arch dependent functions for cpu hotplug support */
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.