Commit 230bda08 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'x86_cleanups_for_v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 cleanups from Borislav Petkov:
 "The usual round of minor cleanups and fixes"

* tag 'x86_cleanups_for_v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/kaslr: Have process_mem_region() return a boolean
  x86/power: Fix kernel-doc warnings in cpu.c
  x86/mce/inject: Replace deprecated CPU-hotplug functions.
  x86/microcode: Replace deprecated CPU-hotplug functions.
  x86/mtrr: Replace deprecated CPU-hotplug functions.
  x86/mmiotrace: Replace deprecated CPU-hotplug functions.
parents 42f6e869 5b3fd8aa
...@@ -668,7 +668,7 @@ static bool process_mem_region(struct mem_vector *region, ...@@ -668,7 +668,7 @@ static bool process_mem_region(struct mem_vector *region,
if (slot_area_index == MAX_SLOT_AREA) { if (slot_area_index == MAX_SLOT_AREA) {
debug_putstr("Aborted e820/efi memmap scan when walking immovable regions(slot_areas full)!\n"); debug_putstr("Aborted e820/efi memmap scan when walking immovable regions(slot_areas full)!\n");
return 1; return true;
} }
} }
#endif #endif
......
...@@ -235,7 +235,7 @@ static void __maybe_unused raise_mce(struct mce *m) ...@@ -235,7 +235,7 @@ static void __maybe_unused raise_mce(struct mce *m)
unsigned long start; unsigned long start;
int cpu; int cpu;
get_online_cpus(); cpus_read_lock();
cpumask_copy(mce_inject_cpumask, cpu_online_mask); cpumask_copy(mce_inject_cpumask, cpu_online_mask);
cpumask_clear_cpu(get_cpu(), mce_inject_cpumask); cpumask_clear_cpu(get_cpu(), mce_inject_cpumask);
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
...@@ -269,7 +269,7 @@ static void __maybe_unused raise_mce(struct mce *m) ...@@ -269,7 +269,7 @@ static void __maybe_unused raise_mce(struct mce *m)
} }
raise_local(); raise_local();
put_cpu(); put_cpu();
put_online_cpus(); cpus_read_unlock();
} else { } else {
preempt_disable(); preempt_disable();
raise_local(); raise_local();
...@@ -529,7 +529,7 @@ static void do_inject(void) ...@@ -529,7 +529,7 @@ static void do_inject(void)
cpu = get_nbc_for_node(topology_die_id(cpu)); cpu = get_nbc_for_node(topology_die_id(cpu));
} }
get_online_cpus(); cpus_read_lock();
if (!cpu_online(cpu)) if (!cpu_online(cpu))
goto err; goto err;
...@@ -553,7 +553,7 @@ static void do_inject(void) ...@@ -553,7 +553,7 @@ static void do_inject(void)
} }
err: err:
put_online_cpus(); cpus_read_unlock();
} }
......
...@@ -55,7 +55,7 @@ LIST_HEAD(microcode_cache); ...@@ -55,7 +55,7 @@ LIST_HEAD(microcode_cache);
* All non cpu-hotplug-callback call sites use: * All non cpu-hotplug-callback call sites use:
* *
* - microcode_mutex to synchronize with each other; * - microcode_mutex to synchronize with each other;
* - get/put_online_cpus() to synchronize with * - cpus_read_lock/unlock() to synchronize with
* the cpu-hotplug-callback call sites. * the cpu-hotplug-callback call sites.
* *
* We guarantee that only a single cpu is being * We guarantee that only a single cpu is being
...@@ -431,7 +431,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf, ...@@ -431,7 +431,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
return ret; return ret;
} }
get_online_cpus(); cpus_read_lock();
mutex_lock(&microcode_mutex); mutex_lock(&microcode_mutex);
if (do_microcode_update(buf, len) == 0) if (do_microcode_update(buf, len) == 0)
...@@ -441,7 +441,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf, ...@@ -441,7 +441,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
perf_check_microcode(); perf_check_microcode();
mutex_unlock(&microcode_mutex); mutex_unlock(&microcode_mutex);
put_online_cpus(); cpus_read_unlock();
return ret; return ret;
} }
...@@ -629,7 +629,7 @@ static ssize_t reload_store(struct device *dev, ...@@ -629,7 +629,7 @@ static ssize_t reload_store(struct device *dev,
if (val != 1) if (val != 1)
return size; return size;
get_online_cpus(); cpus_read_lock();
ret = check_online_cpus(); ret = check_online_cpus();
if (ret) if (ret)
...@@ -644,7 +644,7 @@ static ssize_t reload_store(struct device *dev, ...@@ -644,7 +644,7 @@ static ssize_t reload_store(struct device *dev,
mutex_unlock(&microcode_mutex); mutex_unlock(&microcode_mutex);
put: put:
put_online_cpus(); cpus_read_unlock();
if (ret == 0) if (ret == 0)
ret = size; ret = size;
...@@ -853,14 +853,14 @@ static int __init microcode_init(void) ...@@ -853,14 +853,14 @@ static int __init microcode_init(void)
if (IS_ERR(microcode_pdev)) if (IS_ERR(microcode_pdev))
return PTR_ERR(microcode_pdev); return PTR_ERR(microcode_pdev);
get_online_cpus(); cpus_read_lock();
mutex_lock(&microcode_mutex); mutex_lock(&microcode_mutex);
error = subsys_interface_register(&mc_cpu_interface); error = subsys_interface_register(&mc_cpu_interface);
if (!error) if (!error)
perf_check_microcode(); perf_check_microcode();
mutex_unlock(&microcode_mutex); mutex_unlock(&microcode_mutex);
put_online_cpus(); cpus_read_unlock();
if (error) if (error)
goto out_pdev; goto out_pdev;
...@@ -892,13 +892,13 @@ static int __init microcode_init(void) ...@@ -892,13 +892,13 @@ static int __init microcode_init(void)
&cpu_root_microcode_group); &cpu_root_microcode_group);
out_driver: out_driver:
get_online_cpus(); cpus_read_lock();
mutex_lock(&microcode_mutex); mutex_lock(&microcode_mutex);
subsys_interface_unregister(&mc_cpu_interface); subsys_interface_unregister(&mc_cpu_interface);
mutex_unlock(&microcode_mutex); mutex_unlock(&microcode_mutex);
put_online_cpus(); cpus_read_unlock();
out_pdev: out_pdev:
platform_device_unregister(microcode_pdev); platform_device_unregister(microcode_pdev);
......
...@@ -336,7 +336,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, ...@@ -336,7 +336,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
replace = -1; replace = -1;
/* No CPU hotplug when we change MTRR entries */ /* No CPU hotplug when we change MTRR entries */
get_online_cpus(); cpus_read_lock();
/* Search for existing MTRR */ /* Search for existing MTRR */
mutex_lock(&mtrr_mutex); mutex_lock(&mtrr_mutex);
...@@ -398,7 +398,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, ...@@ -398,7 +398,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
error = i; error = i;
out: out:
mutex_unlock(&mtrr_mutex); mutex_unlock(&mtrr_mutex);
put_online_cpus(); cpus_read_unlock();
return error; return error;
} }
...@@ -485,7 +485,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size) ...@@ -485,7 +485,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
max = num_var_ranges; max = num_var_ranges;
/* No CPU hotplug when we change MTRR entries */ /* No CPU hotplug when we change MTRR entries */
get_online_cpus(); cpus_read_lock();
mutex_lock(&mtrr_mutex); mutex_lock(&mtrr_mutex);
if (reg < 0) { if (reg < 0) {
/* Search for existing MTRR */ /* Search for existing MTRR */
...@@ -520,7 +520,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size) ...@@ -520,7 +520,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
error = reg; error = reg;
out: out:
mutex_unlock(&mtrr_mutex); mutex_unlock(&mtrr_mutex);
put_online_cpus(); cpus_read_unlock();
return error; return error;
} }
......
...@@ -376,12 +376,12 @@ static void enter_uniprocessor(void) ...@@ -376,12 +376,12 @@ static void enter_uniprocessor(void)
goto out; goto out;
} }
get_online_cpus(); cpus_read_lock();
cpumask_copy(downed_cpus, cpu_online_mask); cpumask_copy(downed_cpus, cpu_online_mask);
cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus); cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus);
if (num_online_cpus() > 1) if (num_online_cpus() > 1)
pr_notice("Disabling non-boot CPUs...\n"); pr_notice("Disabling non-boot CPUs...\n");
put_online_cpus(); cpus_read_unlock();
for_each_cpu(cpu, downed_cpus) { for_each_cpu(cpu, downed_cpus) {
err = remove_cpu(cpu); err = remove_cpu(cpu);
......
...@@ -58,19 +58,20 @@ static void msr_restore_context(struct saved_context *ctxt) ...@@ -58,19 +58,20 @@ static void msr_restore_context(struct saved_context *ctxt)
} }
/** /**
* __save_processor_state - save CPU registers before creating a * __save_processor_state() - Save CPU registers before creating a
* hibernation image and before restoring the memory state from it * hibernation image and before restoring
* @ctxt - structure to store the registers contents in * the memory state from it
* @ctxt: Structure to store the registers contents in.
* *
* NOTE: If there is a CPU register the modification of which by the * NOTE: If there is a CPU register the modification of which by the
* boot kernel (ie. the kernel used for loading the hibernation image) * boot kernel (ie. the kernel used for loading the hibernation image)
* might affect the operations of the restored target kernel (ie. the one * might affect the operations of the restored target kernel (ie. the one
* saved in the hibernation image), then its contents must be saved by this * saved in the hibernation image), then its contents must be saved by this
* function. In other words, if kernel A is hibernated and different * function. In other words, if kernel A is hibernated and different
* kernel B is used for loading the hibernation image into memory, the * kernel B is used for loading the hibernation image into memory, the
* kernel A's __save_processor_state() function must save all registers * kernel A's __save_processor_state() function must save all registers
* needed by kernel A, so that it can operate correctly after the resume * needed by kernel A, so that it can operate correctly after the resume
* regardless of what kernel B does in the meantime. * regardless of what kernel B does in the meantime.
*/ */
static void __save_processor_state(struct saved_context *ctxt) static void __save_processor_state(struct saved_context *ctxt)
{ {
...@@ -181,9 +182,9 @@ static void fix_processor_context(void) ...@@ -181,9 +182,9 @@ static void fix_processor_context(void)
} }
/** /**
* __restore_processor_state - restore the contents of CPU registers saved * __restore_processor_state() - Restore the contents of CPU registers saved
* by __save_processor_state() * by __save_processor_state()
* @ctxt - structure to load the registers contents from * @ctxt: Structure to load the registers contents from.
* *
* The asm code that gets us here will have restored a usable GDT, although * The asm code that gets us here will have restored a usable GDT, although
* it will be pointing to the wrong alias. * it will be pointing to the wrong alias.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment