ia64/xen-unstable

changeset 2437:07ee497a8090

bitkeeper revision 1.1159.69.19 (413c2ec0U4csp-bDtIykYOqnQQWb7A)

Ensure that unsupported features don't creep into the cpu_caps array.
(without increasing the number of changed files)
author cl349@freefall.cl.cam.ac.uk
date Mon Sep 06 09:32:48 2004 +0000 (2004-09-06)
parents 8ae0831442b8
children f084fe1dc76b
files .rootkeys linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/cpu/common.c linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/bugs.h linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h
line diff
     1.1 --- a/.rootkeys	Mon Sep 06 00:06:51 2004 +0000
     1.2 +++ b/.rootkeys	Mon Sep 06 09:32:48 2004 +0000
     1.3 @@ -207,7 +207,6 @@ 405853f6nbeazrNyEWNHBuoSg2PiPA linux-2.6
     1.4  4108f5c1ppFXVpQzCOAZ6xXYubsjKA linux-2.6.8.1-xen-sparse/drivers/xen/privcmd/Makefile
     1.5  3e5a4e65IUfzzMu2kZFlGEB8-rpTaA linux-2.6.8.1-xen-sparse/drivers/xen/privcmd/privcmd.c
     1.6  412f47e4RKD-R5IS5gEXvcT8L4v8gA linux-2.6.8.1-xen-sparse/include/asm-generic/pgtable.h
     1.7 -413a6306kzex7seHlfTzg2SYiU50Dw linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/bugs.h
     1.8  40f56239YAjS52QG2FIAQpHDZAdGHg linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/desc.h
     1.9  4107adf1E5O4ztGHNGMzCCNhcvqNow linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h
    1.10  40f5623anSzpuEHgiNmQ56fIRfCoaQ linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/e820.h
     2.1 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/cpu/common.c	Mon Sep 06 00:06:51 2004 +0000
     2.2 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/cpu/common.c	Mon Sep 06 09:32:48 2004 +0000
     2.3 @@ -20,6 +20,8 @@ struct cpu_dev * cpu_devs[X86_VENDOR_NUM
     2.4  
     2.5  extern void mcheck_init(struct cpuinfo_x86 *c);
     2.6  
     2.7 +extern void machine_specific_modify_cpu_capabilities(struct cpuinfo_x86 *c);
     2.8 +
     2.9  extern int disable_pse;
    2.10  
    2.11  static void default_init(struct cpuinfo_x86 * c)
    2.12 @@ -392,6 +394,8 @@ void __init identify_cpu(struct cpuinfo_
    2.13  				c->x86_vendor, c->x86_model);
    2.14  	}
    2.15  
    2.16 +	machine_specific_modify_cpu_capabilities(c);
    2.17 +
    2.18  	/* Now the feature flags better reflect actual CPU features! */
    2.19  
    2.20  	printk(KERN_DEBUG "CPU: After all inits, caps:        %08lx %08lx %08lx %08lx\n",
     3.1 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/bugs.h	Mon Sep 06 00:06:51 2004 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,215 +0,0 @@
     3.4 -/*
     3.5 - *  include/asm-i386/bugs.h
     3.6 - *
     3.7 - *  Copyright (C) 1994  Linus Torvalds
     3.8 - *
     3.9 - *  Cyrix stuff, June 1998 by:
    3.10 - *	- Rafael R. Reilova (moved everything from head.S),
    3.11 - *        <rreilova@ececs.uc.edu>
    3.12 - *	- Channing Corn (tests & fixes),
    3.13 - *	- Andrew D. Balsa (code cleanup).
    3.14 - *
    3.15 - *  Pentium III FXSR, SSE support
    3.16 - *	Gareth Hughes <gareth@valinux.com>, May 2000
    3.17 - */
    3.18 -
    3.19 -/*
    3.20 - * This is included by init/main.c to check for architecture-dependent bugs.
    3.21 - *
    3.22 - * Needs:
    3.23 - *	void check_bugs(void);
    3.24 - */
    3.25 -
    3.26 -#include <linux/config.h>
    3.27 -#include <linux/init.h>
    3.28 -#include <asm/processor.h>
    3.29 -#include <asm/i387.h>
    3.30 -#include <asm/msr.h>
    3.31 -
    3.32 -static int __init no_halt(char *s)
    3.33 -{
    3.34 -	boot_cpu_data.hlt_works_ok = 0;
    3.35 -	return 1;
    3.36 -}
    3.37 -
    3.38 -__setup("no-hlt", no_halt);
    3.39 -
    3.40 -static int __init mca_pentium(char *s)
    3.41 -{
    3.42 -	mca_pentium_flag = 1;
    3.43 -	return 1;
    3.44 -}
    3.45 -
    3.46 -__setup("mca-pentium", mca_pentium);
    3.47 -
    3.48 -static int __init no_387(char *s)
    3.49 -{
    3.50 -	boot_cpu_data.hard_math = 0;
    3.51 -	write_cr0(0xE | read_cr0());
    3.52 -	return 1;
    3.53 -}
    3.54 -
    3.55 -__setup("no387", no_387);
    3.56 -
    3.57 -static double __initdata x = 4195835.0;
    3.58 -static double __initdata y = 3145727.0;
    3.59 -
    3.60 -/*
    3.61 - * This used to check for exceptions.. 
    3.62 - * However, it turns out that to support that,
    3.63 - * the XMM trap handlers basically had to
    3.64 - * be buggy. So let's have a correct XMM trap
    3.65 - * handler, and forget about printing out
    3.66 - * some status at boot.
    3.67 - *
    3.68 - * We should really only care about bugs here
    3.69 - * anyway. Not features.
    3.70 - */
    3.71 -static void __init check_fpu(void)
    3.72 -{
    3.73 -	if (!boot_cpu_data.hard_math) {
    3.74 -#ifndef CONFIG_MATH_EMULATION
    3.75 -		printk(KERN_EMERG "No coprocessor found and no math emulation present.\n");
    3.76 -		printk(KERN_EMERG "Giving up.\n");
    3.77 -		for (;;) ;
    3.78 -#endif
    3.79 -		return;
    3.80 -	}
    3.81 -
    3.82 -/* Enable FXSR and company _before_ testing for FP problems. */
    3.83 -	/*
    3.84 -	 * Verify that the FXSAVE/FXRSTOR data will be 16-byte aligned.
    3.85 -	 */
    3.86 -	if (offsetof(struct task_struct, thread.i387.fxsave) & 15) {
    3.87 -		extern void __buggy_fxsr_alignment(void);
    3.88 -		__buggy_fxsr_alignment();
    3.89 -	}
    3.90 -	if (cpu_has_fxsr) {
    3.91 -		printk(KERN_INFO "Enabling fast FPU save and restore... ");
    3.92 -		set_in_cr4(X86_CR4_OSFXSR);
    3.93 -		printk("done.\n");
    3.94 -	}
    3.95 -	if (cpu_has_xmm) {
    3.96 -		printk(KERN_INFO "Enabling unmasked SIMD FPU exception support... ");
    3.97 -		set_in_cr4(X86_CR4_OSXMMEXCPT);
    3.98 -		printk("done.\n");
    3.99 -	}
   3.100 -
   3.101 -	/* Test for the divl bug.. */
   3.102 -	__asm__("fninit\n\t"
   3.103 -		"fldl %1\n\t"
   3.104 -		"fdivl %2\n\t"
   3.105 -		"fmull %2\n\t"
   3.106 -		"fldl %1\n\t"
   3.107 -		"fsubp %%st,%%st(1)\n\t"
   3.108 -		"fistpl %0\n\t"
   3.109 -		"fwait\n\t"
   3.110 -		"fninit"
   3.111 -		: "=m" (*&boot_cpu_data.fdiv_bug)
   3.112 -		: "m" (*&x), "m" (*&y));
   3.113 -	if (boot_cpu_data.fdiv_bug)
   3.114 -		printk("Hmm, FPU with FDIV bug.\n");
   3.115 -}
   3.116 -
   3.117 -static void __init check_hlt(void)
   3.118 -{
   3.119 -	printk(KERN_INFO "Checking 'hlt' instruction... ");
   3.120 -	if (!boot_cpu_data.hlt_works_ok) {
   3.121 -		printk("disabled\n");
   3.122 -		return;
   3.123 -	}
   3.124 -	__asm__ __volatile__("hlt ; hlt ; hlt ; hlt");
   3.125 -	printk("OK.\n");
   3.126 -}
   3.127 -
   3.128 -/*
   3.129 - *	Most 386 processors have a bug where a POPAD can lock the 
   3.130 - *	machine even from user space.
   3.131 - */
   3.132 - 
   3.133 -static void __init check_popad(void)
   3.134 -{
   3.135 -#ifndef CONFIG_X86_POPAD_OK
   3.136 -	int res, inp = (int) &res;
   3.137 -
   3.138 -	printk(KERN_INFO "Checking for popad bug... ");
   3.139 -	__asm__ __volatile__( 
   3.140 -	  "movl $12345678,%%eax; movl $0,%%edi; pusha; popa; movl (%%edx,%%edi),%%ecx "
   3.141 -	  : "=&a" (res)
   3.142 -	  : "d" (inp)
   3.143 -	  : "ecx", "edi" );
   3.144 -	/* If this fails, it means that any user program may lock the CPU hard. Too bad. */
   3.145 -	if (res != 12345678) printk( "Buggy.\n" );
   3.146 -		        else printk( "OK.\n" );
   3.147 -#endif
   3.148 -}
   3.149 -
   3.150 -/*
   3.151 - * Check whether we are able to run this kernel safely on SMP.
   3.152 - *
   3.153 - * - In order to run on a i386, we need to be compiled for i386
   3.154 - *   (for due to lack of "invlpg" and working WP on a i386)
   3.155 - * - In order to run on anything without a TSC, we need to be
   3.156 - *   compiled for a i486.
   3.157 - * - In order to support the local APIC on a buggy Pentium machine,
   3.158 - *   we need to be compiled with CONFIG_X86_GOOD_APIC disabled,
   3.159 - *   which happens implicitly if compiled for a Pentium or lower
   3.160 - *   (unless an advanced selection of CPU features is used) as an
   3.161 - *   otherwise config implies a properly working local APIC without
   3.162 - *   the need to do extra reads from the APIC.
   3.163 -*/
   3.164 -
   3.165 -static void __init check_config(void)
   3.166 -{
   3.167 -/*
   3.168 - * We'd better not be a i386 if we're configured to use some
   3.169 - * i486+ only features! (WP works in supervisor mode and the
   3.170 - * new "invlpg" and "bswap" instructions)
   3.171 - */
   3.172 -#if defined(CONFIG_X86_WP_WORKS_OK) || defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_BSWAP)
   3.173 -	if (boot_cpu_data.x86 == 3)
   3.174 -		panic("Kernel requires i486+ for 'invlpg' and other features");
   3.175 -#endif
   3.176 -
   3.177 -/*
   3.178 - * If we configured ourselves for a TSC, we'd better have one!
   3.179 - */
   3.180 -#ifdef CONFIG_X86_TSC
   3.181 -	if (!cpu_has_tsc)
   3.182 -		panic("Kernel compiled for Pentium+, requires TSC feature!");
   3.183 -#endif
   3.184 -
   3.185 -/*
   3.186 - * If we were told we had a good local APIC, check for buggy Pentia,
   3.187 - * i.e. all B steppings and the C2 stepping of P54C when using their
   3.188 - * integrated APIC (see 11AP erratum in "Pentium Processor
   3.189 - * Specification Update").
   3.190 - */
   3.191 -#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_GOOD_APIC)
   3.192 -	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL
   3.193 -	    && cpu_has_apic
   3.194 -	    && boot_cpu_data.x86 == 5
   3.195 -	    && boot_cpu_data.x86_model == 2
   3.196 -	    && (boot_cpu_data.x86_mask < 6 || boot_cpu_data.x86_mask == 11))
   3.197 -		panic("Kernel compiled for PMMX+, assumes a local APIC without the read-before-write bug!");
   3.198 -#endif
   3.199 -}
   3.200 -
   3.201 -extern void alternative_instructions(void);
   3.202 -extern void machine_specific_modify_cpu_capabilities(void);
   3.203 -
   3.204 -static void __init check_bugs(void)
   3.205 -{
   3.206 -	identify_cpu(&boot_cpu_data);
   3.207 -	machine_specific_modify_cpu_capabilities();
   3.208 -#ifndef CONFIG_SMP
   3.209 -	printk("CPU: ");
   3.210 -	print_cpu_info(&boot_cpu_data);
   3.211 -#endif
   3.212 -	check_config();
   3.213 -	check_fpu();
   3.214 -	check_hlt();
   3.215 -	check_popad();
   3.216 -	system_utsname.machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
   3.217 -	alternative_instructions(); 
   3.218 -}
     4.1 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h	Mon Sep 06 00:06:51 2004 +0000
     4.2 +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h	Mon Sep 06 09:32:48 2004 +0000
     4.3 @@ -22,25 +22,25 @@ static char * __init machine_specific_me
     4.4  	return who;
     4.5  }
     4.6  
     4.7 +void __init machine_specific_modify_cpu_capabilities(struct cpuinfo_x86 *c)
     4.8 +{
     4.9 +	clear_bit(X86_FEATURE_VME, c->x86_capability);
    4.10 +	clear_bit(X86_FEATURE_DE, c->x86_capability);
    4.11 +	clear_bit(X86_FEATURE_PSE, c->x86_capability);
    4.12 +	clear_bit(X86_FEATURE_TSC, c->x86_capability);
    4.13 +	clear_bit(X86_FEATURE_PGE, c->x86_capability);
    4.14 +	clear_bit(X86_FEATURE_MTRR, c->x86_capability);
    4.15 +	clear_bit(X86_FEATURE_FXSR, c->x86_capability);
    4.16 +}
    4.17 +
    4.18  extern void hypervisor_callback(void);
    4.19  extern void failsafe_callback(void);
    4.20  
    4.21 -void __init machine_specific_modify_cpu_capabilities(void)
    4.22 -{
    4.23 -	clear_bit(X86_FEATURE_VME, boot_cpu_data.x86_capability);
    4.24 -	clear_bit(X86_FEATURE_DE, boot_cpu_data.x86_capability);
    4.25 -	clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability);
    4.26 -	clear_bit(X86_FEATURE_TSC, boot_cpu_data.x86_capability);
    4.27 -	clear_bit(X86_FEATURE_PGE, boot_cpu_data.x86_capability);
    4.28 -	clear_bit(X86_FEATURE_MTRR, boot_cpu_data.x86_capability);
    4.29 -	clear_bit(X86_FEATURE_FXSR, boot_cpu_data.x86_capability);
    4.30 -}
    4.31 -
    4.32  static void __init machine_specific_arch_setup(void)
    4.33  {
    4.34  	HYPERVISOR_set_callbacks(
    4.35  	    __KERNEL_CS, (unsigned long)hypervisor_callback,
    4.36  	    __KERNEL_CS, (unsigned long)failsafe_callback);
    4.37  
    4.38 -	machine_specific_modify_cpu_capabilities();
    4.39 +	machine_specific_modify_cpu_capabilities(&boot_cpu_data);
    4.40  }