Commit 9ff4275b authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

x86/apic: Use BAD_APICID consistently



APIC ID checks compare with BAD_APICID all over the place, but some
initializers and some code which fiddles with global data structure use
-1[U] instead. That simply cannot work at all.

Fix it up and use BAD_APICID consistently all over the place.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarJuergen Gross <jgross@suse.com>
Tested-by: default avatarSohil Mehta <sohil.mehta@intel.com>
Tested-by: default avatarMichael Kelley <mikelley@microsoft.com>
Tested-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: default avatarZhang Rui <rui.zhang@intel.com>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230814085112.862835121@linutronix.de
parent 6e290323
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -856,7 +856,7 @@ int acpi_unmap_cpu(int cpu)
	set_apicid_to_node(per_cpu(x86_cpu_to_apicid, cpu), NUMA_NO_NODE);
#endif

	per_cpu(x86_cpu_to_apicid, cpu) = -1;
	per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID;
	set_cpu_present(cpu, false);
	num_processors--;

+2 −4
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ unsigned int num_processors;
unsigned disabled_cpus;

/* Processor that is doing the boot up */
unsigned int boot_cpu_physical_apicid __ro_after_init = -1U;
unsigned int boot_cpu_physical_apicid __ro_after_init = BAD_APICID;
EXPORT_SYMBOL_GPL(boot_cpu_physical_apicid);

u8 boot_cpu_apic_version __ro_after_init;
@@ -2318,9 +2318,7 @@ static int nr_logical_cpuids = 1;
/*
 * Used to store mapping between logical CPU IDs and APIC IDs.
 */
int cpuid_to_apicid[] = {
	[0 ... NR_CPUS - 1] = -1,
};
int cpuid_to_apicid[] = { [0 ... NR_CPUS - 1] = BAD_APICID, };

bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
{