It is dangerous and it should not be used anyway - there's a nice early loading already.
Unified · Split
| @@ -1350,6 +1350,17 @@ config MICROCODE_AMD · 1349 unmodified lines | |||
| 1350 | If you select this option, microcode patch loading support for AMD | 1350 | If you select this option, microcode patch loading support for AMD |
| 1351 | processors will be enabled. | 1351 | processors will be enabled. |
| 1352 | 1352 | ||
| 1353 | config MICROCODE_LATE_LOADING | ||
| 1354 | bool "Late microcode loading (DANGEROUS)" | ||
| 1355 | default n | ||
| 1356 | depends on MICROCODE | ||
| 1357 | help | ||
| 1358 | Loading microcode late, when the system is up and executing instructions | ||
| 1359 | is a tricky business and should be avoided if possible. Just the sequence | ||
| 1360 | of synchronizing all cores and SMT threads is one fragile dance which does | ||
| 1361 | not guarantee that cores might not softlock after the loading. Therefore, | ||
| 1362 | use this at your own risk. Late loading taints the kernel too. | ||
| 1363 | |||
| 1353 | config X86_MSR | 1364 | config X86_MSR |
| 1354 | tristate "/dev/cpu/*/msr - Model-specific register support" | 1365 | tristate "/dev/cpu/*/msr - Model-specific register support" |
| 1355 | help | 1366 | help |
| @@ -2222,6 +2222,7 @@ void cpu_init_secondary(void) · 2221 unmodified lines | |||
| 2222 | } | 2222 | } |
| 2223 | #endif | 2223 | #endif |
| 2224 | 2224 | ||
| 2225 | #ifdef CONFIG_MICROCODE_LATE_LOADING | ||
| 2225 | /* | 2226 | /* |
| 2226 | * The microcode loader calls this upon late microcode load to recheck features, | 2227 | * The microcode loader calls this upon late microcode load to recheck features, |
| 2227 | * only when microcode has been updated. Caller holds microcode_mutex and CPU | 2228 | * only when microcode has been updated. Caller holds microcode_mutex and CPU |
| @@ -2251,6 +2252,7 @@ void microcode_check(void) · 23 unmodified lines | |||
| 2251 | pr_warn("x86/CPU: CPU features have changed after loading microcode, but might not take effect.\n"); | 2252 | pr_warn("x86/CPU: CPU features have changed after loading microcode, but might not take effect.\n"); |
| 2252 | pr_warn("x86/CPU: Please consider either early loading through initrd/built-in or a potential BIOS update.\n"); | 2253 | pr_warn("x86/CPU: Please consider either early loading through initrd/built-in or a potential BIOS update.\n"); |
| 2253 | } | 2254 | } |
| 2255 | #endif | ||
| 2254 | 2256 | ||
| 2255 | /* | 2257 | /* |
| 2256 | * Invoked from core CPU hotplug code after hotplug operations | 2258 | * Invoked from core CPU hotplug code after hotplug operations |
| @@ -376,6 +376,7 @@ static int apply_microcode_on_target(int cpu) · 375 unmodified lines | |||
| 376 | /* fake device for request_firmware */ | 376 | /* fake device for request_firmware */ |
| 377 | static struct platform_device *microcode_pdev; | 377 | static struct platform_device *microcode_pdev; |
| 378 | 378 | ||
| 379 | #ifdef CONFIG_MICROCODE_LATE_LOADING | ||
| 379 | /* | 380 | /* |
| 380 | * Late loading dance. Why the heavy-handed stomp_machine effort? | 381 | * Late loading dance. Why the heavy-handed stomp_machine effort? |
| 381 | * | 382 | * |
| @@ -543,6 +544,9 @@ put: · 161 unmodified lines | |||
| 543 | return ret; | 544 | return ret; |
| 544 | } | 545 | } |
| 545 | 546 | ||
| 547 | static DEVICE_ATTR_WO(reload); | ||
| 548 | #endif | ||
| 549 | |||
| 546 | static ssize_t version_show(struct device *dev, | 550 | static ssize_t version_show(struct device *dev, |
| 547 | struct device_attribute *attr, char *buf) | 551 | struct device_attribute *attr, char *buf) |
| 548 | { | 552 | { |
| @@ -559,7 +563,6 @@ static ssize_t pf_show(struct device *dev, · 10 unmodified lines | |||
| 559 | return sprintf(buf, "0x%x\n", uci->cpu_sig.pf); | 563 | return sprintf(buf, "0x%x\n", uci->cpu_sig.pf); |
| 560 | } | 564 | } |
| 561 | 565 | ||
| 562 | static DEVICE_ATTR_WO(reload); | ||
| 563 | static DEVICE_ATTR(version, 0444, version_show, NULL); | 566 | static DEVICE_ATTR(version, 0444, version_show, NULL); |
| 564 | static DEVICE_ATTR(processor_flags, 0444, pf_show, NULL); | 567 | static DEVICE_ATTR(processor_flags, 0444, pf_show, NULL); |
| 565 | 568 | ||
| @@ -712,7 +715,9 @@ static int mc_cpu_down_prep(unsigned int cpu) · 146 unmodified lines | |||
| 712 | } | 715 | } |
| 713 | 716 | ||
| 714 | static struct attribute *cpu_root_microcode_attrs[] = { | 717 | static struct attribute *cpu_root_microcode_attrs[] = { |
| 718 | #ifdef CONFIG_MICROCODE_LATE_LOADING | ||
| 715 | &dev_attr_reload.attr, | 719 | &dev_attr_reload.attr, |
| 720 | #endif | ||
| 716 | NULL | 721 | NULL |
| 717 | }; | 722 | }; |
| 718 | 723 | ||