Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da540c06 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Greg Kroah-Hartman
Browse files

x86/microcode: Allow late microcode loading with SMT disabled



commit 07d981ad4cf1e78361c6db1c28ee5ba105f96cc1 upstream

The kernel unnecessarily prevents late microcode loading when SMT is
disabled.  It should be safe to allow it if all the primary threads are
online.

Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Acked-by: default avatarBorislav Petkov <bp@suse.de>
Signed-off-by: default avatarDavid Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 760f9488
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -386,13 +386,21 @@ static struct platform_device *microcode_pdev;

static int check_online_cpus(void)
{
	if (num_online_cpus() == num_present_cpus())
		return 0;
	unsigned int cpu;

	/*
	 * Make sure all CPUs are online.  It's fine for SMT to be disabled if
	 * all the primary threads are still online.
	 */
	for_each_present_cpu(cpu) {
		if (topology_is_primary_thread(cpu) && !cpu_online(cpu)) {
			pr_err("Not all CPUs online, aborting microcode update.\n");

			return -EINVAL;
		}
	}

	return 0;
}

static int reload_for_cpu(int cpu)
{