]> xenbits.xensource.com Git - xen.git/commitdiff
x86/smp: check APIC ID on AP bringup
authorRoger Pau Monné <roger.pau@citrix.com>
Fri, 20 Dec 2019 15:28:27 +0000 (16:28 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 20 Dec 2019 15:28:27 +0000 (16:28 +0100)
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>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/smpboot.c

index fa691b6ba0637e4b2c5fb4481a676f94c48681e2..e4398458027d5512a5c6fae0cf1947504c2dc328 100644 (file)
@@ -1317,6 +1317,14 @@ int __cpu_up(unsigned int cpu)
     if ( (apicid = x86_cpu_to_apicid[cpu]) == BAD_APICID )
         return -ENODEV;
 
+    if ( (!x2apic_enabled && apicid >= APIC_ALL_CPUS) ||
+         (!iommu_intremap && (apicid >> 8)) )
+    {
+        printk("Unsupported: APIC ID %#x in xAPIC mode w/o interrupt remapping\n",
+               apicid);
+        return -EINVAL;
+    }
+
     if ( (ret = do_boot_cpu(apicid, cpu)) != 0 )
         return ret;