diff options
| -rw-r--r-- | arch/x86/kernel/microcode_amd.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 94213387a3d1..8fdf7d99b804 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c | |||
| @@ -202,11 +202,18 @@ static int apply_microcode_amd(int cpu) | |||
| 202 | if (mc_amd == NULL) | 202 | if (mc_amd == NULL) |
| 203 | return 0; | 203 | return 0; |
| 204 | 204 | ||
| 205 | wrmsrl(MSR_AMD64_PATCH_LOADER, (u64)(long)&mc_amd->hdr.data_code); | ||
| 206 | /* get patch id after patching */ | ||
| 207 | rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy); | 205 | rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy); |
| 208 | 206 | ||
| 209 | /* check current patch id and patch's id for match */ | 207 | /* need to apply patch? */ |
| 208 | if (rev >= mc_amd->hdr.patch_id) { | ||
| 209 | c->microcode = rev; | ||
| 210 | return 0; | ||
| 211 | } | ||
| 212 | |||
| 213 | wrmsrl(MSR_AMD64_PATCH_LOADER, (u64)(long)&mc_amd->hdr.data_code); | ||
| 214 | |||
| 215 | /* verify patch application was successful */ | ||
| 216 | rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy); | ||
| 210 | if (rev != mc_amd->hdr.patch_id) { | 217 | if (rev != mc_amd->hdr.patch_id) { |
| 211 | pr_err("CPU%d: update failed for patch_level=0x%08x\n", | 218 | pr_err("CPU%d: update failed for patch_level=0x%08x\n", |
| 212 | cpu, mc_amd->hdr.patch_id); | 219 | cpu, mc_amd->hdr.patch_id); |
