public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] - Add early detection of UV system types
@ 2008-09-23 18:28 Jack Steiner
  2008-09-23 18:59 ` Yinghai Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Jack Steiner @ 2008-09-23 18:28 UTC (permalink / raw)
  To: mingo, tglx; +Cc: linux-kernel

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.

Signed-off-by: Jack Steiner <steiner@sgi.com>

---
 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
===================================================================
--- linux.orig/arch/x86/kernel/acpi/boot.c	2008-09-23 12:55:15.000000000 -0500
+++ linux/arch/x86/kernel/acpi/boot.c	2008-09-23 12:55:19.000000000 -0500
@@ -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
 	 */
Index: linux/arch/x86/kernel/genx2apic_uv_x.c
===================================================================
--- linux.orig/arch/x86/kernel/genx2apic_uv_x.c	2008-09-23 12:55:19.000000000 -0500
+++ linux/arch/x86/kernel/genx2apic_uv_x.c	2008-09-23 12:56:15.000000000 -0500
@@ -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,
Index: linux/arch/x86/mm/srat_64.c
===================================================================
--- linux.orig/arch/x86/mm/srat_64.c	2008-09-23 12:55:15.000000000 -0500
+++ linux/arch/x86/mm/srat_64.c	2008-09-23 12:55:19.000000000 -0500
@@ -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;
Index: linux/include/asm-x86/genapic_64.h
===================================================================
--- linux.orig/include/asm-x86/genapic_64.h	2008-09-23 12:55:15.000000000 -0500
+++ linux/include/asm-x86/genapic_64.h	2008-09-23 12:55:19.000000000 -0500
@@ -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);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] - Add early detection of UV system types
  2008-09-23 18:28 [PATCH] - Add early detection of UV system types Jack Steiner
@ 2008-09-23 18:59 ` Yinghai Lu
  2008-09-23 19:30   ` Jack Steiner
  0 siblings, 1 reply; 6+ messages in thread
From: Yinghai Lu @ 2008-09-23 18:59 UTC (permalink / raw)
  To: Jack Steiner; +Cc: mingo, tglx, linux-kernel

On Tue, Sep 23, 2008 at 11:28 AM, Jack Steiner <steiner@sgi.com> wrote:
> 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.
>
> Signed-off-by: Jack Steiner <steiner@sgi.com>
>
> ---
>  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
> ===================================================================
> --- linux.orig/arch/x86/kernel/acpi/boot.c      2008-09-23 12:55:15.000000000 -0500
> +++ linux/arch/x86/kernel/acpi/boot.c   2008-09-23 12:55:19.000000000 -0500
> @@ -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

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 3d677b5..7ead2aa 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] - Add early detection of UV system types
  2008-09-23 18:59 ` Yinghai Lu
@ 2008-09-23 19:30   ` Jack Steiner
  2008-09-23 19:39     ` Yinghai Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Jack Steiner @ 2008-09-23 19:30 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: mingo, tglx, linux-kernel

On Tue, Sep 23, 2008 at 11:59:26AM -0700, Yinghai Lu wrote:
> On Tue, Sep 23, 2008 at 11:28 AM, Jack Steiner <steiner@sgi.com> wrote:
> > 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.
> >
> > Signed-off-by: Jack Steiner <steiner@sgi.com>
> >
> > ---
> >  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
> > ===================================================================
> > --- linux.orig/arch/x86/kernel/acpi/boot.c      2008-09-23 12:55:15.000000000 -0500
> > +++ linux/arch/x86/kernel/acpi/boot.c   2008-09-23 12:55:19.000000000 -0500
> > @@ -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

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.

> 
> sth like
> 
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 3d677b5..7ead2aa 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] - Add early detection of UV system types
  2008-09-23 19:30   ` Jack Steiner
@ 2008-09-23 19:39     ` Yinghai Lu
  2008-09-23 20:37       ` [PATCH] - V2 " Jack Steiner
  0 siblings, 1 reply; 6+ messages in thread
From: Yinghai Lu @ 2008-09-23 19:39 UTC (permalink / raw)
  To: Jack Steiner; +Cc: mingo, tglx, linux-kernel

On Tue, Sep 23, 2008 at 12:30 PM, Jack Steiner <steiner@sgi.com> wrote:
> On Tue, Sep 23, 2008 at 11:59:26AM -0700, Yinghai Lu wrote:
>> On Tue, Sep 23, 2008 at 11:28 AM, Jack Steiner <steiner@sgi.com> wrote:
>> > 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.
>> >
>> > Signed-off-by: Jack Steiner <steiner@sgi.com>
>> >
>> > ---
>> >  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
>> > ===================================================================
>> > --- linux.orig/arch/x86/kernel/acpi/boot.c      2008-09-23 12:55:15.000000000 -0500
>> > +++ linux/arch/x86/kernel/acpi/boot.c   2008-09-23 12:55:19.000000000 -0500
>> > @@ -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
>
> 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.
>
>>
>> sth like
>>
>> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
>> index 3d677b5..7ead2aa 100644
>> --- a/arch/x86/kernel/setup.c
>> +++ b/arch/x86/kernel/setup.c
>> @@ -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
>

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] - V2 Add early detection of UV system types
  2008-09-23 19:39     ` Yinghai Lu
@ 2008-09-23 20:37       ` Jack Steiner
  2008-09-24  8:34         ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Jack Steiner @ 2008-09-23 20:37 UTC (permalink / raw)
  To: Yinghai Lu, mingo, tglx; +Cc: linux-kernel

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.

Signed-off-by: Jack Steiner <steiner@sgi.com>

---

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(-)

Index: linux/arch/x86/kernel/setup.c
===================================================================
--- linux.orig/arch/x86/kernel/setup.c	2008-09-23 15:15:16.000000000 -0500
+++ linux/arch/x86/kernel/setup.c	2008-09-23 15:17:16.000000000 -0500
@@ -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.
Index: linux/arch/x86/mm/srat_64.c
===================================================================
--- linux.orig/arch/x86/mm/srat_64.c	2008-09-23 15:12:20.000000000 -0500
+++ linux/arch/x86/mm/srat_64.c	2008-09-23 15:22:44.000000000 -0500
@@ -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;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] - V2 Add early detection of UV system types
  2008-09-23 20:37       ` [PATCH] - V2 " Jack Steiner
@ 2008-09-24  8:34         ` Ingo Molnar
  0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2008-09-24  8:34 UTC (permalink / raw)
  To: Jack Steiner; +Cc: Yinghai Lu, tglx, linux-kernel


* Jack Steiner <steiner@sgi.com> wrote:

> 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.
> 
> Signed-off-by: Jack Steiner <steiner@sgi.com>
> 
> ---
> 
> V2 of the patch adding fixes from Yinghai Lu.
> Much cleaner and smaller.

applied to tip/x86/uv, thanks!

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-09-24  8:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-23 18:28 [PATCH] - Add early detection of UV system types Jack Steiner
2008-09-23 18:59 ` Yinghai Lu
2008-09-23 19:30   ` Jack Steiner
2008-09-23 19:39     ` Yinghai Lu
2008-09-23 20:37       ` [PATCH] - V2 " Jack Steiner
2008-09-24  8:34         ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox