]> err.no Git - linux-2.6/commitdiff
x86: add generic clearcpuid=... option
authorAndi Kleen <ak@suse.de>
Wed, 30 Jan 2008 12:33:21 +0000 (13:33 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:33:21 +0000 (13:33 +0100)
Add a generic option to clear any cpuid bit. I added it because it was
very easy to add with the new generic cpuid disable bitmap and perhaps
it will be useful in the future.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Documentation/kernel-parameters.txt
arch/x86/kernel/cpu/common.c
arch/x86/kernel/setup_64.c

index 040e30a33b7c5582451f95dd233d6c4692d1fe91..50d564dabb130058a5b161cde1fb6de36dc7ddff 100644 (file)
@@ -416,6 +416,19 @@ and is between 256 and 4096 characters. It is defined in the file
                        [SPARC64] tick
                        [X86-64] hpet,tsc
 
+       clearcpuid=BITNUM [X86]
+                       Disable CPUID feature X for the kernel. See
+                       include/asm-x86/cpufeature.h for the valid bit numbers.
+                       Note the Linux specific bits are not necessarily
+                       stable over kernel options, but the vendor specific
+                       ones should be.
+                       Also note that user programs calling CPUID directly
+                       or using the feature without checking anything
+                       will still see it. This just prevents it from
+                       being used by the kernel or shown in /proc/cpuinfo.
+                       Also note the kernel might malfunction if you disable
+                       some critical bits.
+
        code_bytes      [IA32/X86_64] How many bytes of object code to print
                        in an oops report.
                        Range: 0 - 8192
index 56b7ea8e6c79b2330677c20292a1f21dd2ecc34c..56cc341cc586cb6f2135eb64a120e6c92ef5caca 100644 (file)
@@ -572,6 +572,17 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
                printk("\n");
 }
 
+static __init int setup_disablecpuid(char *arg)
+{
+       int bit;
+       if (get_option(&arg, &bit) && bit < NCAPINTS*32)
+               setup_clear_cpu_cap(bit);
+       else
+               return 0;
+       return 1;
+}
+__setup("clearcpuid=", setup_disablecpuid);
+
 cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
 
 /* This is hacky. :)
index cb9b8a90c094bd83da615880939017e64fa44c19..79635b7bd57a84fe404d92dcaf49e3ad1b968db6 100644 (file)
@@ -1050,6 +1050,17 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
                printk(KERN_CONT "\n");
 }
 
+static __init int setup_disablecpuid(char *arg)
+{
+       int bit;
+       if (get_option(&arg, &bit) && bit < NCAPINTS*32)
+               setup_clear_cpu_cap(bit);
+       else
+               return 0;
+       return 1;
+}
+__setup("clearcpuid=", setup_disablecpuid);
+
 /*
  *     Get CPU information for use by the procfs.
  */