Commit a9d608c2 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Dave Hansen
Browse files

x86/apic: Simplify X2APIC ID validation



Currently, x2apic_max_apicid==0 means that there is no max APIC id limit.
But, this means that 0 needs to be special-cased.

Designate UINT_MAX to mean unlimited so that a plain old less than or equal
compare works and there is no special-casing.  Replace the 0 initialization
with UINT_MAX.

[ dhansen: muck with changelog ]

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: default avatarMichael Kelley <mikelley@microsoft.com>
Tested-by: default avatarSohil Mehta <sohil.mehta@intel.com>
Tested-by: Juergen Gross <jgross@suse.com> # Xen PV (dom0 and unpriv. guest)
parent d92e5e7c
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
int x2apic_phys;

static struct apic apic_x2apic_phys;
static u32 x2apic_max_apicid __ro_after_init;
static u32 x2apic_max_apicid __ro_after_init = UINT_MAX;

void __init x2apic_set_max_apicid(u32 apicid)
{
@@ -125,10 +125,7 @@ static int x2apic_phys_probe(void)
/* Common x2apic functions, also used by x2apic_cluster */
int x2apic_apic_id_valid(u32 apicid)
{
	if (x2apic_max_apicid && apicid > x2apic_max_apicid)
		return 0;

	return 1;
	return apicid <= x2apic_max_apicid;
}

unsigned int x2apic_get_apic_id(unsigned long id)