From: Ji-yunX Lu <ji-yunx.lu@intel.com>
To: devel@edk2.groups.io
Cc: Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
Laszlo Ersek <lersek@redhat.com>,
Rahul Kumar <rahul1.kumar@intel.com>
Subject: [edk2: PATCH] UefiCpuPkg: To enable X2Apic by default
Date: Fri, 10 Jul 2020 11:31:23 +0800 [thread overview]
Message-ID: <20200710033123.2236-1-ji-yunx.lu@intel.com> (raw)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2845
Platform shall enable X2APIC by default to meet requirements for interrupt steering policy on Windows OS.
Change-Id: Ia9e24bce79c91762c560fa3de6260716939f0b1b
Signed-off-by: Ji-yunX Lu <ji-yunx.lu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
---
UefiCpuPkg/Library/MpInitLib/MpLib.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index ab7a8ed663..70bc5da195 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -488,8 +488,8 @@ CollectProcessorCount (
)
{
UINTN Index;
- CPU_INFO_IN_HOB *CpuInfoInHob;
BOOLEAN X2Apic;
+ CPUID_VERSION_INFO_ECX VersionInfoEcx;
//
// Send 1st broadcast IPI to APs to wakeup APs
@@ -505,26 +505,13 @@ CollectProcessorCount (
CpuPause ();
}
-
- //
- // Enable x2APIC mode if
- // 1. Number of CPU is greater than 255; or
- // 2. There are any logical processors reporting an Initial APIC ID of 255 or greater.
- //
X2Apic = FALSE;
- if (CpuMpData->CpuCount > 255) {
+ AsmCpuid (CPUID_VERSION_INFO, NULL, NULL, &VersionInfoEcx.Uint32, NULL);
+ if (VersionInfoEcx.Bits.x2APIC == 1) {
//
- // If there are more than 255 processor found, force to enable X2APIC
+ // Enable x2APIC mode if capable
//
X2Apic = TRUE;
- } else {
- CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;
- for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
- if (CpuInfoInHob[Index].InitialApicId >= 0xFF) {
- X2Apic = TRUE;
- break;
- }
- }
}
if (X2Apic) {
--
2.26.2.windows.1
next reply other threads:[~2020-07-10 3:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-10 3:31 Ji-yunX Lu [this message]
2020-07-10 5:38 ` [edk2: PATCH] UefiCpuPkg: To enable X2Apic by default Laszlo Ersek
2020-07-10 11:51 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200710033123.2236-1-ji-yunx.lu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox