From 6c39ac1fe9b851e3df4e7d2045dd9b515c4af9f9 Mon Sep 17 00:00:00 2001 From: "Martin J. Bligh" Date: Sun, 22 Dec 2002 18:20:04 -0800 Subject: [PATCH] [PATCH] more clustered-apic-mode work Code mostly originally by James Cleverdon. Abstracts out more clustered_apic_mode gunk into - ioapic_phys_id_map() - wakeup_secondary_cpu() - setup_portio_remap() --- arch/i386/kernel/io_apic.c | 7 +++---- arch/i386/kernel/smpboot.c | 16 ++-------------- include/asm-i386/mach-default/mach_apic.h | 12 ++++++++++++ include/asm-i386/mach-numaq/mach_apic.h | 20 ++++++++++++++++++++ include/asm-i386/mach-summit/mach_apic.h | 13 +++++++++++++ 5 files changed, 50 insertions(+), 18 deletions(-) diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 25a412c5557e..1e4be4e4f054 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -1135,7 +1135,7 @@ void disable_IO_APIC(void) static void __init setup_ioapic_ids_from_mpc (void) { struct IO_APIC_reg_00 reg_00; - unsigned long phys_id_present_map = phys_cpu_present_map; + unsigned long phys_id_present_map; int apic; int i; unsigned char old_id; @@ -1145,9 +1145,8 @@ static void __init setup_ioapic_ids_from_mpc (void) /* This gets done during IOAPIC enumeration for ACPI. */ return; - if (clustered_apic_mode) - /* We don't have a good way to do this yet - hack */ - phys_id_present_map = (u_long) 0xf; + phys_id_present_map = ioapic_phys_id_map(phys_cpu_present_map); + /* * Set the IOAPIC ID to the value stored in the MPC table. */ diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 9d508398bb32..4f0b998e9496 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c @@ -849,11 +849,7 @@ static void __init do_boot_cpu (int apicid) /* * Starting actual IPI sequence... */ - - if (clustered_apic_mode) - boot_error = wakeup_secondary_via_NMI(apicid); - else - boot_error = wakeup_secondary_via_INIT(apicid, start_eip); + wakeup_secondary_cpu(apicid, start_eip); if (!boot_error) { /* @@ -1061,15 +1057,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus) if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_physical_apicid) BUG(); - if (clustered_apic_mode && (numnodes > 1)) { - printk("Remapping cross-quad port I/O for %d quads\n", - numnodes); - xquad_portio = ioremap (XQUAD_PORTIO_BASE, - numnodes * XQUAD_PORTIO_QUAD); - printk("xquad_portio vaddr 0x%08lx, len %08lx\n", - (u_long) xquad_portio, - (u_long) numnodes * XQUAD_PORTIO_QUAD); - } + setup_portio_remap(); /* * Scan the CPU present map and fire up the other CPUs via do_boot_cpu diff --git a/include/asm-i386/mach-default/mach_apic.h b/include/asm-i386/mach-default/mach_apic.h index e30e38ccdf66..a24df01ffe2e 100644 --- a/include/asm-i386/mach-default/mach_apic.h +++ b/include/asm-i386/mach-default/mach_apic.h @@ -37,6 +37,11 @@ static inline void init_apic_ldr(void) apic_write_around(APIC_LDR, val); } +static inline ulong ioapic_phys_id_map(ulong phys_map) +{ + return phys_map; +} + static inline void clustered_apic_check(void) { printk("Enabling APIC mode: %s. Using %d I/O APICs\n", @@ -68,4 +73,11 @@ static inline int mpc_apic_id(struct mpc_config_processor *m, int quad) return (m->mpc_apicid); } +#define wakeup_secondary_cpu(apicid, start_eip) \ + wakeup_secondary_via_INIT(apicid, start_eip) + +static inline void setup_portio_remap(void) +{ +} + #endif /* __ASM_MACH_APIC_H */ diff --git a/include/asm-i386/mach-numaq/mach_apic.h b/include/asm-i386/mach-numaq/mach_apic.h index 2faa25de2ea7..be8eacb32aa0 100644 --- a/include/asm-i386/mach-numaq/mach_apic.h +++ b/include/asm-i386/mach-numaq/mach_apic.h @@ -31,6 +31,12 @@ static inline int multi_timer_check(int apic, int irq) return (apic != 0 && irq == 0); } +static inline ulong ioapic_phys_id_map(ulong phys_map) +{ + /* We don't have a good way to do this yet - hack */ + return 0xf; +} + static inline int cpu_present_to_apicid(int mps_cpu) { return ( ((mps_cpu/4)*16) + (1<<(mps_cpu%4)) ); @@ -63,4 +69,18 @@ static inline int mpc_apic_id(struct mpc_config_processor *m, int quad) return logical_apicid; } +#define wakeup_secondary_cpu(apicid, start_eip) \ + wakeup_secondary_via_NMI(apicid) + +static inline void setup_portio_remap(void) +{ + if (numnodes <= 1) + return; + + printk("Remapping cross-quad port I/O for %d quads\n", numnodes); + xquad_portio = ioremap (XQUAD_PORTIO_BASE, numnodes*XQUAD_PORTIO_QUAD); + printk("xquad_portio vaddr 0x%08lx, len %08lx\n", + (u_long) xquad_portio, (u_long) numnodes*XQUAD_PORTIO_QUAD); +} + #endif /* __ASM_MACH_APIC_H */ diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h index 14d4db5f8d1d..2de1e9fea7cd 100644 --- a/include/asm-i386/mach-summit/mach_apic.h +++ b/include/asm-i386/mach-summit/mach_apic.h @@ -40,6 +40,12 @@ static inline int cpu_present_to_apicid(int mps_cpu) return mps_cpu; } +static inline ulong ioapic_phys_id_map(ulong phys_map) +{ + /* For clustered we don't have a good way to do this yet - hack */ + return (x86_summit ? 0x0F : phys_map); +} + static inline unsigned long apicid_to_phys_cpu_present(int apicid) { if (x86_summit) @@ -48,4 +54,11 @@ static inline unsigned long apicid_to_phys_cpu_present(int apicid) return (1ul << apicid); } +#define wakeup_secondary_cpu(apicid, start_eip) \ + wakeup_secondary_via_INIT(apicid, start_eip) + +static inline void setup_portio_remap(void) +{ +} + #endif /* __ASM_MACH_APIC_H */ -- 2.39.5