Re: [patch 6/6] x86, apic: use .apicdrivers section to find the listof apic drivers
From: Yinghai Lu
Date: Fri May 20 2011 - 10:26:32 EST
On 05/19/2011 04:45 PM, Suresh Siddha wrote:
> --- linux-2.6-tip.orig/arch/x86/kernel/apic/apic_flat_64.c
> +++ linux-2.6-tip/arch/x86/kernel/apic/apic_flat_64.c
> @@ -24,6 +24,8 @@
> #include <acpi/acpi_bus.h>
> #endif
>
> +static struct apic apic_physflat;
> +
> static int flat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
> {
> return 1;
> @@ -164,7 +166,7 @@ static int flat_phys_pkg_id(int initial_
> return initial_apic_id >> index_msb;
> }
>
> -struct apic apic_flat = {
> +static struct apic apic_flat = {
> .name = "flat",
> .probe = NULL,
> .acpi_madt_oem_check = flat_acpi_madt_oem_check,
> @@ -320,7 +322,7 @@ static int physflat_probe(void)
> return 0;
> }
>
> -struct apic apic_physflat = {
> +static struct apic apic_physflat = {
>
> .name = "physical flat",
> .probe = physflat_probe,
> @@ -377,3 +379,8 @@ struct apic apic_physflat = {
> .wait_icr_idle = native_apic_wait_icr_idle,
> .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
> };
> +
> +/*
> + * We need to check for physflat first, so this order is important.
> + */
> +apic_drivers(apic_physflat, apic_flat);
> Index: linux-2.6-tip/arch/x86/kernel/apic/probe_64.c
> ===================================================================
> --- linux-2.6-tip.orig/arch/x86/kernel/apic/probe_64.c
> +++ linux-2.6-tip/arch/x86/kernel/apic/probe_64.c
> @@ -23,27 +23,9 @@
> #include <asm/ipi.h>
> #include <asm/setup.h>
>
> -extern struct apic apic_flat;
> -extern struct apic apic_physflat;
> -extern struct apic apic_x2xpic_uv_x;
> -extern struct apic apic_x2apic_phys;
> -extern struct apic apic_x2apic_cluster;
> -
> -struct apic __read_mostly *apic = &apic_flat;
> +struct apic __read_mostly *apic;
> EXPORT_SYMBOL_GPL(apic);
>
> -static struct apic *apic_probe[] __initdata = {
> -#ifdef CONFIG_X86_UV
> - &apic_x2apic_uv_x,
> -#endif
> -#ifdef CONFIG_X86_X2APIC
> - &apic_x2apic_phys,
> - &apic_x2apic_cluster,
> -#endif
> - &apic_physflat,
> - NULL,
> -};
> -
> static int apicid_phys_pkg_id(int initial_apic_id, int index_msb)
> {
> return hard_smp_processor_id() >> index_msb;
> @@ -54,19 +36,19 @@ static int apicid_phys_pkg_id(int initia
> */
> void __init default_setup_apic_routing(void)
> {
> - int i;
> + struct apic **drv;
>
> enable_IR_x2apic();
>
> - for (i = 0; apic_probe[i]; ++i) {
> - if (apic_probe[i]->probe()) {
> - apic = apic_probe[i];
> + for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) {
> + if ((*drv)->probe()) {
> + apic = *drv;
> + printk(KERN_INFO "APIC routing finalized to %s.\n",
> + apic->name);
> break;
> }
> }
can you change to:
+ for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) {
+ if ((*drv)->probe()) {
+ if (apic != *drv) {
+ apic = *drv;
+ printk(KERN_INFO "Changing APIC routing to %s.\n",
+ apic->name);
+ }
break;
}
}
Thanks
Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/