diff options
Diffstat (limited to 'arch/x86/kernel/microcode.c')
| -rw-r--r-- | arch/x86/kernel/microcode.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c index 56b933119a04..6994c751590e 100644 --- a/arch/x86/kernel/microcode.c +++ b/arch/x86/kernel/microcode.c | |||
| @@ -388,6 +388,7 @@ static int do_microcode_update (void) | |||
| 388 | void *new_mc = NULL; | 388 | void *new_mc = NULL; |
| 389 | int cpu; | 389 | int cpu; |
| 390 | cpumask_t old; | 390 | cpumask_t old; |
| 391 | cpumask_of_cpu_ptr_declare(newmask); | ||
| 391 | 392 | ||
| 392 | old = current->cpus_allowed; | 393 | old = current->cpus_allowed; |
| 393 | 394 | ||
| @@ -404,7 +405,8 @@ static int do_microcode_update (void) | |||
| 404 | 405 | ||
| 405 | if (!uci->valid) | 406 | if (!uci->valid) |
| 406 | continue; | 407 | continue; |
| 407 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); | 408 | cpumask_of_cpu_ptr_next(newmask, cpu); |
| 409 | set_cpus_allowed_ptr(current, newmask); | ||
| 408 | error = get_maching_microcode(new_mc, cpu); | 410 | error = get_maching_microcode(new_mc, cpu); |
| 409 | if (error < 0) | 411 | if (error < 0) |
| 410 | goto out; | 412 | goto out; |
| @@ -574,6 +576,7 @@ static int apply_microcode_check_cpu(int cpu) | |||
| 574 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 576 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 575 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; | 577 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; |
| 576 | cpumask_t old; | 578 | cpumask_t old; |
| 579 | cpumask_of_cpu_ptr(newmask, cpu); | ||
| 577 | unsigned int val[2]; | 580 | unsigned int val[2]; |
| 578 | int err = 0; | 581 | int err = 0; |
| 579 | 582 | ||
| @@ -582,7 +585,7 @@ static int apply_microcode_check_cpu(int cpu) | |||
| 582 | return 0; | 585 | return 0; |
| 583 | 586 | ||
| 584 | old = current->cpus_allowed; | 587 | old = current->cpus_allowed; |
| 585 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); | 588 | set_cpus_allowed_ptr(current, newmask); |
| 586 | 589 | ||
| 587 | /* Check if the microcode we have in memory matches the CPU */ | 590 | /* Check if the microcode we have in memory matches the CPU */ |
| 588 | if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || | 591 | if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || |
| @@ -620,11 +623,12 @@ static int apply_microcode_check_cpu(int cpu) | |||
| 620 | static void microcode_init_cpu(int cpu, int resume) | 623 | static void microcode_init_cpu(int cpu, int resume) |
| 621 | { | 624 | { |
| 622 | cpumask_t old; | 625 | cpumask_t old; |
| 626 | cpumask_of_cpu_ptr(newmask, cpu); | ||
| 623 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; | 627 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; |
| 624 | 628 | ||
| 625 | old = current->cpus_allowed; | 629 | old = current->cpus_allowed; |
| 626 | 630 | ||
| 627 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); | 631 | set_cpus_allowed_ptr(current, newmask); |
| 628 | mutex_lock(µcode_mutex); | 632 | mutex_lock(µcode_mutex); |
| 629 | collect_cpu_info(cpu); | 633 | collect_cpu_info(cpu); |
| 630 | if (uci->valid && system_state == SYSTEM_RUNNING && !resume) | 634 | if (uci->valid && system_state == SYSTEM_RUNNING && !resume) |
| @@ -644,7 +648,9 @@ static void microcode_fini_cpu(int cpu) | |||
| 644 | mutex_unlock(µcode_mutex); | 648 | mutex_unlock(µcode_mutex); |
| 645 | } | 649 | } |
| 646 | 650 | ||
| 647 | static ssize_t reload_store(struct sys_device *dev, const char *buf, size_t sz) | 651 | static ssize_t reload_store(struct sys_device *dev, |
| 652 | struct sysdev_attribute *attr, | ||
| 653 | const char *buf, size_t sz) | ||
| 648 | { | 654 | { |
| 649 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; | 655 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; |
| 650 | char *end; | 656 | char *end; |
| @@ -656,11 +662,12 @@ static ssize_t reload_store(struct sys_device *dev, const char *buf, size_t sz) | |||
| 656 | return -EINVAL; | 662 | return -EINVAL; |
| 657 | if (val == 1) { | 663 | if (val == 1) { |
| 658 | cpumask_t old; | 664 | cpumask_t old; |
| 665 | cpumask_of_cpu_ptr(newmask, cpu); | ||
| 659 | 666 | ||
| 660 | old = current->cpus_allowed; | 667 | old = current->cpus_allowed; |
| 661 | 668 | ||
| 662 | get_online_cpus(); | 669 | get_online_cpus(); |
| 663 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); | 670 | set_cpus_allowed_ptr(current, newmask); |
| 664 | 671 | ||
| 665 | mutex_lock(µcode_mutex); | 672 | mutex_lock(µcode_mutex); |
| 666 | if (uci->valid) | 673 | if (uci->valid) |
| @@ -674,14 +681,16 @@ static ssize_t reload_store(struct sys_device *dev, const char *buf, size_t sz) | |||
| 674 | return sz; | 681 | return sz; |
| 675 | } | 682 | } |
| 676 | 683 | ||
| 677 | static ssize_t version_show(struct sys_device *dev, char *buf) | 684 | static ssize_t version_show(struct sys_device *dev, |
| 685 | struct sysdev_attribute *attr, char *buf) | ||
| 678 | { | 686 | { |
| 679 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; | 687 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; |
| 680 | 688 | ||
| 681 | return sprintf(buf, "0x%x\n", uci->rev); | 689 | return sprintf(buf, "0x%x\n", uci->rev); |
| 682 | } | 690 | } |
| 683 | 691 | ||
| 684 | static ssize_t pf_show(struct sys_device *dev, char *buf) | 692 | static ssize_t pf_show(struct sys_device *dev, |
| 693 | struct sysdev_attribute *attr, char *buf) | ||
| 685 | { | 694 | { |
| 686 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; | 695 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; |
| 687 | 696 | ||
