mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
* Allow clearcpuid= to accept multiple bits, by Arvind Sankar.
* Move clearcpuid= parameter handling earlier in the boot, away from the FPU init code and to a generic location, by Mike Hommey. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAl+ENF4ACgkQEsHwGGHe VUqZ/BAAvRNhqmvYznS7V1FGJka7noumkxSg/E3ecUnQ9mLXuJlp/k4HVDVq/sEa 8tOXF10snObOy9BlUhpWsT+jUyPz5kNe1h67x9wYOIWq2wO2rkw54Bi7/ZKar0Ik E93TfiBf8xeas/96Cb6/JgwPzleeLMA6GOcd0cCmFjp++DBw1ydU2ouH2/llKhdT 76eff4ZDvPMwuIaDRSQHY9XHX9mr55TmkVXoxkIilt3YOVE5Ap/Pz+sI0AiD6fJu DS82EubaCCtaMe2K+lFpq9v3l9sVzR0TTS9hf2uG+M8YpdQdzEU63WPZlXr5tVTH VReDJEo23Vp3Yy+4u+Ph4CPCa24vjyG5bg1eAYVwyAperelLhsW81tnz6DMaYT3u NBK5dL0qFZJkIM07rn5Cg/1lGARmidovvYcojwroq/bfNUK5Xxu7Dh+5IIW865Jr RrqwZkeWR1xXj4G97ICeKZsr1tGRHiLqPow/BXVeFRQxu7qHAQbdyF6tGFJpB/Nh QaVVeeUr2r+Qyhghd/vg8d3EQDbSYgfxx/8nLB2G4vyNpIIBGeNUo9OptgMnNgr1 44nkQ3qX8VXSz9scTGtW5M2FrO7OfwD5V2V737gsmAb63MHCSORxcFMhKahd63l1 teji0jtpZuOaguCwn+ZAjaDb8FqIOn26vybtd8jC4tzD9Qngt3w= =lvdt -----END PGP SIGNATURE----- Merge tag 'x86_fpu_for_v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull x86 fpu updates from Borislav Petkov: - Allow clearcpuid= to accept multiple bits (Arvind Sankar) - Move clearcpuid= parameter handling earlier in the boot, away from the FPU init code and to a generic location (Mike Hommey) * tag 'x86_fpu_for_v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/fpu: Handle FPU-related and clearcpuid command line arguments earlier x86/fpu: Allow multiple bits in clearcpuid= parameter
This commit is contained in:
commit
a0d445f70c
@ -577,7 +577,7 @@
|
||||
loops can be debugged more effectively on production
|
||||
systems.
|
||||
|
||||
clearcpuid=BITNUM [X86]
|
||||
clearcpuid=BITNUM[,BITNUM...] [X86]
|
||||
Disable CPUID feature X for the kernel. See
|
||||
arch/x86/include/asm/cpufeatures.h for the valid bit
|
||||
numbers. Note the Linux specific bits are not necessarily
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <linux/syscore_ops.h>
|
||||
#include <linux/pgtable.h>
|
||||
|
||||
#include <asm/cmdline.h>
|
||||
#include <asm/stackprotector.h>
|
||||
#include <asm/perf_event.h>
|
||||
#include <asm/mmu_context.h>
|
||||
@ -1220,6 +1221,59 @@ static void detect_nopl(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* We parse cpu parameters early because fpu__init_system() is executed
|
||||
* before parse_early_param().
|
||||
*/
|
||||
static void __init cpu_parse_early_param(void)
|
||||
{
|
||||
char arg[128];
|
||||
char *argptr = arg;
|
||||
int arglen, res, bit;
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
if (cmdline_find_option_bool(boot_command_line, "no387"))
|
||||
#ifdef CONFIG_MATH_EMULATION
|
||||
setup_clear_cpu_cap(X86_FEATURE_FPU);
|
||||
#else
|
||||
pr_err("Option 'no387' required CONFIG_MATH_EMULATION enabled.\n");
|
||||
#endif
|
||||
|
||||
if (cmdline_find_option_bool(boot_command_line, "nofxsr"))
|
||||
setup_clear_cpu_cap(X86_FEATURE_FXSR);
|
||||
#endif
|
||||
|
||||
if (cmdline_find_option_bool(boot_command_line, "noxsave"))
|
||||
setup_clear_cpu_cap(X86_FEATURE_XSAVE);
|
||||
|
||||
if (cmdline_find_option_bool(boot_command_line, "noxsaveopt"))
|
||||
setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
|
||||
|
||||
if (cmdline_find_option_bool(boot_command_line, "noxsaves"))
|
||||
setup_clear_cpu_cap(X86_FEATURE_XSAVES);
|
||||
|
||||
arglen = cmdline_find_option(boot_command_line, "clearcpuid", arg, sizeof(arg));
|
||||
if (arglen <= 0)
|
||||
return;
|
||||
|
||||
pr_info("Clearing CPUID bits:");
|
||||
do {
|
||||
res = get_option(&argptr, &bit);
|
||||
if (res == 0 || res == 3)
|
||||
break;
|
||||
|
||||
/* If the argument was too long, the last bit may be cut off */
|
||||
if (res == 1 && arglen >= sizeof(arg))
|
||||
break;
|
||||
|
||||
if (bit >= 0 && bit < NCAPINTS * 32) {
|
||||
pr_cont(" " X86_CAP_FMT, x86_cap_flag(bit));
|
||||
setup_clear_cpu_cap(bit);
|
||||
}
|
||||
} while (res == 2);
|
||||
pr_cont("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Do minimum CPU detection early.
|
||||
* Fields really needed: vendor, cpuid_level, family, model, mask,
|
||||
@ -1255,6 +1309,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
|
||||
get_cpu_cap(c);
|
||||
get_cpu_address_sizes(c);
|
||||
setup_force_cpu_cap(X86_FEATURE_CPUID);
|
||||
cpu_parse_early_param();
|
||||
|
||||
if (this_cpu->c_early_init)
|
||||
this_cpu->c_early_init(c);
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <asm/fpu/internal.h>
|
||||
#include <asm/tlbflush.h>
|
||||
#include <asm/setup.h>
|
||||
#include <asm/cmdline.h>
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/sched/task.h>
|
||||
@ -237,52 +236,12 @@ static void __init fpu__init_system_ctx_switch(void)
|
||||
on_boot_cpu = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* We parse fpu parameters early because fpu__init_system() is executed
|
||||
* before parse_early_param().
|
||||
*/
|
||||
static void __init fpu__init_parse_early_param(void)
|
||||
{
|
||||
char arg[32];
|
||||
char *argptr = arg;
|
||||
int bit;
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
if (cmdline_find_option_bool(boot_command_line, "no387"))
|
||||
#ifdef CONFIG_MATH_EMULATION
|
||||
setup_clear_cpu_cap(X86_FEATURE_FPU);
|
||||
#else
|
||||
pr_err("Option 'no387' required CONFIG_MATH_EMULATION enabled.\n");
|
||||
#endif
|
||||
|
||||
if (cmdline_find_option_bool(boot_command_line, "nofxsr"))
|
||||
setup_clear_cpu_cap(X86_FEATURE_FXSR);
|
||||
#endif
|
||||
|
||||
if (cmdline_find_option_bool(boot_command_line, "noxsave"))
|
||||
setup_clear_cpu_cap(X86_FEATURE_XSAVE);
|
||||
|
||||
if (cmdline_find_option_bool(boot_command_line, "noxsaveopt"))
|
||||
setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
|
||||
|
||||
if (cmdline_find_option_bool(boot_command_line, "noxsaves"))
|
||||
setup_clear_cpu_cap(X86_FEATURE_XSAVES);
|
||||
|
||||
if (cmdline_find_option(boot_command_line, "clearcpuid", arg,
|
||||
sizeof(arg)) &&
|
||||
get_option(&argptr, &bit) &&
|
||||
bit >= 0 &&
|
||||
bit < NCAPINTS * 32)
|
||||
setup_clear_cpu_cap(bit);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called on the boot CPU once per system bootup, to set up the initial
|
||||
* FPU state that is later cloned into all processes:
|
||||
*/
|
||||
void __init fpu__init_system(struct cpuinfo_x86 *c)
|
||||
{
|
||||
fpu__init_parse_early_param();
|
||||
fpu__init_system_early_generic(c);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user