diff options
| -rw-r--r-- | arch/x86/include/asm/msr.h | 9 | ||||
| -rw-r--r-- | arch/x86/kernel/microcode_core.c | 28 |
2 files changed, 27 insertions, 10 deletions
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 084ef95274cd..95203d40ffdd 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h | |||
| @@ -169,7 +169,14 @@ static inline int wrmsr_safe(unsigned msr, unsigned low, unsigned high) | |||
| 169 | return native_write_msr_safe(msr, low, high); | 169 | return native_write_msr_safe(msr, low, high); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | /* rdmsr with exception handling */ | 172 | /* |
| 173 | * rdmsr with exception handling. | ||
| 174 | * | ||
| 175 | * Please note that the exception handling works only after we've | ||
| 176 | * switched to the "smart" #GP handler in trap_init() which knows about | ||
| 177 | * exception tables - using this macro earlier than that causes machine | ||
| 178 | * hangs on boxes which do not implement the @msr in the first argument. | ||
| 179 | */ | ||
| 173 | #define rdmsr_safe(msr, p1, p2) \ | 180 | #define rdmsr_safe(msr, p1, p2) \ |
| 174 | ({ \ | 181 | ({ \ |
| 175 | int __err; \ | 182 | int __err; \ |
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index f2d2a664e797..9d46f5e43b51 100644 --- a/arch/x86/kernel/microcode_core.c +++ b/arch/x86/kernel/microcode_core.c | |||
| @@ -256,7 +256,7 @@ static int __init microcode_dev_init(void) | |||
| 256 | return 0; | 256 | return 0; |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | static void microcode_dev_exit(void) | 259 | static void __exit microcode_dev_exit(void) |
| 260 | { | 260 | { |
| 261 | misc_deregister(µcode_dev); | 261 | misc_deregister(µcode_dev); |
| 262 | } | 262 | } |
| @@ -519,10 +519,8 @@ static int __init microcode_init(void) | |||
| 519 | 519 | ||
| 520 | microcode_pdev = platform_device_register_simple("microcode", -1, | 520 | microcode_pdev = platform_device_register_simple("microcode", -1, |
| 521 | NULL, 0); | 521 | NULL, 0); |
| 522 | if (IS_ERR(microcode_pdev)) { | 522 | if (IS_ERR(microcode_pdev)) |
| 523 | microcode_dev_exit(); | ||
| 524 | return PTR_ERR(microcode_pdev); | 523 | return PTR_ERR(microcode_pdev); |
| 525 | } | ||
| 526 | 524 | ||
| 527 | get_online_cpus(); | 525 | get_online_cpus(); |
| 528 | mutex_lock(µcode_mutex); | 526 | mutex_lock(µcode_mutex); |
| @@ -532,14 +530,12 @@ static int __init microcode_init(void) | |||
| 532 | mutex_unlock(µcode_mutex); | 530 | mutex_unlock(µcode_mutex); |
| 533 | put_online_cpus(); | 531 | put_online_cpus(); |
| 534 | 532 | ||
| 535 | if (error) { | 533 | if (error) |
| 536 | platform_device_unregister(microcode_pdev); | 534 | goto out_pdev; |
| 537 | return error; | ||
| 538 | } | ||
| 539 | 535 | ||
| 540 | error = microcode_dev_init(); | 536 | error = microcode_dev_init(); |
| 541 | if (error) | 537 | if (error) |
| 542 | return error; | 538 | goto out_sysdev_driver; |
| 543 | 539 | ||
| 544 | register_syscore_ops(&mc_syscore_ops); | 540 | register_syscore_ops(&mc_syscore_ops); |
| 545 | register_hotcpu_notifier(&mc_cpu_notifier); | 541 | register_hotcpu_notifier(&mc_cpu_notifier); |
| @@ -548,6 +544,20 @@ static int __init microcode_init(void) | |||
| 548 | " <tigran@aivazian.fsnet.co.uk>, Peter Oruba\n"); | 544 | " <tigran@aivazian.fsnet.co.uk>, Peter Oruba\n"); |
| 549 | 545 | ||
| 550 | return 0; | 546 | return 0; |
| 547 | |||
| 548 | out_sysdev_driver: | ||
| 549 | get_online_cpus(); | ||
| 550 | mutex_lock(µcode_mutex); | ||
| 551 | |||
| 552 | sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver); | ||
| 553 | |||
| 554 | mutex_unlock(µcode_mutex); | ||
| 555 | put_online_cpus(); | ||
| 556 | |||
| 557 | out_pdev: | ||
| 558 | platform_device_unregister(microcode_pdev); | ||
| 559 | return error; | ||
| 560 | |||
| 551 | } | 561 | } |
| 552 | module_init(microcode_init); | 562 | module_init(microcode_init); |
| 553 | 563 | ||
