ia64/xen-unstable

changeset 5177:be52714e4727

bitkeeper revision 1.1569 (4296329bfi2iosJzMmIh7KglSdchjQ)

Clean up SMP bootstrap, and fix uniprocessor/APIC-less booting.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu May 26 20:33:31 2005 +0000 (2005-05-26)
parents 122c8adf6ca1
children 5fa5698914c1
files .rootkeys xen/arch/x86/setup.c xen/arch/x86/smpboot.c xen/include/asm-x86/mach-default/smpboot_hooks.h
line diff
     1.1 --- a/.rootkeys	Thu May 26 17:54:47 2005 +0000
     1.2 +++ b/.rootkeys	Thu May 26 20:33:31 2005 +0000
     1.3 @@ -1329,7 +1329,6 @@ 427fa2d0I3FWjE2tWdOhlEOJn7stcg xen/inclu
     1.4  427fa2d093fDS2gOBLcl7Yndzl7HmA xen/include/asm-x86/mach-default/mach_ipi.h
     1.5  427fa2d0Y7bD35d-FvDAeiJDIdRw2A xen/include/asm-x86/mach-default/mach_mpparse.h
     1.6  427fa2d0OfglYyfpDTD5DII4M0uZRw xen/include/asm-x86/mach-default/mach_wakecpu.h
     1.7 -427fa2d1EKnA8zCq2QLHiGOUqOgszg xen/include/asm-x86/mach-default/smpboot_hooks.h
     1.8  4294b5eeTwL8TeEI5pEzxvGD5obZsA xen/include/asm-x86/mach-es7000/mach_apic.h
     1.9  4294b5efhhBHJ81dsuLfJxWuN9PcDQ xen/include/asm-x86/mach-es7000/mach_apicdef.h
    1.10  4294b5efvb29X4mFAhUBdeGUPTFoBw xen/include/asm-x86/mach-es7000/mach_ipi.h
     2.1 --- a/xen/arch/x86/setup.c	Thu May 26 17:54:47 2005 +0000
     2.2 +++ b/xen/arch/x86/setup.c	Thu May 26 20:33:31 2005 +0000
     2.3 @@ -211,6 +211,9 @@ static void __init start_of_day(void)
     2.4      for_each_cpu ( i )
     2.5          cpu_set(i, cpu_present_map);
     2.6  
     2.7 +    /* Sanity: We ought to be taking interrupts by now. */
     2.8 +    local_irq_enable();
     2.9 +
    2.10      initialize_keytable();
    2.11  
    2.12      serial_init_stage2();
     3.1 --- a/xen/arch/x86/smpboot.c	Thu May 26 17:54:47 2005 +0000
     3.2 +++ b/xen/arch/x86/smpboot.c	Thu May 26 20:33:31 2005 +0000
     3.3 @@ -47,7 +47,6 @@
     3.4  #include <asm/msr.h>
     3.5  #include <mach_apic.h>
     3.6  #include <mach_wakecpu.h>
     3.7 -#include <smpboot_hooks.h>
     3.8  
     3.9  static int _foo;
    3.10  #define set_kernel_exec(x,y) (_foo=0)
    3.11 @@ -803,7 +802,13 @@ static int __init do_boot_cpu(int apicid
    3.12  
    3.13  	store_NMI_vector(&nmi_high, &nmi_low);
    3.14  
    3.15 -	smpboot_setup_warm_reset_vector(start_eip);
    3.16 +	CMOS_WRITE(0xa, 0xf);
    3.17 +	local_flush_tlb();
    3.18 +	Dprintk("1.\n");
    3.19 +	*((volatile unsigned short *) TRAMPOLINE_HIGH) = start_eip >> 4;
    3.20 +	Dprintk("2.\n");
    3.21 +	*((volatile unsigned short *) TRAMPOLINE_LOW) = start_eip & 0xf;
    3.22 +	Dprintk("3.\n");
    3.23  
    3.24  	/*
    3.25  	 * Starting actual IPI sequence...
    3.26 @@ -947,7 +952,7 @@ static void __init smp_boot_cpus(unsigne
    3.27  	 */
    3.28  	if (!smp_found_config && !acpi_lapic) {
    3.29  		printk(KERN_NOTICE "SMP motherboard not detected.\n");
    3.30 -		smpboot_clear_io_apic_irqs();
    3.31 +	init_uniprocessor:
    3.32  		phys_cpu_present_map = physid_mask_of_physid(0);
    3.33  		if (APIC_init_uniprocessor())
    3.34  			printk(KERN_NOTICE "Local APIC not detected."
    3.35 @@ -973,10 +978,7 @@ static void __init smp_boot_cpus(unsigne
    3.36  	if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid]) && !cpu_has_apic) {
    3.37  		printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
    3.38  			boot_cpu_physical_apicid);
    3.39 -		printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");
    3.40 -		smpboot_clear_io_apic_irqs();
    3.41 -		phys_cpu_present_map = physid_mask_of_physid(0);
    3.42 -		return;
    3.43 +		goto init_uniprocessor;
    3.44  	}
    3.45  
    3.46  	verify_local_APIC();
    3.47 @@ -984,13 +986,8 @@ static void __init smp_boot_cpus(unsigne
    3.48  	/*
    3.49  	 * If SMP should be disabled, then really disable it!
    3.50  	 */
    3.51 -	if (!max_cpus) {
    3.52 -		smp_found_config = 0;
    3.53 -		printk(KERN_INFO "SMP mode deactivated, forcing use of dummy APIC emulation.\n");
    3.54 -		smpboot_clear_io_apic_irqs();
    3.55 -		phys_cpu_present_map = physid_mask_of_physid(0);
    3.56 -		return;
    3.57 -	}
    3.58 +	if (!max_cpus)
    3.59 +		goto init_uniprocessor;
    3.60  
    3.61  	connect_bsp_APIC();
    3.62  	setup_local_APIC();
    3.63 @@ -1030,9 +1027,17 @@ static void __init smp_boot_cpus(unsigne
    3.64  	}
    3.65  
    3.66  	/*
    3.67 -	 * Cleanup possible dangling ends...
    3.68 +	 * Install writable page 0 entry to set BIOS data area.
    3.69  	 */
    3.70 -	smpboot_restore_warm_reset_vector();
    3.71 +	local_flush_tlb();
    3.72 +
    3.73 +	/*
    3.74 +	 * Paranoid:  Set warm reset code and vector here back
    3.75 +	 * to default values.
    3.76 +	 */
    3.77 +	CMOS_WRITE(0, 0xf);
    3.78 +
    3.79 +	*((volatile long *) phys_to_virt(0x467)) = 0;
    3.80  
    3.81  #ifdef BOGOMIPS
    3.82  	/*
    3.83 @@ -1103,7 +1108,12 @@ static void __init smp_boot_cpus(unsigne
    3.84  	if (nmi_watchdog == NMI_LOCAL_APIC)
    3.85  		check_nmi_watchdog();
    3.86  
    3.87 -	smpboot_setup_io_apic();
    3.88 +	/*
    3.89 +	 * Here we can be sure that there is an IO-APIC in the system. Let's
    3.90 +	 * go and set it up:
    3.91 +	 */
    3.92 +	if (!skip_ioapic_setup && nr_ioapics)
    3.93 +		setup_IO_APIC();
    3.94  
    3.95  	setup_boot_APIC_clock();
    3.96  
     4.1 --- a/xen/include/asm-x86/mach-default/smpboot_hooks.h	Thu May 26 17:54:47 2005 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,44 +0,0 @@
     4.4 -/* two abstractions specific to kernel/smpboot.c, mainly to cater to visws
     4.5 - * which needs to alter them. */
     4.6 -
     4.7 -static inline void smpboot_clear_io_apic_irqs(void)
     4.8 -{
     4.9 -	io_apic_irqs = 0;
    4.10 -}
    4.11 -
    4.12 -static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
    4.13 -{
    4.14 -	CMOS_WRITE(0xa, 0xf);
    4.15 -	local_flush_tlb();
    4.16 -	Dprintk("1.\n");
    4.17 -	*((volatile unsigned short *) TRAMPOLINE_HIGH) = start_eip >> 4;
    4.18 -	Dprintk("2.\n");
    4.19 -	*((volatile unsigned short *) TRAMPOLINE_LOW) = start_eip & 0xf;
    4.20 -	Dprintk("3.\n");
    4.21 -}
    4.22 -
    4.23 -static inline void smpboot_restore_warm_reset_vector(void)
    4.24 -{
    4.25 -	/*
    4.26 -	 * Install writable page 0 entry to set BIOS data area.
    4.27 -	 */
    4.28 -	local_flush_tlb();
    4.29 -
    4.30 -	/*
    4.31 -	 * Paranoid:  Set warm reset code and vector here back
    4.32 -	 * to default values.
    4.33 -	 */
    4.34 -	CMOS_WRITE(0, 0xf);
    4.35 -
    4.36 -	*((volatile long *) phys_to_virt(0x467)) = 0;
    4.37 -}
    4.38 -
    4.39 -static inline void smpboot_setup_io_apic(void)
    4.40 -{
    4.41 -	/*
    4.42 -	 * Here we can be sure that there is an IO-APIC in the system. Let's
    4.43 -	 * go and set it up:
    4.44 -	 */
    4.45 -	if (!skip_ioapic_setup && nr_ioapics)
    4.46 -		setup_IO_APIC();
    4.47 -}