diff options
Diffstat (limited to 'arch/x86/kernel')
| -rw-r--r-- | arch/x86/kernel/cpu/Makefile | 2 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/bugs.c | 4 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/mce/core.c | 1 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/microcode/amd.c | 2 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/resctrl/Makefile | 4 | ||||
| -rw-r--r-- | arch/x86/kernel/crash.c | 1 | ||||
| -rw-r--r-- | arch/x86/kernel/hpet.c | 4 | ||||
| -rw-r--r-- | arch/x86/kernel/kexec-bzimage64.c | 5 | ||||
| -rw-r--r-- | arch/x86/kernel/kvm.c | 7 | ||||
| -rw-r--r-- | arch/x86/kernel/tsc.c | 30 |
10 files changed, 34 insertions, 26 deletions
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index ac78f90aea56..cfd24f9f7614 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile | |||
| @@ -39,7 +39,7 @@ obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o | |||
| 39 | obj-$(CONFIG_X86_MCE) += mce/ | 39 | obj-$(CONFIG_X86_MCE) += mce/ |
| 40 | obj-$(CONFIG_MTRR) += mtrr/ | 40 | obj-$(CONFIG_MTRR) += mtrr/ |
| 41 | obj-$(CONFIG_MICROCODE) += microcode/ | 41 | obj-$(CONFIG_MICROCODE) += microcode/ |
| 42 | obj-$(CONFIG_RESCTRL) += resctrl/ | 42 | obj-$(CONFIG_X86_CPU_RESCTRL) += resctrl/ |
| 43 | 43 | ||
| 44 | obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o | 44 | obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o |
| 45 | 45 | ||
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 8654b8b0c848..01874d54f4fd 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c | |||
| @@ -71,7 +71,7 @@ void __init check_bugs(void) | |||
| 71 | * identify_boot_cpu() initialized SMT support information, let the | 71 | * identify_boot_cpu() initialized SMT support information, let the |
| 72 | * core code know. | 72 | * core code know. |
| 73 | */ | 73 | */ |
| 74 | cpu_smt_check_topology_early(); | 74 | cpu_smt_check_topology(); |
| 75 | 75 | ||
| 76 | if (!IS_ENABLED(CONFIG_SMP)) { | 76 | if (!IS_ENABLED(CONFIG_SMP)) { |
| 77 | pr_info("CPU: "); | 77 | pr_info("CPU: "); |
| @@ -215,7 +215,7 @@ static enum spectre_v2_mitigation spectre_v2_enabled __ro_after_init = | |||
| 215 | static enum spectre_v2_user_mitigation spectre_v2_user __ro_after_init = | 215 | static enum spectre_v2_user_mitigation spectre_v2_user __ro_after_init = |
| 216 | SPECTRE_V2_USER_NONE; | 216 | SPECTRE_V2_USER_NONE; |
| 217 | 217 | ||
| 218 | #ifdef RETPOLINE | 218 | #ifdef CONFIG_RETPOLINE |
| 219 | static bool spectre_v2_bad_module; | 219 | static bool spectre_v2_bad_module; |
| 220 | 220 | ||
| 221 | bool retpoline_module_ok(bool has_retpoline) | 221 | bool retpoline_module_ok(bool has_retpoline) |
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 672c7225cb1b..6ce290c506d9 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c | |||
| @@ -784,6 +784,7 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, | |||
| 784 | quirk_no_way_out(i, m, regs); | 784 | quirk_no_way_out(i, m, regs); |
| 785 | 785 | ||
| 786 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { | 786 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { |
| 787 | m->bank = i; | ||
| 787 | mce_read_aux(m, i); | 788 | mce_read_aux(m, i); |
| 788 | *msg = tmp; | 789 | *msg = tmp; |
| 789 | return 1; | 790 | return 1; |
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index 51adde0a0f1a..e1f3ba19ba54 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c | |||
| @@ -855,7 +855,7 @@ load_microcode_amd(bool save, u8 family, const u8 *data, size_t size) | |||
| 855 | if (!p) { | 855 | if (!p) { |
| 856 | return ret; | 856 | return ret; |
| 857 | } else { | 857 | } else { |
| 858 | if (boot_cpu_data.microcode == p->patch_id) | 858 | if (boot_cpu_data.microcode >= p->patch_id) |
| 859 | return ret; | 859 | return ret; |
| 860 | 860 | ||
| 861 | ret = UCODE_NEW; | 861 | ret = UCODE_NEW; |
diff --git a/arch/x86/kernel/cpu/resctrl/Makefile b/arch/x86/kernel/cpu/resctrl/Makefile index 6895049ceef7..4a06c37b9cf1 100644 --- a/arch/x86/kernel/cpu/resctrl/Makefile +++ b/arch/x86/kernel/cpu/resctrl/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | obj-$(CONFIG_RESCTRL) += core.o rdtgroup.o monitor.o | 2 | obj-$(CONFIG_X86_CPU_RESCTRL) += core.o rdtgroup.o monitor.o |
| 3 | obj-$(CONFIG_RESCTRL) += ctrlmondata.o pseudo_lock.o | 3 | obj-$(CONFIG_X86_CPU_RESCTRL) += ctrlmondata.o pseudo_lock.o |
| 4 | CFLAGS_pseudo_lock.o = -I$(src) | 4 | CFLAGS_pseudo_lock.o = -I$(src) |
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index c8b07d8ea5a2..17ffc869cab8 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c | |||
| @@ -470,6 +470,7 @@ int crash_load_segments(struct kimage *image) | |||
| 470 | 470 | ||
| 471 | kbuf.memsz = kbuf.bufsz; | 471 | kbuf.memsz = kbuf.bufsz; |
| 472 | kbuf.buf_align = ELF_CORE_HEADER_ALIGN; | 472 | kbuf.buf_align = ELF_CORE_HEADER_ALIGN; |
| 473 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | ||
| 473 | ret = kexec_add_buffer(&kbuf); | 474 | ret = kexec_add_buffer(&kbuf); |
| 474 | if (ret) { | 475 | if (ret) { |
| 475 | vfree((void *)image->arch.elf_headers); | 476 | vfree((void *)image->arch.elf_headers); |
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index b0acb22e5a46..dfd3aca82c61 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
| @@ -21,10 +21,6 @@ | |||
| 21 | 21 | ||
| 22 | #define HPET_MASK CLOCKSOURCE_MASK(32) | 22 | #define HPET_MASK CLOCKSOURCE_MASK(32) |
| 23 | 23 | ||
| 24 | /* FSEC = 10^-15 | ||
| 25 | NSEC = 10^-9 */ | ||
| 26 | #define FSEC_PER_NSEC 1000000L | ||
| 27 | |||
| 28 | #define HPET_DEV_USED_BIT 2 | 24 | #define HPET_DEV_USED_BIT 2 |
| 29 | #define HPET_DEV_USED (1 << HPET_DEV_USED_BIT) | 25 | #define HPET_DEV_USED (1 << HPET_DEV_USED_BIT) |
| 30 | #define HPET_DEV_VALID 0x8 | 26 | #define HPET_DEV_VALID 0x8 |
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index 278cd07228dd..53917a3ebf94 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c | |||
| @@ -167,6 +167,9 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr, | |||
| 167 | struct efi_info *current_ei = &boot_params.efi_info; | 167 | struct efi_info *current_ei = &boot_params.efi_info; |
| 168 | struct efi_info *ei = ¶ms->efi_info; | 168 | struct efi_info *ei = ¶ms->efi_info; |
| 169 | 169 | ||
| 170 | if (!efi_enabled(EFI_RUNTIME_SERVICES)) | ||
| 171 | return 0; | ||
| 172 | |||
| 170 | if (!current_ei->efi_memmap_size) | 173 | if (!current_ei->efi_memmap_size) |
| 171 | return 0; | 174 | return 0; |
| 172 | 175 | ||
| @@ -434,6 +437,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel, | |||
| 434 | kbuf.memsz = PAGE_ALIGN(header->init_size); | 437 | kbuf.memsz = PAGE_ALIGN(header->init_size); |
| 435 | kbuf.buf_align = header->kernel_alignment; | 438 | kbuf.buf_align = header->kernel_alignment; |
| 436 | kbuf.buf_min = MIN_KERNEL_LOAD_ADDR; | 439 | kbuf.buf_min = MIN_KERNEL_LOAD_ADDR; |
| 440 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | ||
| 437 | ret = kexec_add_buffer(&kbuf); | 441 | ret = kexec_add_buffer(&kbuf); |
| 438 | if (ret) | 442 | if (ret) |
| 439 | goto out_free_params; | 443 | goto out_free_params; |
| @@ -448,6 +452,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel, | |||
| 448 | kbuf.bufsz = kbuf.memsz = initrd_len; | 452 | kbuf.bufsz = kbuf.memsz = initrd_len; |
| 449 | kbuf.buf_align = PAGE_SIZE; | 453 | kbuf.buf_align = PAGE_SIZE; |
| 450 | kbuf.buf_min = MIN_INITRD_LOAD_ADDR; | 454 | kbuf.buf_min = MIN_INITRD_LOAD_ADDR; |
| 455 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | ||
| 451 | ret = kexec_add_buffer(&kbuf); | 456 | ret = kexec_add_buffer(&kbuf); |
| 452 | if (ret) | 457 | if (ret) |
| 453 | goto out_free_params; | 458 | goto out_free_params; |
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index ba4bfb7f6a36..5c93a65ee1e5 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c | |||
| @@ -457,6 +457,7 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) | |||
| 457 | #else | 457 | #else |
| 458 | u64 ipi_bitmap = 0; | 458 | u64 ipi_bitmap = 0; |
| 459 | #endif | 459 | #endif |
| 460 | long ret; | ||
| 460 | 461 | ||
| 461 | if (cpumask_empty(mask)) | 462 | if (cpumask_empty(mask)) |
| 462 | return; | 463 | return; |
| @@ -482,8 +483,9 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) | |||
| 482 | } else if (apic_id < min + KVM_IPI_CLUSTER_SIZE) { | 483 | } else if (apic_id < min + KVM_IPI_CLUSTER_SIZE) { |
| 483 | max = apic_id < max ? max : apic_id; | 484 | max = apic_id < max ? max : apic_id; |
| 484 | } else { | 485 | } else { |
| 485 | kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, | 486 | ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, |
| 486 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); | 487 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); |
| 488 | WARN_ONCE(ret < 0, "KVM: failed to send PV IPI: %ld", ret); | ||
| 487 | min = max = apic_id; | 489 | min = max = apic_id; |
| 488 | ipi_bitmap = 0; | 490 | ipi_bitmap = 0; |
| 489 | } | 491 | } |
| @@ -491,8 +493,9 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) | |||
| 491 | } | 493 | } |
| 492 | 494 | ||
| 493 | if (ipi_bitmap) { | 495 | if (ipi_bitmap) { |
| 494 | kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, | 496 | ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, |
| 495 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); | 497 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); |
| 498 | WARN_ONCE(ret < 0, "KVM: failed to send PV IPI: %ld", ret); | ||
| 496 | } | 499 | } |
| 497 | 500 | ||
| 498 | local_irq_restore(flags); | 501 | local_irq_restore(flags); |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index e9f777bfed40..3fae23834069 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
| @@ -297,15 +297,16 @@ static int __init tsc_setup(char *str) | |||
| 297 | 297 | ||
| 298 | __setup("tsc=", tsc_setup); | 298 | __setup("tsc=", tsc_setup); |
| 299 | 299 | ||
| 300 | #define MAX_RETRIES 5 | 300 | #define MAX_RETRIES 5 |
| 301 | #define SMI_TRESHOLD 50000 | 301 | #define TSC_DEFAULT_THRESHOLD 0x20000 |
| 302 | 302 | ||
| 303 | /* | 303 | /* |
| 304 | * Read TSC and the reference counters. Take care of SMI disturbance | 304 | * Read TSC and the reference counters. Take care of any disturbances |
| 305 | */ | 305 | */ |
| 306 | static u64 tsc_read_refs(u64 *p, int hpet) | 306 | static u64 tsc_read_refs(u64 *p, int hpet) |
| 307 | { | 307 | { |
| 308 | u64 t1, t2; | 308 | u64 t1, t2; |
| 309 | u64 thresh = tsc_khz ? tsc_khz >> 5 : TSC_DEFAULT_THRESHOLD; | ||
| 309 | int i; | 310 | int i; |
| 310 | 311 | ||
| 311 | for (i = 0; i < MAX_RETRIES; i++) { | 312 | for (i = 0; i < MAX_RETRIES; i++) { |
| @@ -315,7 +316,7 @@ static u64 tsc_read_refs(u64 *p, int hpet) | |||
| 315 | else | 316 | else |
| 316 | *p = acpi_pm_read_early(); | 317 | *p = acpi_pm_read_early(); |
| 317 | t2 = get_cycles(); | 318 | t2 = get_cycles(); |
| 318 | if ((t2 - t1) < SMI_TRESHOLD) | 319 | if ((t2 - t1) < thresh) |
| 319 | return t2; | 320 | return t2; |
| 320 | } | 321 | } |
| 321 | return ULLONG_MAX; | 322 | return ULLONG_MAX; |
| @@ -703,15 +704,15 @@ static unsigned long pit_hpet_ptimer_calibrate_cpu(void) | |||
| 703 | * zero. In each wait loop iteration we read the TSC and check | 704 | * zero. In each wait loop iteration we read the TSC and check |
| 704 | * the delta to the previous read. We keep track of the min | 705 | * the delta to the previous read. We keep track of the min |
| 705 | * and max values of that delta. The delta is mostly defined | 706 | * and max values of that delta. The delta is mostly defined |
| 706 | * by the IO time of the PIT access, so we can detect when a | 707 | * by the IO time of the PIT access, so we can detect when |
| 707 | * SMI/SMM disturbance happened between the two reads. If the | 708 | * any disturbance happened between the two reads. If the |
| 708 | * maximum time is significantly larger than the minimum time, | 709 | * maximum time is significantly larger than the minimum time, |
| 709 | * then we discard the result and have another try. | 710 | * then we discard the result and have another try. |
| 710 | * | 711 | * |
| 711 | * 2) Reference counter. If available we use the HPET or the | 712 | * 2) Reference counter. If available we use the HPET or the |
| 712 | * PMTIMER as a reference to check the sanity of that value. | 713 | * PMTIMER as a reference to check the sanity of that value. |
| 713 | * We use separate TSC readouts and check inside of the | 714 | * We use separate TSC readouts and check inside of the |
| 714 | * reference read for a SMI/SMM disturbance. We dicard | 715 | * reference read for any possible disturbance. We dicard |
| 715 | * disturbed values here as well. We do that around the PIT | 716 | * disturbed values here as well. We do that around the PIT |
| 716 | * calibration delay loop as we have to wait for a certain | 717 | * calibration delay loop as we have to wait for a certain |
| 717 | * amount of time anyway. | 718 | * amount of time anyway. |
| @@ -744,7 +745,7 @@ static unsigned long pit_hpet_ptimer_calibrate_cpu(void) | |||
| 744 | if (ref1 == ref2) | 745 | if (ref1 == ref2) |
| 745 | continue; | 746 | continue; |
| 746 | 747 | ||
| 747 | /* Check, whether the sampling was disturbed by an SMI */ | 748 | /* Check, whether the sampling was disturbed */ |
| 748 | if (tsc1 == ULLONG_MAX || tsc2 == ULLONG_MAX) | 749 | if (tsc1 == ULLONG_MAX || tsc2 == ULLONG_MAX) |
| 749 | continue; | 750 | continue; |
| 750 | 751 | ||
| @@ -1268,7 +1269,7 @@ static DECLARE_DELAYED_WORK(tsc_irqwork, tsc_refine_calibration_work); | |||
| 1268 | */ | 1269 | */ |
| 1269 | static void tsc_refine_calibration_work(struct work_struct *work) | 1270 | static void tsc_refine_calibration_work(struct work_struct *work) |
| 1270 | { | 1271 | { |
| 1271 | static u64 tsc_start = -1, ref_start; | 1272 | static u64 tsc_start = ULLONG_MAX, ref_start; |
| 1272 | static int hpet; | 1273 | static int hpet; |
| 1273 | u64 tsc_stop, ref_stop, delta; | 1274 | u64 tsc_stop, ref_stop, delta; |
| 1274 | unsigned long freq; | 1275 | unsigned long freq; |
| @@ -1283,14 +1284,15 @@ static void tsc_refine_calibration_work(struct work_struct *work) | |||
| 1283 | * delayed the first time we expire. So set the workqueue | 1284 | * delayed the first time we expire. So set the workqueue |
| 1284 | * again once we know timers are working. | 1285 | * again once we know timers are working. |
| 1285 | */ | 1286 | */ |
| 1286 | if (tsc_start == -1) { | 1287 | if (tsc_start == ULLONG_MAX) { |
| 1288 | restart: | ||
| 1287 | /* | 1289 | /* |
| 1288 | * Only set hpet once, to avoid mixing hardware | 1290 | * Only set hpet once, to avoid mixing hardware |
| 1289 | * if the hpet becomes enabled later. | 1291 | * if the hpet becomes enabled later. |
| 1290 | */ | 1292 | */ |
| 1291 | hpet = is_hpet_enabled(); | 1293 | hpet = is_hpet_enabled(); |
| 1292 | schedule_delayed_work(&tsc_irqwork, HZ); | ||
| 1293 | tsc_start = tsc_read_refs(&ref_start, hpet); | 1294 | tsc_start = tsc_read_refs(&ref_start, hpet); |
| 1295 | schedule_delayed_work(&tsc_irqwork, HZ); | ||
| 1294 | return; | 1296 | return; |
| 1295 | } | 1297 | } |
| 1296 | 1298 | ||
| @@ -1300,9 +1302,9 @@ static void tsc_refine_calibration_work(struct work_struct *work) | |||
| 1300 | if (ref_start == ref_stop) | 1302 | if (ref_start == ref_stop) |
| 1301 | goto out; | 1303 | goto out; |
| 1302 | 1304 | ||
| 1303 | /* Check, whether the sampling was disturbed by an SMI */ | 1305 | /* Check, whether the sampling was disturbed */ |
| 1304 | if (tsc_start == ULLONG_MAX || tsc_stop == ULLONG_MAX) | 1306 | if (tsc_stop == ULLONG_MAX) |
| 1305 | goto out; | 1307 | goto restart; |
| 1306 | 1308 | ||
| 1307 | delta = tsc_stop - tsc_start; | 1309 | delta = tsc_stop - tsc_start; |
| 1308 | delta *= 1000000LL; | 1310 | delta *= 1000000LL; |
