|
46 | 46 | static struct microcode_ops *microcode_ops; |
47 | 47 | bool dis_ucode_ldr = true; |
48 | 48 |
|
| 49 | +bool force_minrev = IS_ENABLED(CONFIG_MICROCODE_LATE_FORCE_MINREV); |
| 50 | +module_param(force_minrev, bool, S_IRUSR | S_IWUSR); |
| 51 | + |
49 | 52 | /* |
50 | 53 | * Synchronization. |
51 | 54 | * |
@@ -531,15 +534,17 @@ static int load_cpus_stopped(void *unused) |
531 | 534 | return 0; |
532 | 535 | } |
533 | 536 |
|
534 | | -static int load_late_stop_cpus(void) |
| 537 | +static int load_late_stop_cpus(bool is_safe) |
535 | 538 | { |
536 | 539 | unsigned int cpu, updated = 0, failed = 0, timedout = 0, siblings = 0; |
537 | 540 | unsigned int nr_offl, offline = 0; |
538 | 541 | int old_rev = boot_cpu_data.microcode; |
539 | 542 | struct cpuinfo_x86 prev_info; |
540 | 543 |
|
541 | | - pr_err("Attempting late microcode loading - it is dangerous and taints the kernel.\n"); |
542 | | - pr_err("You should switch to early loading, if possible.\n"); |
| 544 | + if (!is_safe) { |
| 545 | + pr_err("Late microcode loading without minimal revision check.\n"); |
| 546 | + pr_err("You should switch to early loading, if possible.\n"); |
| 547 | + } |
543 | 548 |
|
544 | 549 | atomic_set(&late_cpus_in, num_online_cpus()); |
545 | 550 | atomic_set(&offline_in_nmi, 0); |
@@ -589,7 +594,9 @@ static int load_late_stop_cpus(void) |
589 | 594 | return -EIO; |
590 | 595 | } |
591 | 596 |
|
592 | | - add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK); |
| 597 | + if (!is_safe || failed || timedout) |
| 598 | + add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK); |
| 599 | + |
593 | 600 | pr_info("load: updated on %u primary CPUs with %u siblings\n", updated, siblings); |
594 | 601 | if (failed || timedout) { |
595 | 602 | pr_err("load incomplete. %u CPUs timed out or failed\n", |
@@ -679,7 +686,9 @@ static int load_late_locked(void) |
679 | 686 |
|
680 | 687 | switch (microcode_ops->request_microcode_fw(0, µcode_pdev->dev)) { |
681 | 688 | case UCODE_NEW: |
682 | | - return load_late_stop_cpus(); |
| 689 | + return load_late_stop_cpus(false); |
| 690 | + case UCODE_NEW_SAFE: |
| 691 | + return load_late_stop_cpus(true); |
683 | 692 | case UCODE_NFOUND: |
684 | 693 | return -ENOENT; |
685 | 694 | default: |
|
0 commit comments