diff options
| author | Andi Kleen <ak@suse.de> | 2008-01-30 07:33:21 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:33:21 -0500 |
| commit | ac72e7888a612dccfbc15b34698aad441bdfda10 (patch) | |
| tree | abd99cb2ad8ddfd7f695bcfbe6eb9b6e1183ed3d | |
| parent | 191679fdfa63342752ff6a094a2522ae939b8d0c (diff) | |
x86: add generic clearcpuid=... option
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>
| -rw-r--r-- | Documentation/kernel-parameters.txt | 13 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/common.c | 11 | ||||
| -rw-r--r-- | arch/x86/kernel/setup_64.c | 11 |
3 files changed, 35 insertions, 0 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 040e30a33b7c..50d564dabb13 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -416,6 +416,19 @@ and is between 256 and 4096 characters. It is defined in the file | |||
| 416 | [SPARC64] tick | 416 | [SPARC64] tick |
| 417 | [X86-64] hpet,tsc | 417 | [X86-64] hpet,tsc |
| 418 | 418 | ||
| 419 | clearcpuid=BITNUM [X86] | ||
| 420 | Disable CPUID feature X for the kernel. See | ||
| 421 | include/asm-x86/cpufeature.h for the valid bit numbers. | ||
| 422 | Note the Linux specific bits are not necessarily | ||
| 423 | stable over kernel options, but the vendor specific | ||
| 424 | ones should be. | ||
| 425 | Also note that user programs calling CPUID directly | ||
| 426 | or using the feature without checking anything | ||
| 427 | will still see it. This just prevents it from | ||
| 428 | being used by the kernel or shown in /proc/cpuinfo. | ||
| 429 | Also note the kernel might malfunction if you disable | ||
| 430 | some critical bits. | ||
| 431 | |||
| 419 | code_bytes [IA32/X86_64] How many bytes of object code to print | 432 | code_bytes [IA32/X86_64] How many bytes of object code to print |
| 420 | in an oops report. | 433 | in an oops report. |
| 421 | Range: 0 - 8192 | 434 | Range: 0 - 8192 |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 56b7ea8e6c79..56cc341cc586 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
| @@ -572,6 +572,17 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) | |||
| 572 | printk("\n"); | 572 | printk("\n"); |
| 573 | } | 573 | } |
| 574 | 574 | ||
| 575 | static __init int setup_disablecpuid(char *arg) | ||
| 576 | { | ||
| 577 | int bit; | ||
| 578 | if (get_option(&arg, &bit) && bit < NCAPINTS*32) | ||
| 579 | setup_clear_cpu_cap(bit); | ||
| 580 | else | ||
| 581 | return 0; | ||
| 582 | return 1; | ||
| 583 | } | ||
| 584 | __setup("clearcpuid=", setup_disablecpuid); | ||
| 585 | |||
| 575 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; | 586 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; |
| 576 | 587 | ||
| 577 | /* This is hacky. :) | 588 | /* This is hacky. :) |
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index cb9b8a90c094..79635b7bd57a 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c | |||
| @@ -1050,6 +1050,17 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) | |||
| 1050 | printk(KERN_CONT "\n"); | 1050 | printk(KERN_CONT "\n"); |
| 1051 | } | 1051 | } |
| 1052 | 1052 | ||
| 1053 | static __init int setup_disablecpuid(char *arg) | ||
| 1054 | { | ||
| 1055 | int bit; | ||
| 1056 | if (get_option(&arg, &bit) && bit < NCAPINTS*32) | ||
| 1057 | setup_clear_cpu_cap(bit); | ||
| 1058 | else | ||
| 1059 | return 0; | ||
| 1060 | return 1; | ||
| 1061 | } | ||
| 1062 | __setup("clearcpuid=", setup_disablecpuid); | ||
| 1063 | |||
| 1053 | /* | 1064 | /* |
| 1054 | * Get CPU information for use by the procfs. | 1065 | * Get CPU information for use by the procfs. |
| 1055 | */ | 1066 | */ |
