x86/apic: Fix x2apic enablement without interrupt remapping
[ Upstream commit 26573a97746c7a99f394f9d398ce91a8853b3b89 ]
Currently, Linux as a hypervisor guest will enable x2apic only if there are
no CPUs present at boot time with an APIC ID above 255.
Hotplugging a CPU later with a higher APIC ID would result in a CPU which
cannot be targeted by external interrupts.
Add a filter in x2apic_apic_id_valid() which can be used to prevent such
CPUs from coming online, and allow x2apic to be enabled even if they are
present at boot time.
Fixes: ce69a78450
("x86/apic: Enable x2APIC without interrupt remapping under KVM")
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201024213535.443185-2-dwmw2@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
459c15dd68
commit
b8ab21e017
@@ -8,6 +8,12 @@
|
||||
int x2apic_phys;
|
||||
|
||||
static struct apic apic_x2apic_phys;
|
||||
static u32 x2apic_max_apicid __ro_after_init;
|
||||
|
||||
void __init x2apic_set_max_apicid(u32 apicid)
|
||||
{
|
||||
x2apic_max_apicid = apicid;
|
||||
}
|
||||
|
||||
static int __init set_x2apic_phys_mode(char *arg)
|
||||
{
|
||||
@@ -98,6 +104,9 @@ 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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user