diff mbox series

[2/3] x86/smp: check APIC ID on AP bringup

Message ID 20191121155411.13250-3-roger.pau@citrix.com (mailing list archive)
State Superseded
Headers show
Series x86: enable x2APIC mode regardless of interrupt remapping support | expand

Commit Message

Roger Pau Monné Nov. 21, 2019, 3:54 p.m. UTC
Check that the processor to be woken up APIC ID is addressable in the
current APIC mode.

Note that in practice systems with APIC IDs > 255 should already have
x2APIC enabled by the firmware, and hence this is mostly a safety
belt.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/smpboot.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index f86c15bde3..4e9fe7e03e 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1315,6 +1315,13 @@  int __cpu_up(unsigned int cpu)
     if ( (apicid = x86_cpu_to_apicid[cpu]) == BAD_APICID )
         return -ENODEV;
 
+    if ( (!x2apic_enabled || !iommu_intremap) && (apicid >> 8) )
+    {
+        printk("Processor with APIC ID %u cannot be onlined in xAPIC mode "
+               "or without interrupt remapping\n", apicid);
+        return -EINVAL;
+    }
+
     if ( (ret = do_boot_cpu(apicid, cpu)) != 0 )
         return ret;