On 09/02/2026 11:37 am, Julian Vetter wrote:
> HVM guests with more than 128 vCPUs require APIC IDs above 255 (since
> APIC ID = vcpu_id * 2), which exceeds the 8-bit xAPIC limit. Currently,
> CPUID leaf 0xB returns EBX=0, making firmware (OVMF/EDK2) fall back to
> CPUID leaf 1 for APIC ID discovery, which is limited to 8 bits and
> cannot distinguish vCPUs with APIC IDs greater than 256.
> To address this, implement proper CPUID leaf 0xB x2APIC topology
> enumeration. Present all vCPUs as cores in a single package with correct
> shift values based on the maximum APIC ID, and non-zero EBX so that
> firmware uses the 32-bit x2APIC ID from EDX. Moreover, set CPUID leaf 1
> EBX[23:16] (max addressable logical processor IDs) to the appropriate
> power-of-2 value, but capped at 255.
>
> Signed-off-by: Julian Vetter <[email protected]>

This may work for cleanly booted VMs, but it's unsafe and will cause VMs
to crash on migrate.

The toolstack needs to choose the APIC IDs and topology.  Alejandro had
a series working on this problem, which needs picking back up. 
https://lore.kernel.org/xen-devel/[email protected]

~Andrew

Reply via email to