diff options
author | Borislav Petkov <bp@suse.de> | 2014-12-01 05:12:21 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-12-01 05:51:05 -0500 |
commit | 2ef84b3bb97f03332f0c1edb4466b1750dcf97b5 (patch) | |
tree | ad10420bec232c18c734b9100984794844574b15 /arch | |
parent | 009d0431c3914de64666bec0d350e54fdd59df6a (diff) |
x86, microcode, AMD: Do not use smp_processor_id() in preemtible context
Hand down the cpu number instead, otherwise lockdep screams when doing
echo 1 > /sys/devices/system/cpu/microcode/reload.
BUG: using smp_processor_id() in preemptible [00000000] code: amd64-microcode/2470
caller is debug_smp_processor_id+0x12/0x20
CPU: 1 PID: 2470 Comm: amd64-microcode Not tainted 3.18.0-rc6+ #26
...
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1417428741-4501-1-git-send-email-bp@alien8.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/microcode_amd.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/microcode/amd.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/microcode/amd_early.c | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h index b7b10b82d3e5..48a48024ebe4 100644 --- a/arch/x86/include/asm/microcode_amd.h +++ b/arch/x86/include/asm/microcode_amd.h | |||
@@ -59,7 +59,7 @@ static inline u16 find_equiv_id(struct equiv_cpu_entry *equiv_cpu_table, | |||
59 | 59 | ||
60 | extern int __apply_microcode_amd(struct microcode_amd *mc_amd); | 60 | extern int __apply_microcode_amd(struct microcode_amd *mc_amd); |
61 | extern int apply_microcode_amd(int cpu); | 61 | extern int apply_microcode_amd(int cpu); |
62 | extern enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t size); | 62 | extern enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size); |
63 | 63 | ||
64 | #define PATCH_MAX_SIZE PAGE_SIZE | 64 | #define PATCH_MAX_SIZE PAGE_SIZE |
65 | extern u8 amd_ucode_patch[PATCH_MAX_SIZE]; | 65 | extern u8 amd_ucode_patch[PATCH_MAX_SIZE]; |
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index 8fffd845e22b..bfbbe6195e2d 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c | |||
@@ -376,7 +376,7 @@ static enum ucode_state __load_microcode_amd(u8 family, const u8 *data, | |||
376 | return UCODE_OK; | 376 | return UCODE_OK; |
377 | } | 377 | } |
378 | 378 | ||
379 | enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t size) | 379 | enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size) |
380 | { | 380 | { |
381 | enum ucode_state ret; | 381 | enum ucode_state ret; |
382 | 382 | ||
@@ -390,8 +390,8 @@ enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t size) | |||
390 | 390 | ||
391 | #if defined(CONFIG_MICROCODE_AMD_EARLY) && defined(CONFIG_X86_32) | 391 | #if defined(CONFIG_MICROCODE_AMD_EARLY) && defined(CONFIG_X86_32) |
392 | /* save BSP's matching patch for early load */ | 392 | /* save BSP's matching patch for early load */ |
393 | if (cpu_data(smp_processor_id()).cpu_index == boot_cpu_data.cpu_index) { | 393 | if (cpu_data(cpu).cpu_index == boot_cpu_data.cpu_index) { |
394 | struct ucode_patch *p = find_patch(smp_processor_id()); | 394 | struct ucode_patch *p = find_patch(cpu); |
395 | if (p) { | 395 | if (p) { |
396 | memset(amd_ucode_patch, 0, PATCH_MAX_SIZE); | 396 | memset(amd_ucode_patch, 0, PATCH_MAX_SIZE); |
397 | memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data), | 397 | memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data), |
@@ -444,7 +444,7 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device, | |||
444 | goto fw_release; | 444 | goto fw_release; |
445 | } | 445 | } |
446 | 446 | ||
447 | ret = load_microcode_amd(c->x86, fw->data, fw->size); | 447 | ret = load_microcode_amd(cpu, c->x86, fw->data, fw->size); |
448 | 448 | ||
449 | fw_release: | 449 | fw_release: |
450 | release_firmware(fw); | 450 | release_firmware(fw); |
diff --git a/arch/x86/kernel/cpu/microcode/amd_early.c b/arch/x86/kernel/cpu/microcode/amd_early.c index 06674473b0e6..3d988a30a21d 100644 --- a/arch/x86/kernel/cpu/microcode/amd_early.c +++ b/arch/x86/kernel/cpu/microcode/amd_early.c | |||
@@ -389,7 +389,7 @@ int __init save_microcode_in_initrd_amd(void) | |||
389 | eax = cpuid_eax(0x00000001); | 389 | eax = cpuid_eax(0x00000001); |
390 | eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); | 390 | eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); |
391 | 391 | ||
392 | ret = load_microcode_amd(eax, container, container_size); | 392 | ret = load_microcode_amd(smp_processor_id(), eax, container, container_size); |
393 | if (ret != UCODE_OK) | 393 | if (ret != UCODE_OK) |
394 | retval = -EINVAL; | 394 | retval = -EINVAL; |
395 | 395 | ||