From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web12.3549.1594351891758715861 for ; Thu, 09 Jul 2020 20:31:32 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: ji-yunx.lu@intel.com) IronPort-SDR: k6qJnDK/IwU2pu4tHn2a0ZYbXi3ArjCU9cWHtqBpgZOvRCtQcGO+YSz85XTWLkPzCGHmvRt70G IZS3PbZNaaxQ== X-IronPort-AV: E=McAfee;i="6000,8403,9677"; a="166235361" X-IronPort-AV: E=Sophos;i="5.75,334,1589266800"; d="scan'208";a="166235361" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jul 2020 20:31:31 -0700 IronPort-SDR: zL/+3EpXk0u10BkdKkbKvwTbAzvfgrOTdq8eevmcyvqC1zq2BjCU3tNaywCvKgIeLCSu/Jj258 EXesjtfAHI8w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,334,1589266800"; d="scan'208";a="484505487" Received: from jlux-desk.gar.corp.intel.com ([10.5.245.53]) by fmsmga005.fm.intel.com with ESMTP; 09 Jul 2020 20:31:29 -0700 From: Ji-yunX Lu To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek , Rahul Kumar Subject: [edk2: PATCH] UefiCpuPkg: To enable X2Apic by default Date: Fri, 10 Jul 2020 11:31:23 +0800 Message-Id: <20200710033123.2236-1-ji-yunx.lu@intel.com> X-Mailer: git-send-email 2.26.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2845 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 Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index ab7a8ed663..70bc5da195 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -488,8 +488,8 @@ CollectProcessorCount ( )=0D {=0D UINTN Index;=0D - CPU_INFO_IN_HOB *CpuInfoInHob;=0D BOOLEAN X2Apic;=0D + CPUID_VERSION_INFO_ECX VersionInfoEcx;=0D =0D //=0D // Send 1st broadcast IPI to APs to wakeup APs=0D @@ -505,26 +505,13 @@ CollectProcessorCount ( CpuPause ();=0D }=0D =0D -=0D - //=0D - // Enable x2APIC mode if=0D - // 1. Number of CPU is greater than 255; or=0D - // 2. There are any logical processors reporting an Initial APIC ID of = 255 or greater.=0D - //=0D X2Apic =3D FALSE;=0D - if (CpuMpData->CpuCount > 255) {=0D + AsmCpuid (CPUID_VERSION_INFO, NULL, NULL, &VersionInfoEcx.Uint32, NULL);= =0D + if (VersionInfoEcx.Bits.x2APIC =3D=3D 1) {=0D //=0D - // If there are more than 255 processor found, force to enable X2APIC= =0D + // Enable x2APIC mode if capable=0D //=0D X2Apic =3D TRUE;=0D - } else {=0D - CpuInfoInHob =3D (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;= =0D - for (Index =3D 0; Index < CpuMpData->CpuCount; Index++) {=0D - if (CpuInfoInHob[Index].InitialApicId >=3D 0xFF) {=0D - X2Apic =3D TRUE;=0D - break;=0D - }=0D - }=0D }=0D =0D if (X2Apic) {=0D --=20 2.26.2.windows.1