From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web10.6404.1688707749454802251 for ; Thu, 06 Jul 2023 22:29:12 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=OipK6MGw; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688707752; x=1720243752; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ST15m3TjMTp6VqNP7xhfCs19sZgeRAPzoJJxjxDq+34=; b=OipK6MGwSMoLhi4PD0jUYpKGjLFd/mjOAfZKXBMkFxajrojQRvnt2tKF qy/Tb1YrDjFaQIDP5N8+1bFAogMW6MSO8qYJFeGt69vYEw1lPyyrRlQLR a/5jpG/2wKzm2ELa2/xMcMie9+2R6pKJWGWGvEbYq7/r+L0hdBSxMwfHG p2jf+Hq27sTjO6wN8lFpgzSzIUWviJ4INc4RfW3b6+AQw/2e6UMsfYChV x7KhfCzr6IeC4PC19N9VUPNtRPMmNHa6DnbrnTbwnwfo4n7Bn4IoFmw+N 09XcSVPwJkFGwOB/pIy1qo8DMZwTJxhHJ5X2EBqTDbcJT84cqY2DxcCLo Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10763"; a="353650660" X-IronPort-AV: E=Sophos;i="6.01,187,1684825200"; d="scan'208";a="353650660" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2023 22:29:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10763"; a="833232036" X-IronPort-AV: E=Sophos;i="6.01,187,1684825200"; d="scan'208";a="833232036" Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.55.95]) by fmsmga002.fm.intel.com with ESMTP; 06 Jul 2023 22:29:11 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Eric Dong , Rahul Kumar , Gerd Hoffmann Subject: [PATCH 3/4] UefiCpuPkg/MpInitLib: Skip X2APIC enabling when BSP in X2APIC already Date: Fri, 7 Jul 2023 13:29:00 +0800 Message-Id: <20230707052901.869-4-ray.ni@intel.com> X-Mailer: git-send-email 2.39.1.windows.1 In-Reply-To: <20230707052901.869-1-ray.ni@intel.com> References: <20230707052901.869-1-ray.ni@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 Cc: Eric Dong Cc: Rahul Kumar Cc: Gerd Hoffmann --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index 2372475a04..5a8ed027be 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1998,7 +1998,9 @@ MpInitLibInitialize ( //=0D // Enable X2APIC if needed.=0D //=0D - AutoEnableX2Apic (CpuMpData);=0D + if (CpuMpData->InitialBspApicMode =3D=3D LOCAL_APIC_MODE_XAPIC) {=0D + AutoEnableX2Apic (CpuMpData);=0D + }=0D =0D //=0D // Sort BSP/Aps by CPU APIC ID in ascending order=0D --=20 2.39.1.windows.1