On 08/10/15 18:13, Brian J. Johnson wrote:
> On 08/10/2015 03:16 AM, tiger...@zhaoxin.com wrote:
>> Hello, experts:
>>
>> I have a question about x2apic support in UEFI BIOS.
>>
>> Could UEFI BIOS determine switching to xapic or x2apic when handing off
>> to OS loader?
>>
>> Some webpages said:
>>
>> If CPU number < 255, BIOS should set to xapic mode.
> 
> Yes, Intel's specs. say that if all threads' APIC IDs are < 255, then 
> the system should start in xapic mode.  Otherwise it should start in 
> x2apic mode.
> 
> BIOSes which I've seen make this decision in CpuMpDxe, when determining 
> the APIC IDs for all the CPUs.  I don't know how you'd do it later on, 
> during loader handoff... once the APs' APICs are initialized, you need 
> to be in x2apic mode in order to send interrupts to CPUs with APIC IDs 
>  >= 255.  So BIOS would have no way to wake up the high-numbered APs to 
> finish their initialization if CpuMpDxe didn't switch the BSP to x2apic 
> mode.
> 
> I'm not sure if OVMF's CpuMpDxe handles booting in x2apic mode or not. 
> I haven't looked.

OVMF resolves LocalApicLib to

  UefiCpuPkg/Library/BaseXApicLib

not

  UefiCpuPkg/Library/BaseXApicX2ApicLib

The former's INF file says "The Local Apic library supports xAPIC mode
only". The latter's says, "The Local Apic library supports x2APIC
capable processors which have xAPIC and x2APIC modes."

FWIW,

- KVM guests on x86 don't seem to support more than 255:
  arch/x86/include/asm/kvm_host.h:#define KVM_MAX_VCPUS 255

- the count for fullvirt Xen guests on x86 appears to be 128:
  xen/include/public/hvm/hvm_info_table.h:#define HVM_MAX_VCPUS        128

So I think OVMF should be alright with xAPIC only.

Thanks!
Laszlo

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to