x86: introduce x86_ops
PATCH 1/1 x86: introduce x86_ops
--- arch/x86/kernel/e820.c | 9 +------- arch/x86/kernel/mpparse.c | 17 ++++------------ arch/x86/kernel/setup.c | 4 +++ arch/x86/kernel/visws_quirks.c | 42 +++++++++++++++++++---------------------- arch/x86/mach-default/setup.c | 24 +++++++---------------- include/asm-x86/setup.h | 18 ++++++++++------- 6 files changed, 50 insertions(+), 64 deletions(-)
arch/x86/kernel/e820.c +2 -7
@@ -1299,11 +1299,6 @@ void __init e820_reserve_resources(void) } } -/* -* Non-standard memory setup can be specified via this quirk: -*/ -char * (*arch_memory_setup_quirk)(void ); -char *__init default_machine_specific_memory_setup (void ) {char *who ="BIOS-e820" ;
@@ -1344,8 +1339,8 @@ char *__init default_machine_specific_me char *__init __attribute__((weak)) machine_specific_memory_setup(void) { -if (arch_memory_setup_quirk) { -char *who =arch_memory_setup_quirk (); +if (x86_ops->arch_memory_setup) { +char *who = x86_ops->arch_memory_setup ();if (who)return who;
arch/x86/kernel/mpparse.c +5 -12
@@ -27,6 +27,7 @@#include <asm/bios_ebda.h> #include <asm/e820.h> #include <asm/trampoline.h> +#include <asm/setup.h> #include <mach_apic.h> #ifdef CONFIG_X86_32
@@ -728,20 +729,14 @@ static inline void __init construct_defastatic struct intel_mp_floating *mpf_found;/* -* Machine specific quirk for finding the SMP config before other setup -* activities destroy the table: -*/ -int (*mach_get_smp_config_quirk)(unsigned int early); - -/* * Scan the memory blocks for an SMP configuration block. */ static void __init __get_smp_config (unsigned int early) {struct intel_mp_floating *mpf = mpf_found; -if (mach_get_smp_config_quirk) { -if (mach_get_smp_config_quirk (early)) +if (x86_ops->mach_get_smp_config) { +if (x86_ops->mach_get_smp_config (early))return ; }if (acpi_lapic && early)
@@ -901,14 +896,12 @@ static int __init smp_scan_config(unsignreturn 0 ; } -int (*mach_find_smp_config_quirk)(unsigned int reserve); -static void __init __find_smp_config (unsigned int reserve) {unsigned int address; -if (mach_find_smp_config_quirk) { -if (mach_find_smp_config_quirk (reserve)) +if (x86_ops->mach_find_smp_config) { +if (x86_ops->mach_find_smp_config (reserve))return ; }/*
arch/x86/kernel/setup.c +4 -0
@@ -574,6 +574,10 @@ static int __init setup_elfcorehdr(charearly_param ("elfcorehdr" , setup_elfcorehdr);#endif +static struct x86_ops default_x86_ops__initdata ; + +struct x86_ops *x86_ops__initdata = &default_x86_ops; +/* * Determine if we were loaded by an EFI loader. If so, then we have also been * passed the efi memmap, systab, etc., so we should use these data structures
arch/x86/kernel/visws_quirks.c +20 -22
104 lines not on this page · raw message
arch/x86/mach-default/setup.c +8 -16
@@ -10,14 +10,6 @@#include <asm/e820.h> #include <asm/setup.h> -/* -* Any quirks to be performed to initialize timers/irqs/etc? -*/ -int (*arch_time_init_quirk)(void ); -int (*arch_pre_intr_init_quirk)(void ); -int (*arch_intr_init_quirk)(void ); -int (*arch_trap_init_quirk)(void ); -#ifdef CONFIG_HOTPLUG_CPU #define DEFAULT_SEND_IPI (1)#else
@@ -37,8 +29,8 @@ int no_broadcast=DEFAULT_SEND_IPI;**/ void __init pre_intr_init_hook (void ) { -if (arch_pre_intr_init_quirk) { -if (arch_pre_intr_init_quirk ()) +if (x86_ops->arch_pre_intr_init) { +if (x86_ops->arch_pre_intr_init ())return ; }init_ISA_irqs ();
@@ -64,8 +56,8 @@ static struct irqaction irq2 = {**/ void __init intr_init_hook (void ) { -if (arch_intr_init_quirk) { -if (arch_intr_init_quirk ()) +if (x86_ops->arch_intr_init) { +if (x86_ops->arch_intr_init ())return ; }#ifdef CONFIG_X86_LOCAL_APIC
@@ -97,8 +89,8 @@ void __init pre_setup_arch_hook(void)**/ void __init trap_init_hook (void ) { -if (arch_trap_init_quirk) { -if (arch_trap_init_quirk ()) +if (x86_ops->arch_trap_init) { +if (x86_ops->arch_trap_init ())return ; } }
@@ -119,13 +111,13 @@ static struct irqaction irq0 = {**/ void __init time_init_hook (void ) { -if (arch_time_init_quirk) { +if (x86_ops->arch_time_init) {/* * A nonzero return code does not mean failure, it means * that the architecture quirk does not want any * generic (timer) setup to be performed after this: */ -if (arch_time_init_quirk ()) +if (x86_ops->arch_time_init ())return ; }
include/asm-x86/setup.h +11 -7
@@ -19,13 +19,17 @@ static inline int is_visws_box(void) { r/* * Any setup quirks to be performed? */ -extern int (*arch_time_init_quirk)(void ); -extern int (*arch_pre_intr_init_quirk)(void ); -extern int (*arch_intr_init_quirk)(void ); -extern int (*arch_trap_init_quirk)(void ); -extern char * (*arch_memory_setup_quirk)(void ); -extern int (*mach_get_smp_config_quirk)(unsigned int early); -extern int (*mach_find_smp_config_quirk)(unsigned int reserve); +struct x86_ops { +int (*arch_time_init)(void ); +int (*arch_pre_intr_init)(void ); +int (*arch_intr_init)(void ); +int (*arch_trap_init)(void ); +char * (*arch_memory_setup)(void ); +int (*mach_get_smp_config)(unsigned int early); +int (*mach_find_smp_config)(unsigned int reserve); +}; + +extern struct x86_ops *x86_ops;#ifndef CONFIG_PARAVIRT #define paravirt_post_allocator_init () do {} while (0)
Hi Yinghai,
can you please write a short commit message explaining the benefit? Also x86_ops sounds a bit too generic for some architecture specific initialization function pointers imho.
Joerg
Quoted 326 lines · Yinghai Lu
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/kernel/e820.c | 9 +------- arch/x86/kernel/mpparse.c | 17 ++++------------ arch/x86/kernel/setup.c | 4 +++ arch/x86/kernel/visws_quirks.c | 42 +++++++++++++++++++---------------------- arch/x86/mach-default/setup.c | 24 +++++++---------------- include/asm-x86/setup.h | 18 ++++++++++------- 6 files changed, 50 insertions(+), 64 deletions(-)Index:
linux-2.6/arch/x86/kernel/e820.c
===================================================================arch/x86/kernel/e820.c +2
-7@@ -1299,11 +1299,6 @@ void __init e820_reserve_resources(void) } } -/* -* Non-standard memory setup can be specified via this quirk: -*/ -char * (*arch_memory_setup_quirk)(void ); -char *__init default_machine_specific_memory_setup (void ) {char *who ="BIOS-e820" ;@@ -1344,8 +1339,8 @@ char *__init default_machine_specific_me char *__init __attribute__((weak)) machine_specific_memory_setup(void) { -if (arch_memory_setup_quirk) { -char *who =arch_memory_setup_quirk (); +if (x86_ops->arch_memory_setup) { +char *who = x86_ops->arch_memory_setup ();if (who)return who;Index:
linux-2.6/arch/x86/kernel/mpparse.c
===================================================================arch/x86/kernel/mpparse.c +5
-12@@ -27,6 +27,7 @@#include <asm/bios_ebda.h> #include <asm/e820.h> #include <asm/trampoline.h> +#include <asm/setup.h> #include <mach_apic.h> #ifdef CONFIG_X86_32 @@ -728,20 +729,14 @@ static inline void __init construct_defastatic struct intel_mp_floating *mpf_found;/* -* Machine specific quirk for finding the SMP config before other setup -* activities destroy the table: -*/ -int (*mach_get_smp_config_quirk)(unsigned int early); - -/* * Scan the memory blocks for an SMP configuration block. */ static void __init __get_smp_config (unsigned int early) {struct intel_mp_floating *mpf = mpf_found; -if (mach_get_smp_config_quirk) { -if (mach_get_smp_config_quirk (early)) +if (x86_ops->mach_get_smp_config) { +if (x86_ops->mach_get_smp_config (early))return ; }if (acpi_lapic && early)@@ -901,14 +896,12 @@ static int __init smp_scan_config(unsignreturn 0 ; } -int (*mach_find_smp_config_quirk)(unsigned int reserve); -static void __init __find_smp_config (unsigned int reserve) {unsigned int address; -if (mach_find_smp_config_quirk) { -if (mach_find_smp_config_quirk (reserve)) +if (x86_ops->mach_find_smp_config) { +if (x86_ops->mach_find_smp_config (reserve))return ; }/* Index:
linux-2.6/arch/x86/kernel/setup.c
===================================================================arch/x86/kernel/setup.c +4
-0@@ -574,6 +574,10 @@ static int __init setup_elfcorehdr(charearly_param ("elfcorehdr" , setup_elfcorehdr);#endif +static struct x86_ops default_x86_ops__initdata ; + +struct x86_ops *x86_ops__initdata = &default_x86_ops; +/* * Determine if we were loaded by an EFI loader. If so, then we have also been * passed the efi memmap, systab, etc., so we should use these data structures Index:
linux-2.6/arch/x86/kernel/visws_quirks.c
===================================================================arch/x86/kernel/visws_quirks.c +20
-22@@ -73,7 +73,7 @@ int is_visws_box(void)return visws_board_type >=0 ; } -static int __init visws_time_init_quirk (void ) +static int __init visws_time_init (void ) {printk (KERN_INFO "Starting Cobalt Timer system clock\n" );@@ -93,7 +93,7 @@ static int __init visws_time_init_quirk(return 0 ; } -static int __init visws_pre_intr_init_quirk (void ) +static int __init visws_pre_intr_init (void ) {init_VISWS_APIC_irqs ();@@ -114,7 +114,7 @@ EXPORT_SYMBOL(sgivwfb_mem_size);long long mem_size__initdata =0 ; -static char *__init visws_memory_setup_quirk (void ) +static char *__init visws_memory_setup (void ) {long long gfx_mem_size =8 *MB ;@@ -176,7 +176,7 @@ static void visws_machine_power_off(voidoutl (PIIX_SPECIAL_STOP ,0xCFC ); } -static int __init visws_get_smp_config_quirk (unsigned int early) +static int __init visws_get_smp_config (unsigned int early) {/* * Prevent MP-table parsing by the generic code: @@ -192,7 +192,7 @@ extern unsigned int __cpuinitdata maxcpu* No problem for Linux. */ -static void __init MP_processor_info (struct mpc_config_processor *m) +static void __init MP_processor_info (struct mpc_config_processor *m) {int ver, logical_apicid;physid_mask_t apic_cpus;@@ -232,7 +232,7 @@ static void __init MP_processor_info (st apic_version[m->mpc_apicid] = ver; } -int __init visws_find_smp_config_quirk (unsigned int reserve) +static int __init visws_find_smp_config (unsigned int reserve) {struct mpc_config_processor *mp =phys_to_virt (CO_CPU_TAB_PHYS );unsigned short ncpus =readw (phys_to_virt (CO_CPU_NUM_PHYS ));@@ -258,7 +258,17 @@ int __init visws_find_smp_config_quirk(ureturn 1 ; } -extern int visws_trap_init_quirk (void ); +static int visws_trap_init (void ); + +static struct x86_ops visws_x86_ops__initdata = { + .arch_time_init = visws_time_init, + .arch_pre_intr_init = visws_pre_intr_init, + .arch_memory_setup = visws_memory_setup, + .arch_intr_init =NULL , + .arch_trap_init = visws_trap_init, + .mach_get_smp_config = visws_get_smp_config, + .mach_find_smp_config = visws_find_smp_config, +};void __init visws_early_detect (void ) {@@ -272,16 +282,10 @@ void __init visws_early_detect(void)/* * Install special quirks for timer, interrupt and memory setup: -*/ - arch_time_init_quirk = visws_time_init_quirk; - arch_pre_intr_init_quirk = visws_pre_intr_init_quirk; - arch_memory_setup_quirk = visws_memory_setup_quirk; - -/* * Fall back to generic behavior for traps: +* Override generic MP-table parsing: */ - arch_intr_init_quirk =NULL ; - arch_trap_init_quirk = visws_trap_init_quirk; + x86_ops = &visws_x86_ops;/* * Install reboot quirks: @@ -294,12 +298,6 @@ void __init visws_early_detect(void)*/ no_broadcast =0 ; -/* -* Override generic MP-table parsing: -*/ - mach_get_smp_config_quirk = visws_get_smp_config_quirk; - mach_find_smp_config_quirk = visws_find_smp_config_quirk; -#ifdef CONFIG_X86_IO_APIC /* * Turn off IO-APIC detection and initialization: @@ -426,7 +424,7 @@ static __init void cobalt_init(void) co_apic_read(CO_APIC_ID)); } -int __init visws_trap_init_quirk (void ) +static int __init visws_trap_init (void ) {lithium_init ();cobalt_init ();Index:
linux-2.6/arch/x86/mach-default/setup.c
===================================================================arch/x86/mach-default/setup.c +8
-16@@ -10,14 +10,6 @@#include <asm/e820.h> #include <asm/setup.h> -/* -* Any quirks to be performed to initialize timers/irqs/etc? -*/ -int (*arch_time_init_quirk)(void ); -int (*arch_pre_intr_init_quirk)(void ); -int (*arch_intr_init_quirk)(void ); -int (*arch_trap_init_quirk)(void ); -#ifdef CONFIG_HOTPLUG_CPU #define DEFAULT_SEND_IPI (1)#else @@ -37,8 +29,8 @@ int no_broadcast=DEFAULT_SEND_IPI;**/ void __init pre_intr_init_hook (void ) { -if (arch_pre_intr_init_quirk) { -if (arch_pre_intr_init_quirk ()) +if (x86_ops->arch_pre_intr_init) { +if (x86_ops->arch_pre_intr_init ())return ; }init_ISA_irqs ();@@ -64,8 +56,8 @@ static struct irqaction irq2 = {**/ void __init intr_init_hook (void ) { -if (arch_intr_init_quirk) { -if (arch_intr_init_quirk ()) +if (x86_ops->arch_intr_init) { +if (x86_ops->arch_intr_init ())return ; }#ifdef CONFIG_X86_LOCAL_APIC @@ -97,8 +89,8 @@ void __init pre_setup_arch_hook(void)**/ void __init trap_init_hook (void ) { -if (arch_trap_init_quirk) { -if (arch_trap_init_quirk ()) +if (x86_ops->arch_trap_init) { +if (x86_ops->arch_trap_init ())return ; } }@@ -119,13 +111,13 @@ static struct irqaction irq0 = {**/ void __init time_init_hook (void ) { -if (arch_time_init_quirk) { +if (x86_ops->arch_time_init) {/* * A nonzero return code does not mean failure, it means * that the architecture quirk does not want any * generic (timer) setup to be performed after this: */ -if (arch_time_init_quirk ()) +if (x86_ops->arch_time_init ())return ; }Index:
linux-2.6/include/asm-x86/setup.h
===================================================================include/asm-x86/setup.h +11
-8@@ -19,13 +19,17 @@ static inline int is_visws_box(void) { r/* * Any setup quirks to be performed? */ -extern int (*arch_time_init_quirk)(void ); -extern int (*arch_pre_intr_init_quirk)(void ); -extern int (*arch_intr_init_quirk)(void ); -extern int (*arch_trap_init_quirk)(void ); -extern char * (*arch_memory_setup_quirk)(void ); -extern int (*mach_get_smp_config_quirk)(unsigned int early); -extern int (*mach_find_smp_config_quirk)(unsigned int reserve); +struct x86_ops { +int (*arch_time_init)(void ); +int (*arch_pre_intr_init)(void ); +int (*arch_intr_init)(void ); +int (*arch_trap_init)(void ); +char * (*arch_memory_setup)(void ); +int (*mach_get_smp_config)(unsigned int early); +int (*mach_find_smp_config)(unsigned int reserve); +}; + +extern struct x86_ops *x86_ops;#ifndef CONFIG_PARAVIRT #define paravirt_post_allocator_init () do {} while (0) --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 5 lines · Joerg Roedel
Hi Yinghai,
can you please write a short commit message explaining the benefit? Also
x86_opssounds a bit too generic for some architecture specific initialization function pointers imho.
put all over visws_quirks in one structs, and may extend that to othat subarch
YH
Quoted 8 lines · Yinghai Lu
Quoted 5 lines · Joerg Roedel
Hi Yinghai,
can you please write a short commit message explaining the benefit? Also
x86_opssounds a bit too generic for some architecture specific initialization function pointers imho.put all over
visws_quirksin one structs, and may extend that to othat subarch
Ok, then the struct should have 'quirks' in its name maybe :)
Joerg
PATCH 1/1 x86: use x86_ops with numaq
In reply to Yinghai Lumove numaq related mps table handling to numaq_32.c
also moving calling to smp_read_mpc_oem() to smp_read_mpc directly
--- arch/x86/kernel/mpparse.c | 191 +++-------------------------- arch/x86/kernel/numaq_32.c | 190 +++++++++++++++++++++++++++- include/asm-x86/mach-generic/mach_mpspec.h | 2 include/asm-x86/setup.h | 10 + 4 files changed, 212 insertions(+), 181 deletions(-)
arch/x86/kernel/mpparse.c +21 -170
@@ -49,76 +49,6 @@ static int __init mpf_checksum(unsignedreturn sum &0xFF ; } -#ifdef CONFIG_X86_NUMAQ -int found_numaq; -/* -* Have to match translation table entries to main table entries by counter -* hence the mpc_record variable .... can't see a less disgusting way of -* doing this .... -*/ -struct mpc_config_translation { -unsigned char mpc_type; -unsigned char trans_len; -unsigned char trans_type; -unsigned char trans_quad; -unsigned char trans_global; -unsigned char trans_local; -unsigned short trans_reserved; -}; - - -static int mpc_record; -static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY ] -__cpuinitdata ; - -static inline int generate_logical_apicid (int quad,int phys_apicid) -{ -return (quad <<4 ) + (phys_apicid ? phys_apicid <<1 :1 ); -} - - -static inline int mpc_apic_id (struct mpc_config_processor *m, -struct mpc_config_translation *translation_record) -{ -int quad = translation_record->trans_quad; -int logical_apicid =generate_logical_apicid (quad, m->mpc_apicid); - -printk (KERN_DEBUG "Processor #%d %u:%u APIC version %d (quad %d, apic %d)\n" , - m->mpc_apicid, - (m->mpc_cpufeature &CPU_FAMILY_MASK ) >>8 , - (m->mpc_cpufeature &CPU_MODEL_MASK ) >>4 , - m->mpc_apicver, quad, logical_apicid); -return logical_apicid; -} - -int mp_bus_id_to_node[MAX_MP_BUSSES ]; - -int mp_bus_id_to_local[MAX_MP_BUSSES ]; - -static void mpc_oem_bus_info (struct mpc_config_bus *m,char *name, -struct mpc_config_translation *translation) -{ -int quad = translation->trans_quad; -int local = translation->trans_local; - - mp_bus_id_to_node[m->mpc_busid] = quad; - mp_bus_id_to_local[m->mpc_busid] = local; -printk (KERN_INFO "Bus #%d is %s (node %d)\n" , - m->mpc_busid, name, quad); -} - -int quad_local_to_mp_bus_id [NR_CPUS /4 ][4 ]; -static void mpc_oem_pci_bus (struct mpc_config_bus *m, -struct mpc_config_translation *translation) -{ -int quad = translation->trans_quad; -int local = translation->trans_local; - - quad_local_to_mp_bus_id[quad][local] = m->mpc_busid; -} - -#endif -static void __cpuinit MP_processor_info (struct mpc_config_processor *m) {int apicid;
@@ -128,14 +58,12 @@ static void __cpuinit MP_processor_info( disabled_cpus++;return ; } -#ifdef CONFIG_X86_NUMAQ -if (found_numaq) - apicid =mpc_apic_id (m, translation_table[mpc_record]); + +if (x86_ops->mpc_apic_id) + apicid = x86_ops->mpc_apic_id (m);else apicid = m->mpc_apicid; -#else - apicid = m->mpc_apicid; -#endif +if (m->mpc_cpuflag &CPU_BOOTPROCESSOR ) { bootup_cpu =" (Bootup-CPU)" ; boot_cpu_physical_apicid = m->mpc_apicid;
@@ -152,12 +80,10 @@ static void __init MP_bus_info(struct mpmemcpy (str, m->mpc_bustype,6 ); str[6 ] =0 ; -#ifdef CONFIG_X86_NUMAQ -if (found_numaq) -mpc_oem_bus_info (m, str, translation_table[mpc_record]); -#else -printk (KERN_INFO "Bus #%d is %s\n" , m->mpc_busid, str); -#endif +if (x86_ops->mpc_oem_bus_info) + x86_ops->mpc_oem_bus_info (m, str); +else +printk (KERN_INFO "Bus #%d is %s\n" , m->mpc_busid, str);#if MAX_MP_BUSSES <256 if (m->mpc_busid >=MAX_MP_BUSSES ) {
@@ -174,10 +100,9 @@ static void __init MP_bus_info(struct mp mp_bus_id_to_type[m->mpc_busid] =MP_BUS_ISA ;#endif }else if (strncmp (str,BUSTYPE_PCI ,sizeof (BUSTYPE_PCI ) -1 ) ==0 ) { -#ifdef CONFIG_X86_NUMAQ -if (found_numaq) -mpc_oem_pci_bus (m, translation_table[mpc_record]); -#endif +if (x86_ops->mpc_oem_pci_bus) + x86_ops->mpc_oem_pci_bus (m); +clear_bit (m->mpc_busid, mp_bus_not_pci);#if defined(CONFIG_EISA ) || defined (CONFIG_MCA ) mp_bus_id_to_type[m->mpc_busid] =MP_BUS_PCI ;
@@ -317,83 +242,6 @@ static void __init MP_lintsrc_info(struc m->mpc_srcbusirq, m->mpc_destapic, m->mpc_destapiclint); } -#ifdef CONFIG_X86_NUMAQ -static void __init MP_translation_info (struct mpc_config_translation *m) -{ -printk (KERN_INFO -"Translation: record %d, type %d, quad %d, global %d, local %d\n" , - mpc_record, m->trans_type, m->trans_quad, m->trans_global, - m->trans_local); - -if (mpc_record >=MAX_MPC_ENTRY ) -printk (KERN_ERR "MAX_MPC_ENTRY exceeded!\n" ); -else - translation_table[mpc_record] = m;/* stash this for later */ -if (m->trans_quad <MAX_NUMNODES && !node_online (m->trans_quad)) -node_set_online (m->trans_quad); -} - -/* -* Read/parse the MPC oem tables -*/ - -static void __init smp_read_mpc_oem (struct mp_config_oemtable *oemtable, -unsigned short oemsize) -{ -int count =sizeof (*oemtable);/* the header size */ -unsigned char *oemptr = ((unsigned char *)oemtable) + count; - - mpc_record =0 ; -printk (KERN_INFO "Found an OEM MPC table at %8p - parsing it ... \n" , - oemtable); -if (memcmp (oemtable->oem_signature,MPC_OEM_SIGNATURE ,4 )) { -printk (KERN_WARNING -"SMP mpc oemtable: bad signature [%c%c%c%c]!\n" , - oemtable->oem_signature[0 ], oemtable->oem_signature[1 ], - oemtable->oem_signature[2 ], oemtable->oem_signature[3 ]); -return ; - } -if (mpf_checksum ((unsigned char *)oemtable, oemtable->oem_length)) { -printk (KERN_WARNING "SMP oem mptable: checksum error!\n" ); -return ; - } -while (count < oemtable->oem_length) { -switch (*oemptr) { -case MP_TRANSLATION : - { -struct mpc_config_translation *m = - (struct mpc_config_translation *)oemptr; -MP_translation_info (m); - oemptr +=sizeof (*m); - count +=sizeof (*m); - ++mpc_record; -break ; - } -default : - { -printk (KERN_WARNING -"Unrecognised OEM table entry type! - %d\n" , - (int )*oemptr); -return ; - } - } - } -} - -void numaq_mps_oem_check (struct mp_config_table *mpc,char *oem, -char *productid) -{ -if (strncmp (oem,"IBM NUMA" ,8 )) -printk ("Warning! Not a NUMA-Q system!\n" ); -else - found_numaq =1 ; - -if (mpc->mpc_oemptr) -smp_read_mpc_oem ((struct mp_config_oemtable *)mpc->mpc_oemptr, - mpc->mpc_oemsize); -} -#endif /* CONFIG_X86_NUMAQ */ -/* * Read/parse the MPC */
@@ -458,7 +306,6 @@ static int __init smp_read_mpc(struct mp } elsemps_oem_check (mpc, oem, str);#endif -/* save the local APIC address, it might be non-default */ if (!acpi_lapic) mp_lapic_addr = mpc->mpc_lapic;
@@ -466,12 +313,17 @@ static int __init smp_read_mpc(struct mpif (early)return 1 ; +if (mpc->mpc_oemptr && x86_ops->smp_read_mpc_oem) { +struct mp_config_oemtable *oem_table = (struct mp_config_oemtable *)(unsigned long )mpc->mpc_oemptr; + x86_ops->smp_read_mpc_oem (oem_table, mpc->mpc_oemsize); + } +/* * Now process the configuration blocks. */ -#ifdef CONFIG_X86_NUMAQ - mpc_record =0 ; -#endif +if (x86_ops->mpc_record) + *x86_ops->mpc_record =0 ; +while (count < mpc->mpc_length) {switch (*mpt) {case MP_PROCESSOR :
@@ -537,9 +389,8 @@ static int __init smp_read_mpc(struct mp count = mpc->mpc_length;break ; } -#ifdef CONFIG_X86_NUMAQ - ++mpc_record; -#endif +if (x86_ops->mpc_record) + (*x86_ops->mpc_record)++; }#ifdef CONFIG_X86_GENERICARCH
arch/x86/kernel/numaq_32.c +179 -11
211 lines not on this page · raw message
include/asm-x86/mach-generic/mach_mpspec.h +2 -0
@@ -7,4 +7,6 @@/* Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets. */ #define MAX_MP_BUSSES 260 +extern void numaq_mps_oem_check (struct mp_config_table *mpc,char *oem, +char *productid);#endif /* __ASM_MACH_MPSPEC_H */
include/asm-x86/setup.h +10 -0
@@ -19,6 +19,9 @@ static inline int is_visws_box(void) { r/* * Any setup quirks to be performed? */ +struct mpc_config_processor ; +struct mpc_config_bus ; +struct mp_config_oemtable ;struct x86_ops {int (*arch_time_init)(void );int (*arch_pre_intr_init)(void );
@@ -27,6 +30,13 @@ struct x86_ops {char * (*arch_memory_setup)(void );int (*mach_get_smp_config)(unsigned int early);int (*mach_find_smp_config)(unsigned int reserve); + +int *mpc_record; +int (*mpc_apic_id)(struct mpc_config_processor *m); +void (*mpc_oem_bus_info)(struct mpc_config_bus *m,char *name); +void (*mpc_oem_pci_bus)(struct mpc_config_bus *m); +void (*smp_read_mpc_oem)(struct mp_config_oemtable *oemtable, +unsigned short oemsize); };extern struct x86_ops *x86_ops;
PATCH 1/1 x86: add pre_time_init in x86_ops
In reply to Yinghai Luso numaq could use that to call numaq_pre_time_init
--- arch/x86/kernel/numaq_32.c | 7 +++++++ arch/x86/kernel/setup.c | 8 -------- arch/x86/kernel/time_32.c | 1 + arch/x86/mach-default/setup.c | 10 ++++++++++ include/asm-x86/arch_hooks.h | 1 + include/asm-x86/setup.h | 1 + 6 files changed, 20 insertions(+), 8 deletions(-)
arch/x86/kernel/numaq_32.c +7 -0
@@ -84,6 +84,12 @@ void __init numaq_tsc_disable(void) } } +static int __init numaq_pre_time_init (void ) +{ +numaq_tsc_disable (); +return 0 ; +} +int found_numaq;/* * Have to match translation table entries to main table entries by counter
@@ -224,6 +230,7 @@ static void __init smp_read_mpc_oem(stru }static struct x86_ops numaq_x86_ops__initdata = { + .arch_pre_time_init = numaq_pre_time_init, .arch_time_init =NULL , .arch_pre_intr_init =NULL , .arch_memory_setup =NULL ,
arch/x86/kernel/setup.c +0 -8
@@ -858,14 +858,6 @@ void __init setup_arch(char **cmdline_p)init_cpu_to_node ();#endif -#ifdef CONFIG_X86_NUMAQ -/* -* need to check online nodes num, call it -* here before time_init/tsc_init -*/ -numaq_tsc_disable (); -#endif -init_apic_mappings ();ioapic_init_mappings ();
arch/x86/kernel/time_32.c +1 -0
@@ -129,6 +129,7 @@ void __init hpet_time_init(void)*/ void __init time_init (void ) { +pre_time_init_hook ();tsc_init (); late_time_init =choose_time_init (); }
arch/x86/mach-default/setup.c +10 -0
@@ -103,6 +103,16 @@ static struct irqaction irq0 = { };/** +* pre_time_init_hook - do any specific initialisations before. +* +**/ +void __init pre_time_init_hook (void ) +{ +if (x86_ops->arch_pre_time_init) + x86_ops->arch_pre_time_init (); +} + +/** * time_init_hook - do any specific initialisations for the system timer. * * Description:
include/asm-x86/arch_hooks.h +1 -0
@@ -21,6 +21,7 @@ extern void intr_init_hook(void);extern void pre_intr_init_hook (void );extern void pre_setup_arch_hook (void );extern void trap_init_hook (void ); +extern void pre_time_init_hook (void );extern void time_init_hook (void );extern void mca_nmi_hook (void );
include/asm-x86/setup.h +1 -0
@@ -23,6 +23,7 @@ struct mpc_config_processor;struct mpc_config_bus ;struct mp_config_oemtable ;struct x86_ops { +int (*arch_pre_time_init)(void );int (*arch_time_init)(void );int (*arch_pre_intr_init)(void );int (*arch_intr_init)(void );
Quoted 11 lines · Yinghai Lu
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/kernel/e820.c | 9 +------- arch/x86/kernel/mpparse.c | 17 ++++------------ arch/x86/kernel/setup.c | 4 +++ arch/x86/kernel/visws_quirks.c | 42 +++++++++++++++++++---------------------- arch/x86/mach-default/setup.c | 24 +++++++---------------- include/asm-x86/setup.h | 18 ++++++++++------- 6 files changed, 50 insertions(+), 64 deletions(-)
Quoted 1 line
+extern struct
x86_ops*x86_ops;
great cleanup!
one detail: i've renamed x86_ops to x86_quirks (and propagated the rename into your subseqent patches as well), because this is really something that is not used by normal hardware.
Ingo
Ingo Molnar
AppliedRe: [PATCH] x86: use x86_ops with numaq
In reply to Yinghai LuQuoted 5 lines · Yinghai Lu
move numaq related mps table handling to
numaq_32.calso moving calling to
smp_read_mpc_oem()tosmp_read_mpcdirectlySigned-off-by Yinghai Lu <[email protected]>
applied, thanks Yinghai. Again, very nice cleanups.
I guess we could remove mach-numaq real soon?
The APIC/IPI stuff it uses seems quite close to standard, with a few quirks.
SMP bootup details seem a bit special in mach_wakecpu.h.
Ingo
Ingo Molnar
AppliedRe: [PATCH] x86: add pre_time_init in x86_ops
In reply to Yinghai LuQuoted 3 lines · Yinghai Lu
so numaq could use that to call
numaq_pre_time_initSigned-off-by Yinghai Lu <[email protected]>
applied, thanks Yinghai.
Ingo