public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: devel@edk2.groups.io
Cc: Eric Dong <eric.dong@intel.com>,
	Rahul Kumar <rahul1.kumar@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH 3/4] UefiCpuPkg/MpInitLib: Skip X2APIC enabling when BSP in X2APIC already
Date: Fri,  7 Jul 2023 13:29:00 +0800	[thread overview]
Message-ID: <20230707052901.869-4-ray.ni@intel.com> (raw)
In-Reply-To: <20230707052901.869-1-ray.ni@intel.com>

The BSP's APIC mode is synced to all APs in CollectProcessorCount().
So, it's safe to skip the X2 APIC enabling in AutoEnableX2Apic() which
runs later when BSP's APIC mode is X2 APIC already.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 2372475a04..5a8ed027be 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1998,7 +1998,9 @@ MpInitLibInitialize (
       //
       // Enable X2APIC if needed.
       //
-      AutoEnableX2Apic (CpuMpData);
+      if (CpuMpData->InitialBspApicMode == LOCAL_APIC_MODE_XAPIC) {
+        AutoEnableX2Apic (CpuMpData);
+      }
 
       //
       // Sort BSP/Aps by CPU APIC ID in ascending order
-- 
2.39.1.windows.1


  parent reply	other threads:[~2023-07-07  5:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07  5:28 [PATCH 0/4] Sync BSP's APIC mode to APs in MP init flow Ni, Ray
2023-07-07  5:28 ` [PATCH 1/4] UefiCpuPkg/MpInitLib: Separate X2APIC enabling to subfunction Ni, Ray
2023-07-07  5:28 ` [PATCH 2/4] UefiCpuPkg/MpInitLib: Sync BSP's APIC mode to APs in InitConfig path Ni, Ray
2023-07-07  5:29 ` Ni, Ray [this message]
2023-07-07  5:29 ` [PATCH 4/4] UefiCpuPkg/CpuFeatures: Deprecate CPU_FEATURE_X2APIC Ni, Ray
2023-07-07  8:55 ` [edk2-devel] [PATCH 0/4] Sync BSP's APIC mode to APs in MP init flow Gerd Hoffmann
2023-07-07  9:25   ` Ni, Ray
2023-07-07 11:26     ` Gerd Hoffmann
2023-11-09 16:29       ` Aaron Young via groups.io
2023-11-09 18:08         ` Michael D Kinney
2023-11-13 12:32           ` 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=20230707052901.869-4-ray.ni@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