diff options
Diffstat (limited to 'arch/x86/kernel/microcode_core.c')
| -rw-r--r-- | arch/x86/kernel/microcode_core.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index 82fb2809ce32..c9b721ba968c 100644 --- a/arch/x86/kernel/microcode_core.c +++ b/arch/x86/kernel/microcode_core.c | |||
| @@ -99,7 +99,7 @@ MODULE_LICENSE("GPL"); | |||
| 99 | 99 | ||
| 100 | #define MICROCODE_VERSION "2.00" | 100 | #define MICROCODE_VERSION "2.00" |
| 101 | 101 | ||
| 102 | struct microcode_ops *microcode_ops; | 102 | static struct microcode_ops *microcode_ops; |
| 103 | 103 | ||
| 104 | /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ | 104 | /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ |
| 105 | static DEFINE_MUTEX(microcode_mutex); | 105 | static DEFINE_MUTEX(microcode_mutex); |
| @@ -203,7 +203,7 @@ MODULE_ALIAS_MISCDEV(MICROCODE_MINOR); | |||
| 203 | #endif | 203 | #endif |
| 204 | 204 | ||
| 205 | /* fake device for request_firmware */ | 205 | /* fake device for request_firmware */ |
| 206 | struct platform_device *microcode_pdev; | 206 | static struct platform_device *microcode_pdev; |
| 207 | 207 | ||
| 208 | static ssize_t reload_store(struct sys_device *dev, | 208 | static ssize_t reload_store(struct sys_device *dev, |
| 209 | struct sysdev_attribute *attr, | 209 | struct sysdev_attribute *attr, |
| @@ -272,13 +272,18 @@ static struct attribute_group mc_attr_group = { | |||
| 272 | .name = "microcode", | 272 | .name = "microcode", |
| 273 | }; | 273 | }; |
| 274 | 274 | ||
| 275 | static void microcode_fini_cpu(int cpu) | 275 | static void __microcode_fini_cpu(int cpu) |
| 276 | { | 276 | { |
| 277 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; | 277 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; |
| 278 | 278 | ||
| 279 | mutex_lock(µcode_mutex); | ||
| 280 | microcode_ops->microcode_fini_cpu(cpu); | 279 | microcode_ops->microcode_fini_cpu(cpu); |
| 281 | uci->valid = 0; | 280 | uci->valid = 0; |
| 281 | } | ||
| 282 | |||
| 283 | static void microcode_fini_cpu(int cpu) | ||
| 284 | { | ||
| 285 | mutex_lock(µcode_mutex); | ||
| 286 | __microcode_fini_cpu(cpu); | ||
| 282 | mutex_unlock(µcode_mutex); | 287 | mutex_unlock(µcode_mutex); |
| 283 | } | 288 | } |
| 284 | 289 | ||
| @@ -306,12 +311,16 @@ static int microcode_resume_cpu(int cpu) | |||
| 306 | * to this cpu (a bit of paranoia): | 311 | * to this cpu (a bit of paranoia): |
| 307 | */ | 312 | */ |
| 308 | if (microcode_ops->collect_cpu_info(cpu, &nsig)) { | 313 | if (microcode_ops->collect_cpu_info(cpu, &nsig)) { |
| 309 | microcode_fini_cpu(cpu); | 314 | __microcode_fini_cpu(cpu); |
| 315 | printk(KERN_ERR "failed to collect_cpu_info for resuming cpu #%d\n", | ||
| 316 | cpu); | ||
| 310 | return -1; | 317 | return -1; |
| 311 | } | 318 | } |
| 312 | 319 | ||
| 313 | if (memcmp(&nsig, &uci->cpu_sig, sizeof(nsig))) { | 320 | if ((nsig.sig != uci->cpu_sig.sig) || (nsig.pf != uci->cpu_sig.pf)) { |
| 314 | microcode_fini_cpu(cpu); | 321 | __microcode_fini_cpu(cpu); |
| 322 | printk(KERN_ERR "cached ucode doesn't match the resuming cpu #%d\n", | ||
| 323 | cpu); | ||
| 315 | /* Should we look for a new ucode here? */ | 324 | /* Should we look for a new ucode here? */ |
| 316 | return 1; | 325 | return 1; |
| 317 | } | 326 | } |
| @@ -319,7 +328,7 @@ static int microcode_resume_cpu(int cpu) | |||
| 319 | return 0; | 328 | return 0; |
| 320 | } | 329 | } |
| 321 | 330 | ||
| 322 | void microcode_update_cpu(int cpu) | 331 | static void microcode_update_cpu(int cpu) |
| 323 | { | 332 | { |
| 324 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; | 333 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; |
| 325 | int err = 0; | 334 | int err = 0; |
