From fc9e733fc3b7691ad9b05d7aee1519bf049022cb Mon Sep 17 00:00:00 2001 From: "Martin J. Bligh" <mbligh@aracnet.com> Date: Mon, 6 Jan 2003 21:48:32 -0800 Subject: [PATCH] [PATCH] remove clustered_apic_mode from smpboot.c This removes clustered_apic_mode from smpboot.c into subarch, creating a headerfile "mach_wakecpu" for all the cpu wakeup stuff. This is pretty much the last of clustered_apic_mode ... ;-) --- arch/i386/kernel/smpboot.c | 47 +++++++------------- include/asm-i386/mach-default/mach_apic.h | 2 - include/asm-i386/mach-default/mach_wakecpu.h | 41 +++++++++++++++++ include/asm-i386/mach-numaq/mach_apic.h | 2 - include/asm-i386/mach-numaq/mach_wakecpu.h | 43 ++++++++++++++++++ include/asm-i386/mach-summit/mach_apic.h | 2 - include/asm-i386/smpboot.h | 15 ------- 7 files changed, 99 insertions(+), 53 deletions(-) create mode 100644 include/asm-i386/mach-default/mach_wakecpu.h create mode 100644 include/asm-i386/mach-numaq/mach_wakecpu.h diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index bc5035e814f0..f8947ebc5268 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c @@ -53,6 +53,7 @@ #include "smpboot_hooks.h" #include <mach_apic.h> +#include <mach_wakecpu.h> /* Set if we find a B stepping CPU */ static int __initdata smp_b_stepping; @@ -348,8 +349,7 @@ void __init smp_callin(void) * our local APIC. We have to wait for the IPI or we'll * lock up on an APIC access. */ - if (!clustered_apic_mode) - while (!atomic_read(&init_deasserted)); + wait_for_init_deassert(&init_deasserted); /* * (This works even if the APIC is not enabled.) @@ -398,12 +398,7 @@ void __init smp_callin(void) */ Dprintk("CALLIN, before setup_local_APIC().\n"); - /* - * Because we use NMIs rather than the INIT-STARTUP sequence to - * bootstrap the CPUs, the APIC may be in a weird state. Kick it. - */ - if (clustered_apic_mode) - clear_local_APIC(); + smp_callin_clear_local_apic(); setup_local_APIC(); map_cpu_to_logical_apicid(); @@ -555,7 +550,7 @@ void unmap_cpu_to_logical_apicid(int cpu) } #if APIC_DEBUG -static inline void inquire_remote_apic(int apicid) +static inline void __inquire_remote_apic(int apicid) { int i, regs[] = { APIC_ID >> 4, APIC_LVR >> 4, APIC_SPIV >> 4 }; char *names[] = { "ID", "VERSION", "SPIV" }; @@ -650,6 +645,15 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip) unsigned long send_status = 0, accept_status = 0; int maxlvt, timeout, num_starts, j; + /* + * Be paranoid about clearing APIC errors. + */ + if (APIC_INTEGRATED(apic_version[phys_apicid])) { + apic_read_around(APIC_SPIV); + apic_write(APIC_ESR, 0); + apic_read(APIC_ESR); + } + Dprintk("Asserting INIT.\n"); /* @@ -819,11 +823,7 @@ static int __init do_boot_cpu(int apicid) Dprintk("Setting warm reset code and vector.\n"); - if (clustered_apic_mode) { - /* stash the current NMI vector, so we can put things back */ - nmi_high = *((volatile unsigned short *) TRAMPOLINE_HIGH); - nmi_low = *((volatile unsigned short *) TRAMPOLINE_LOW); - } + store_NMI_vector(&nmi_high, &nmi_low); CMOS_WRITE(0xa, 0xf); local_flush_tlb(); @@ -833,15 +833,6 @@ static int __init do_boot_cpu(int apicid) *((volatile unsigned short *) TRAMPOLINE_LOW) = start_eip & 0xf; Dprintk("3.\n"); - /* - * Be paranoid about clearing APIC errors. - */ - if (!clustered_apic_mode && APIC_INTEGRATED(apic_version[apicid])) { - apic_read_around(APIC_SPIV); - apic_write(APIC_ESR, 0); - apic_read(APIC_ESR); - } - /* * Starting actual IPI sequence... */ @@ -879,10 +870,7 @@ static int __init do_boot_cpu(int apicid) else /* trampoline code not run */ printk("Not responding.\n"); -#if APIC_DEBUG - if (!clustered_apic_mode) - inquire_remote_apic(apicid); -#endif + inquire_remote_apic(apicid); } } if (boot_error) { @@ -896,11 +884,6 @@ static int __init do_boot_cpu(int apicid) /* mark "stuck" area as not stuck */ *((volatile unsigned long *)phys_to_virt(8192)) = 0; - if(clustered_apic_mode) { - printk("Restoring NMI vector\n"); - *((volatile unsigned short *) TRAMPOLINE_HIGH) = nmi_high; - *((volatile unsigned short *) TRAMPOLINE_LOW) = nmi_low; - } return boot_error; } diff --git a/include/asm-i386/mach-default/mach_apic.h b/include/asm-i386/mach-default/mach_apic.h index a469f8e6a614..56a355ddd5dc 100644 --- a/include/asm-i386/mach-default/mach_apic.h +++ b/include/asm-i386/mach-default/mach_apic.h @@ -78,8 +78,6 @@ static inline int mpc_apic_id(struct mpc_config_processor *m, int quad) return (m->mpc_apicid); } -#define WAKE_SECONDARY_VIA_INIT - static inline void setup_portio_remap(void) { } diff --git a/include/asm-i386/mach-default/mach_wakecpu.h b/include/asm-i386/mach-default/mach_wakecpu.h new file mode 100644 index 000000000000..673b85c9b273 --- /dev/null +++ b/include/asm-i386/mach-default/mach_wakecpu.h @@ -0,0 +1,41 @@ +#ifndef __ASM_MACH_WAKECPU_H +#define __ASM_MACH_WAKECPU_H + +/* + * This file copes with machines that wakeup secondary CPUs by the + * INIT, INIT, STARTUP sequence. + */ + +#define WAKE_SECONDARY_VIA_INIT + +#define TRAMPOLINE_LOW phys_to_virt(0x467) +#define TRAMPOLINE_HIGH phys_to_virt(0x469) + +#define boot_cpu_apicid boot_cpu_physical_apicid + +static inline void wait_for_init_deassert(atomic_t *deassert) +{ + while (!atomic_read(deassert)); + return; +} + +/* Nothing to do for most platforms, since cleared by the INIT cycle */ +static inline void smp_callin_clear_local_apic(void) +{ +} + +static inline void store_NMI_vector(unsigned short *high, unsigned short *low) +{ +} + +static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) +{ +} + +#if APIC_DEBUG + #define inquire_remote_apic(apicid) __inquire_remote_apic(apicid) +#else + #define inquire_remote_apic(apicid) {} +#endif + +#endif /* __ASM_MACH_WAKECPU_H */ diff --git a/include/asm-i386/mach-numaq/mach_apic.h b/include/asm-i386/mach-numaq/mach_apic.h index 13237f0e009f..6b9478e0029b 100644 --- a/include/asm-i386/mach-numaq/mach_apic.h +++ b/include/asm-i386/mach-numaq/mach_apic.h @@ -73,8 +73,6 @@ static inline int mpc_apic_id(struct mpc_config_processor *m, int quad) return logical_apicid; } -#define WAKE_SECONDARY_VIA_NMI - static inline void setup_portio_remap(void) { if (numnodes <= 1) diff --git a/include/asm-i386/mach-numaq/mach_wakecpu.h b/include/asm-i386/mach-numaq/mach_wakecpu.h new file mode 100644 index 000000000000..00530041a991 --- /dev/null +++ b/include/asm-i386/mach-numaq/mach_wakecpu.h @@ -0,0 +1,43 @@ +#ifndef __ASM_MACH_WAKECPU_H +#define __ASM_MACH_WAKECPU_H + +/* This file copes with machines that wakeup secondary CPUs by NMIs */ + +#define WAKE_SECONDARY_VIA_NMI + +#define TRAMPOLINE_LOW phys_to_virt(0x8) +#define TRAMPOLINE_HIGH phys_to_virt(0xa) + +#define boot_cpu_apicid boot_cpu_logical_apicid + +/* We don't do anything here because we use NMI's to boot instead */ +static inline void wait_for_init_deassert(atomic_t *deassert) +{ +} + +/* + * Because we use NMIs rather than the INIT-STARTUP sequence to + * bootstrap the CPUs, the APIC may be in a weird state. Kick it. + */ +static inline void smp_callin_clear_local_apic(void) +{ + clear_local_APIC(); +} + +static inline void store_NMI_vector(unsigned short *high, unsigned short *low) +{ + printk("Storing NMI vector\n"); + *high = *((volatile unsigned short *) TRAMPOLINE_HIGH); + *low = *((volatile unsigned short *) TRAMPOLINE_LOW); +} + +static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) +{ + printk("Restoring NMI vector\n"); + *((volatile unsigned short *) TRAMPOLINE_HIGH) = *high; + *((volatile unsigned short *) TRAMPOLINE_LOW) = *low; +} + +#define inquire_remote_apic(apicid) {} + +#endif /* __ASM_MACH_WAKECPU_H */ diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h index bf1cb85fa9cc..2d934b736af9 100644 --- a/include/asm-i386/mach-summit/mach_apic.h +++ b/include/asm-i386/mach-summit/mach_apic.h @@ -59,8 +59,6 @@ static inline unsigned long apicid_to_phys_cpu_present(int apicid) return (1ul << apicid); } -#define WAKE_SECONDARY_VIA_INIT - static inline void setup_portio_remap(void) { } diff --git a/include/asm-i386/smpboot.h b/include/asm-i386/smpboot.h index 93526764b56f..a34f4a0171bd 100644 --- a/include/asm-i386/smpboot.h +++ b/include/asm-i386/smpboot.h @@ -9,19 +9,4 @@ #endif /* CONFIG_CLUSTERED_APIC */ #endif -#ifdef CONFIG_CLUSTERED_APIC - #define TRAMPOLINE_LOW phys_to_virt(0x8) - #define TRAMPOLINE_HIGH phys_to_virt(0xa) -#else /* !CONFIG_CLUSTERED_APIC */ - #define TRAMPOLINE_LOW phys_to_virt(0x467) - #define TRAMPOLINE_HIGH phys_to_virt(0x469) -#endif /* CONFIG_CLUSTERED_APIC */ - -#ifdef CONFIG_CLUSTERED_APIC - #define boot_cpu_apicid boot_cpu_logical_apicid -#else /* !CONFIG_CLUSTERED_APIC */ - #define boot_cpu_apicid boot_cpu_physical_apicid -#endif /* CONFIG_CLUSTERED_APIC */ - - #endif -- 2.30.9