Discussion:
[edk2] question about x2apic support
T***@zhaoxin.com
2015-08-10 08:16:20 UTC
Permalink
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.

Best wishes,

本邮件仅针对指定的收件人发送并可胜含有保密或䞓有内容。任䜕非指定收件人所䞺之查阅、蜬发或䜿甚本信息是䞍被允讞的。
劂果悚误收到本邮件请立即告知发件人并删陀本邮件及所有附件。谢谢
The information transmitted in this e-mail is intended only for the addressee and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of this information by persons or entities other than the intended recipient is prohibited. If you received this e-mail in error, please notify the sender immediately, and delete this e-mail and any attachments. Thank you.
Brian J. Johnson
2015-08-10 16:13:32 UTC
Permalink
Post by T***@zhaoxin.com
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?
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
Post by T***@zhaoxin.com
= 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.
--
Brian J. Johnson

--------------------------------------------------------------------

My statements are my own, are not authorized by SGI, and do not
necessarily represent SGI’s positions.

------------------------------------------------------------------------------
Laszlo Ersek
2015-08-10 17:20:04 UTC
Permalink
Post by Brian J. Johnson
Post by T***@zhaoxin.com
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?
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
Post by T***@zhaoxin.com
= 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

------------------------------------------------------------------------------
Continue reading on narkive:
Loading...