Skip to contentSkip to conversation

- Add early detection of UV system types

PATCH Applied Jack Steiner 3 participants 6 messages Sep 23, 2008 – Sep 24, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 - Add early detection of UV system types

Portions of system boot needs to know if a system is a UV system prior to genapic initialization. This patch adds a call from acpi_boot_table_init() to the UV code to parse the MADT to determine if the system is a UV system.

---
 arch/x86/kernel/acpi/boot.c      |    4 ++++
 arch/x86/kernel/genx2apic_uv_x.c |   21 ++++++++++++---------
 arch/x86/mm/srat_64.c            |    2 +-
 include/asm-x86/genapic_64.h     |    2 ++
 4 files changed, 19 insertions(+), 10 deletions(-)
arch/x86/kernel/acpi/boot.c +4 -0
Index: linux/arch/x86/kernel/acpi/boot.c
===================================================================
@@ -1667,6 +1667,10 @@ int __init acpi_boot_table_init(void)
 
 	acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
 
+#ifdef CONFIG_X86_64
+	acpi_table_parse(ACPI_SIG_MADT, uv_early_madt_oem_check);
+#endif
+
 	/*
 	 * blacklist may disable ACPI entirely
 	 */
arch/x86/kernel/genx2apic_uv_x.c +12 -9
Index: linux/arch/x86/kernel/genx2apic_uv_x.c
===================================================================
@@ -18,6 +18,7 @@
 #include <linux/bootmem.h>
 #include <linux/module.h>
 #include <linux/hardirq.h>
+#include <linux/acpi.h>
 #include <asm/smp.h>
 #include <asm/ipi.h>
 #include <asm/genapic.h>
@@ -25,26 +26,28 @@
 #include <asm/uv/uv_mmrs.h>
 #include <asm/uv/uv_hub.h>
 #include <asm/uv/bios.h>
-
 DEFINE_PER_CPU(int, x2apic_extra_bits);
 
 static enum uv_system_type uv_system_type;
 
-static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+int __init uv_early_madt_oem_check(struct acpi_table_header *table)
 {
-	if (!strcmp(oem_id, "SGI")) {
-		if (!strcmp(oem_table_id, "UVL"))
+	if (!strcmp(table->oem_id, "SGI")) {
+		if (!strcmp(table->oem_table_id, "UVL"))
 			uv_system_type = UV_LEGACY_APIC;
-		else if (!strcmp(oem_table_id, "UVX"))
+		else if (!strcmp(table->oem_table_id, "UVX"))
 			uv_system_type = UV_X2APIC;
-		else if (!strcmp(oem_table_id, "UVH")) {
+		else if (!strcmp(table->oem_table_id, "UVH"))
 			uv_system_type = UV_NON_UNIQUE_APIC;
-			return 1;
-		}
 	}
 	return 0;
 }
 
+static int is_uv_apic(char *oem_id, char *oem_table_id)
+{
+	return uv_system_type == UV_NON_UNIQUE_APIC;
+}
+
 enum uv_system_type get_uv_system_type(void)
 {
 	return uv_system_type;
@@ -211,7 +214,7 @@ static void uv_send_IPI_self(int vector)
 
 struct genapic apic_x2apic_uv_x = {
 	.name = "UV large system",
-	.acpi_madt_oem_check = uv_acpi_madt_oem_check,
+	.acpi_madt_oem_check = is_uv_apic,
 	.int_delivery_mode = dest_Fixed,
 	.int_dest_mode = (APIC_DEST_PHYSICAL != 0),
 	.target_cpus = uv_target_cpus,
arch/x86/mm/srat_64.c +1 -1
Index: linux/arch/x86/mm/srat_64.c
===================================================================
@@ -138,7 +138,7 @@ acpi_numa_processor_affinity_init(struct
 		return;
 	}
 
-	if (is_uv_system())
+	if (get_uv_system_type() >= UV_X2APIC)
 		apic_id = (pa->apic_id << 8) | pa->local_sapic_eid;
 	else
 		apic_id = pa->apic_id;
include/asm-x86/genapic_64.h +2 -0
Index: linux/include/asm-x86/genapic_64.h
===================================================================
@@ -46,6 +46,8 @@ extern void apic_send_IPI_self(int vecto
 enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC};
 extern enum uv_system_type get_uv_system_type(void);
 extern int is_uv_system(void);
+struct acpi_table_header;
+extern int uv_early_madt_oem_check(struct acpi_table_header *table);
 
 extern struct genapic apic_x2apic_uv_x;
 DECLARE_PER_CPU(int, x2apic_extra_bits);
#1 lore raw
Quoted 18 lines · Jack Steiner

Portions of system boot needs to know if a system is a UV system prior to genapic initialization. This patch adds a call from acpi_boot_table_init() to the UV code to parse the MADT to determine if the system is a UV system.

---
 arch/x86/kernel/acpi/boot.c      |    4 ++++
 arch/x86/kernel/genx2apic_uv_x.c |   21 ++++++++++++---------
 arch/x86/mm/srat_64.c            |    2 +-
 include/asm-x86/genapic_64.h     |    2 ++
 4 files changed, 19 insertions(+), 10 deletions(-)

Index: linux/arch/x86/kernel/acpi/boot.c
===================================================================

arch/x86/kernel/acpi/boot.c 2008-09-23 12:55:19.000000000 -0500 int __init acpi_boot_table_init(void) · line 1676

Quoted 10 lines
arch/x86/kernel/acpi/boot.c 2008-09-23 12:55:19.000000000 -0500 renamed from arch/x86/kernel/acpi/boot.c 2008-09-23 12:55:15.000000000 -0500 +4 -0
@@ -1667,6 +1667,10 @@ int __init acpi_boot_table_init(void)
 
       acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
 
+#ifdef CONFIG_X86_64
+       acpi_table_parse(ACPI_SIG_MADT, uv_early_madt_oem_check);
+#endif
+
       /*
        * blacklist may disable ACPI entirely
        */

you don't need to that.

please call early_acpi_boot_init instead

sth like

arch/x86/kernel/setup.c +2 -0
index 3d677b5..7ead2aa 100644
@@ -997,6 +997,8 @@ void __init setup_arch(char **cmdline_p)
         */
        acpi_boot_table_init();
 
+       early_acpi_boot_init();
+
 #ifdef CONFIG_ACPI_NUMA
        /*
         * Parse SRAT to discover nodes.

YH

#2 lore raw
Quoted 32 lines · Yinghai Lu
Quoted 18 lines · Jack Steiner

Portions of system boot needs to know if a system is a UV system prior to genapic initialization. This patch adds a call from acpi_boot_table_init() to the UV code to parse the MADT to determine if the system is a UV system.

---
 arch/x86/kernel/acpi/boot.c      |    4 ++++
 arch/x86/kernel/genx2apic_uv_x.c |   21 ++++++++++++---------
 arch/x86/mm/srat_64.c            |    2 +-
 include/asm-x86/genapic_64.h     |    2 ++
 4 files changed, 19 insertions(+), 10 deletions(-)

Index: linux/arch/x86/kernel/acpi/boot.c
===================================================================

arch/x86/kernel/acpi/boot.c 2008-09-23 12:55:19.000000000 -0500 int __init acpi_boot_table_init(void) · line 1676

Quoted 10 lines
arch/x86/kernel/acpi/boot.c 2008-09-23 12:55:19.000000000 -0500 renamed from arch/x86/kernel/acpi/boot.c 2008-09-23 12:55:15.000000000 -0500 +4 -0
@@ -1667,6 +1667,10 @@ int __init acpi_boot_table_init(void)
 
       acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
 
+#ifdef CONFIG_X86_64
+       acpi_table_parse(ACPI_SIG_MADT, uv_early_madt_oem_check);
+#endif
+
       /*
        * blacklist may disable ACPI entirely
        */

you don't need to that.

Quoted 1 line

please call early_acpi_boot_init instead

I don't mind moving the new call from acpi_boot_table_init() to early_acpi_boot_init(), but I still need to determine the UV type very early in boot. System type is needed prior to parsing the SRAT.

Quoted 18 lines

sth like

arch/x86/kernel/setup.c +2 -0
index 3d677b5..7ead2aa 100644
@@ -997,6 +997,8 @@ void __init setup_arch(char **cmdline_p)
         */
        acpi_boot_table_init();
 
+       early_acpi_boot_init();
+
 #ifdef CONFIG_ACPI_NUMA
        /*
         * Parse SRAT to discover nodes.

YH

#3 lore raw
Quoted 50 lines · Jack Steiner
Quoted 32 lines · Yinghai Lu
Quoted 18 lines · Jack Steiner

Portions of system boot needs to know if a system is a UV system prior to genapic initialization. This patch adds a call from acpi_boot_table_init() to the UV code to parse the MADT to determine if the system is a UV system.

---
 arch/x86/kernel/acpi/boot.c      |    4 ++++
 arch/x86/kernel/genx2apic_uv_x.c |   21 ++++++++++++---------
 arch/x86/mm/srat_64.c            |    2 +-
 include/asm-x86/genapic_64.h     |    2 ++
 4 files changed, 19 insertions(+), 10 deletions(-)

Index: linux/arch/x86/kernel/acpi/boot.c
===================================================================

arch/x86/kernel/acpi/boot.c 2008-09-23 12:55:19.000000000 -0500 int __init acpi_boot_table_init(void) · line 1676

Quoted 10 lines
arch/x86/kernel/acpi/boot.c 2008-09-23 12:55:19.000000000 -0500 renamed from arch/x86/kernel/acpi/boot.c 2008-09-23 12:55:15.000000000 -0500 +4 -0
@@ -1667,6 +1667,10 @@ int __init acpi_boot_table_init(void)
 
       acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
 
+#ifdef CONFIG_X86_64
+       acpi_table_parse(ACPI_SIG_MADT, uv_early_madt_oem_check);
+#endif
+
       /*
        * blacklist may disable ACPI entirely
        */

you don't need to that.

Quoted 1 line

please call early_acpi_boot_init instead

I don't mind moving the new call from acpi_boot_table_init() to early_acpi_boot_init(), but I still need to determine the UV type very early in boot. System type is needed prior to parsing the SRAT.

Quoted 11 lines

sth like

arch/x86/kernel/setup.c +0 -0
index 3d677b5..7ead2aa 100644
@@ -997,6 +997,8 @@ void __init setup_arch(char **cmdline_p)
         */
        acpi_boot_table_init();
 
Quoted 8 lines
Quoted 7 lines
arch/x86/kernel/setup.c +2 -0
+       early_acpi_boot_init();
+
 #ifdef CONFIG_ACPI_NUMA
        /*
         * Parse SRAT to discover nodes.

YH

early_acpi_boot_init ==> early_acpi_process_madt ==> acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt) ==> acpi_parse_madt ==> acpi_madt_oem_check
==> at last

int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)

{
        int i;

        for (i = 0; apic_probe[i]; ++i) {
                if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) {
                        genapic = apic_probe[i];
                        printk(KERN_INFO "Setting APIC routing to %s.\n",
                                genapic->name);
                        return 1;
                }
        }
        return 0;
}

and

static struct genapic *apic_probe[] __initdata = {
        &apic_x2apic_uv_x,
        &apic_x2apic_phys,
        &apic_x2apic_cluster,
        &apic_physflat,
        NULL,
};

so apic_x2apic_uv_x's uv_acpi_madt_oem_check is called at first.

YH

#4 lore raw

Re: [PATCH] - V2 Add early detection of UV system types

Portions of the ACPI code needs to know if a system is a UV system prior to genapic initialization. This patch adds a call early_acpi_boot_init() so that the apic type is discovered earlier.

---

V2 of the patch adding fixes from Yinghai Lu.
Much cleaner and smaller.

 arch/x86/kernel/setup.c |    2 ++
 arch/x86/mm/srat_64.c   |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/setup.c +2 -0
Index: linux/arch/x86/kernel/setup.c
===================================================================
@@ -960,6 +960,8 @@ void __init setup_arch(char **cmdline_p)
 	 */
 	acpi_boot_table_init();
 
+	early_acpi_boot_init();
+
 #ifdef CONFIG_ACPI_NUMA
 	/*
 	 * Parse SRAT to discover nodes.
arch/x86/mm/srat_64.c +1 -1
Index: linux/arch/x86/mm/srat_64.c
===================================================================
@@ -138,7 +138,7 @@ acpi_numa_processor_affinity_init(struct
 		return;
 	}
 
-	if (is_uv_system())
+	if (get_uv_system_type() >= UV_X2APIC)
 		apic_id = (pa->apic_id << 8) | pa->local_sapic_eid;
 	else
 		apic_id = pa->apic_id;
Applied
#5 lore raw

Re: [PATCH] - V2 Add early detection of UV system types

Quoted 10 lines · Jack Steiner

Portions of the ACPI code needs to know if a system is a UV system prior to genapic initialization. This patch adds a call early_acpi_boot_init() so that the apic type is discovered earlier.

---

V2 of the patch adding fixes from Yinghai Lu.
Much cleaner and smaller.

applied to tip/x86/uv, thanks!

Ingo