From: Roger Pau Monné Date: Fri, 20 Dec 2019 15:28:27 +0000 (+0100) Subject: x86/smp: check APIC ID on AP bringup X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~1006 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3d05407025ed1f83f492f81ba8175fa26b1e2fb3;p=xen.git x86/smp: check APIC ID on AP bringup 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é Reviewed-by: Jan Beulich --- diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index fa691b6ba0..e439845802 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -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;