|
@@ -486,6 +486,16 @@ static void __exit microcode_dev_exit(void)
|
|
/* fake device for request_firmware */
|
|
/* fake device for request_firmware */
|
|
static struct platform_device *microcode_pdev;
|
|
static struct platform_device *microcode_pdev;
|
|
|
|
|
|
|
|
+static int check_online_cpus(void)
|
|
|
|
+{
|
|
|
|
+ if (num_online_cpus() == num_present_cpus())
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ pr_err("Not all CPUs online, aborting microcode update.\n");
|
|
|
|
+
|
|
|
|
+ return -EINVAL;
|
|
|
|
+}
|
|
|
|
+
|
|
static enum ucode_state reload_for_cpu(int cpu)
|
|
static enum ucode_state reload_for_cpu(int cpu)
|
|
{
|
|
{
|
|
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
|
|
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
|
|
@@ -519,7 +529,13 @@ static ssize_t reload_store(struct device *dev,
|
|
return size;
|
|
return size;
|
|
|
|
|
|
get_online_cpus();
|
|
get_online_cpus();
|
|
|
|
+
|
|
|
|
+ ret = check_online_cpus();
|
|
|
|
+ if (ret)
|
|
|
|
+ goto put;
|
|
|
|
+
|
|
mutex_lock(µcode_mutex);
|
|
mutex_lock(µcode_mutex);
|
|
|
|
+
|
|
for_each_online_cpu(cpu) {
|
|
for_each_online_cpu(cpu) {
|
|
tmp_ret = reload_for_cpu(cpu);
|
|
tmp_ret = reload_for_cpu(cpu);
|
|
if (tmp_ret > UCODE_NFOUND) {
|
|
if (tmp_ret > UCODE_NFOUND) {
|
|
@@ -538,6 +554,8 @@ static ssize_t reload_store(struct device *dev,
|
|
microcode_check();
|
|
microcode_check();
|
|
|
|
|
|
mutex_unlock(µcode_mutex);
|
|
mutex_unlock(µcode_mutex);
|
|
|
|
+
|
|
|
|
+put:
|
|
put_online_cpus();
|
|
put_online_cpus();
|
|
|
|
|
|
if (!ret)
|
|
if (!ret)
|