提交 f2a025de 编写于 作者: L Linus Torvalds

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
 "Misc fixes:

   - revert a broken PAT commit that broke a number of systems

   - fix two preemptability warnings/bugs that can trigger under certain
     circumstances, in the debug code and in the microcode loader"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  Revert "x86/PAT: Fix Xorg regression on CPUs that don't support PAT"
  x86/debug/32: Convert a smp_processor_id() call to raw to avoid DEBUG_PREEMPT warning
  x86/microcode/AMD: Change load_microcode_amd()'s param to bool to fix preemptibility bug
...@@ -320,7 +320,7 @@ void load_ucode_amd_ap(unsigned int cpuid_1_eax) ...@@ -320,7 +320,7 @@ void load_ucode_amd_ap(unsigned int cpuid_1_eax)
} }
static enum ucode_state static enum ucode_state
load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size); load_microcode_amd(bool save, u8 family, const u8 *data, size_t size);
int __init save_microcode_in_initrd_amd(unsigned int cpuid_1_eax) int __init save_microcode_in_initrd_amd(unsigned int cpuid_1_eax)
{ {
...@@ -338,8 +338,7 @@ int __init save_microcode_in_initrd_amd(unsigned int cpuid_1_eax) ...@@ -338,8 +338,7 @@ int __init save_microcode_in_initrd_amd(unsigned int cpuid_1_eax)
if (!desc.mc) if (!desc.mc)
return -EINVAL; return -EINVAL;
ret = load_microcode_amd(smp_processor_id(), x86_family(cpuid_1_eax), ret = load_microcode_amd(true, x86_family(cpuid_1_eax), desc.data, desc.size);
desc.data, desc.size);
if (ret != UCODE_OK) if (ret != UCODE_OK)
return -EINVAL; return -EINVAL;
...@@ -675,7 +674,7 @@ static enum ucode_state __load_microcode_amd(u8 family, const u8 *data, ...@@ -675,7 +674,7 @@ static enum ucode_state __load_microcode_amd(u8 family, const u8 *data,
} }
static enum ucode_state static enum ucode_state
load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size) load_microcode_amd(bool save, u8 family, const u8 *data, size_t size)
{ {
enum ucode_state ret; enum ucode_state ret;
...@@ -689,8 +688,8 @@ load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size) ...@@ -689,8 +688,8 @@ load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size)
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
/* save BSP's matching patch for early load */ /* save BSP's matching patch for early load */
if (cpu_data(cpu).cpu_index == boot_cpu_data.cpu_index) { if (save) {
struct ucode_patch *p = find_patch(cpu); struct ucode_patch *p = find_patch(0);
if (p) { if (p) {
memset(amd_ucode_patch, 0, PATCH_MAX_SIZE); memset(amd_ucode_patch, 0, PATCH_MAX_SIZE);
memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data), memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data),
...@@ -722,11 +721,12 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device, ...@@ -722,11 +721,12 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device,
{ {
char fw_name[36] = "amd-ucode/microcode_amd.bin"; char fw_name[36] = "amd-ucode/microcode_amd.bin";
struct cpuinfo_x86 *c = &cpu_data(cpu); struct cpuinfo_x86 *c = &cpu_data(cpu);
bool bsp = c->cpu_index == boot_cpu_data.cpu_index;
enum ucode_state ret = UCODE_NFOUND; enum ucode_state ret = UCODE_NFOUND;
const struct firmware *fw; const struct firmware *fw;
/* reload ucode container only on the boot cpu */ /* reload ucode container only on the boot cpu */
if (!refresh_fw || c->cpu_index != boot_cpu_data.cpu_index) if (!refresh_fw || !bsp)
return UCODE_OK; return UCODE_OK;
if (c->x86 >= 0x15) if (c->x86 >= 0x15)
...@@ -743,7 +743,7 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device, ...@@ -743,7 +743,7 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device,
goto fw_release; goto fw_release;
} }
ret = load_microcode_amd(cpu, c->x86, fw->data, fw->size); ret = load_microcode_amd(bsp, c->x86, fw->data, fw->size);
fw_release: fw_release:
release_firmware(fw); release_firmware(fw);
......
...@@ -78,7 +78,7 @@ void __show_regs(struct pt_regs *regs, int all) ...@@ -78,7 +78,7 @@ void __show_regs(struct pt_regs *regs, int all)
printk(KERN_DEFAULT "EIP: %pS\n", (void *)regs->ip); printk(KERN_DEFAULT "EIP: %pS\n", (void *)regs->ip);
printk(KERN_DEFAULT "EFLAGS: %08lx CPU: %d\n", regs->flags, printk(KERN_DEFAULT "EFLAGS: %08lx CPU: %d\n", regs->flags,
smp_processor_id()); raw_smp_processor_id());
printk(KERN_DEFAULT "EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", printk(KERN_DEFAULT "EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
regs->ax, regs->bx, regs->cx, regs->dx); regs->ax, regs->bx, regs->cx, regs->dx);
......
...@@ -65,11 +65,9 @@ static int __init nopat(char *str) ...@@ -65,11 +65,9 @@ static int __init nopat(char *str)
} }
early_param("nopat", nopat); early_param("nopat", nopat);
static bool __read_mostly __pat_initialized = false;
bool pat_enabled(void) bool pat_enabled(void)
{ {
return __pat_initialized; return !!__pat_enabled;
} }
EXPORT_SYMBOL_GPL(pat_enabled); EXPORT_SYMBOL_GPL(pat_enabled);
...@@ -227,14 +225,13 @@ static void pat_bsp_init(u64 pat) ...@@ -227,14 +225,13 @@ static void pat_bsp_init(u64 pat)
} }
wrmsrl(MSR_IA32_CR_PAT, pat); wrmsrl(MSR_IA32_CR_PAT, pat);
__pat_initialized = true;
__init_cache_modes(pat); __init_cache_modes(pat);
} }
static void pat_ap_init(u64 pat) static void pat_ap_init(u64 pat)
{ {
if (!this_cpu_has(X86_FEATURE_PAT)) { if (!boot_cpu_has(X86_FEATURE_PAT)) {
/* /*
* If this happens we are on a secondary CPU, but switched to * If this happens we are on a secondary CPU, but switched to
* PAT on the boot CPU. We have no way to undo PAT. * PAT on the boot CPU. We have no way to undo PAT.
...@@ -309,7 +306,7 @@ void pat_init(void) ...@@ -309,7 +306,7 @@ void pat_init(void)
u64 pat; u64 pat;
struct cpuinfo_x86 *c = &boot_cpu_data; struct cpuinfo_x86 *c = &boot_cpu_data;
if (!__pat_enabled) { if (!pat_enabled()) {
init_cache_modes(); init_cache_modes();
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册