From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ml01.01.org (Postfix) with ESMTP id 469201A1E0F for ; Tue, 2 Aug 2016 01:59:55 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 02 Aug 2016 01:59:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,459,1464678000"; d="scan'208";a="743018645" Received: from jfan12-desk.ccr.corp.intel.com ([10.239.9.5]) by FMSMGA003.fm.intel.com with ESMTP; 02 Aug 2016 01:59:53 -0700 From: Jeff Fan To: edk2-devel@lists.01.org Date: Tue, 2 Aug 2016 16:59:00 +0800 Message-Id: <1470128388-17960-1-git-send-email-jeff.fan@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 Subject: [Patch v5 00/48] MP Initialize Library X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 08:59:55 -0000 We add MP Initialize Library defined in UefiCpuPkg/Include/Library/MpInitLib.h. It will provide basic functionalities of MP services and could be consumed by CPU MP PEI and CPU MP DXE to produce CPU MP PPI and CPU MP Protocol. Then most of code could be shared between PEI and DXE modules. PeiMpInitLib and DxeMpInitLib are added to make the CpuMpPei and CpuDxe more simply. I also updated the Ovmf Platform and Quark platform to consume MP Initialize library. Thanks Laszlo to verify on OVMF and Mike to verify on Quark. v5: 1. Update Patches #1, #5, #10 - #12, #14, #16 - #18, #20, #21, #28, #29, #37, #43. 2. Add Patches #44, #48 (Please see the patches commit log for more details) v4: 1. Update Patches #2 - #6, #10, #15, #28, #30, #31, #33, #34, #38, #41, #43. 2. Add Patches #7, #8, #42, #44 - #46. 3. Add Reviewed-by: Laszlo Ersek on Patches #1, #2. (Please see the patches commit log for more details) v3: 1. Update Patch #2, #4 - #8, #28, #33, #36, #38 per Giri's comments to a. Update SDM date to June, 2016 b. Mention BCD format in CPU_MICROCODE_DATE c. Rename ProcessorChecksum to Checksum to match SDM. d. Add whitespace after MpInitLibInitialize e. Rename MpInitLibSwitchBsp to MpInitLibSwitchBSP to match PI spec. f. Rename NumApsExecutingLoction to NumApsExecutingLocation g. Add whitespace after ; in .nasm file h. Rename *RellocateAp* to *RelocateAp* 2. Update Patch #16, #17, #29-#32 to a. Use CamelCase for mStopCheckAllApsStatus and CheckAndUpdateApsStatus(). 3. Update Patch #36 and #39 to a. Add PeiMpInitLib instance in UefiCpuPkg.dsc b. Add DxeMpInitLib instance in UefiCpuPkg.dsc 4. Update Patch #39 and #40 to a. move the code of consuming MP Initialize library from patch #40 to patch #39. 5. Update Patch #1, #3 - #8, #16 to a. Add Reviewed-by: Giri P Mudusuru I fork the whole tree with the updated v3 patches at https://github.com/vanjeff/edk2/tree/MpInitLibV5 for review. Jeff Fan (48): UefiCpuPkg/LocalApic.h: Remove duplicated/conflicted definitions UefiCpuPkg/MpInitLib: Add microcode definitions defined in IA32 SDM UefiCpuPkg/CpuS3DataDxe: Move StartupVector allocation to EndOfDxe() UefiCpuPkg/MpInitLib: Add MP Initialize library class definition UefiCpuPkg/MpInitLib: Add two instances PeiMpInitLib and DxeMpInitLib UefiCpuPkg/MpInitLib: Add AP assembly code and MP_CPU_EXCHANGE_INFO UefiCpuPkg/MpInitLib: Fix typo and clean up the code UefiCpuPkg/MpInitLib: Add EnableExecuteDisable in MP_CPU_EXCHANGE_INFO UefiCpuPkg/MpInitLib: Add AsmRelocateApLoop() assembly code UefiCpuPkg/MpInitLib: Add MP_ASSEMBLY_ADDRESS_MAP UefiCpuPkg/MpInitLib: Get ApLoopMode and MointorFilter size UefiCpuPkg/MpInitLib: Allocate and initialize memory of MP Data buffer UefiCpuPkg/MpInitLib: Initialize CPU_AP_DATA for CPU APs UefiCpuPkg/MpInitLib: Add CPU_VOLATILE_REGISTERS & worker functions UefiCpuPkg/MpInitLib: Add MicrocodeDetect() and load microcode on BSP UefiCpuPkg/MpInitLib: Save CPU MP Data pointer UefiCpuPkg/MpInitLib: Register one End of PEI callback function UefiCpuPkg/MpInitLib: Register one period event to check APs status UefiCpuPkg/MpInitLib: Allocate AP reset vector buffer under 1MB UefiCpuPkg/MpInitLib: Add ApWakeupFunction() executed by assembly code UefiCpuPkg/MpInitLib: Fill MP_CPU_EXCHANGE_INFO fields UefiCpuPkg/MpInitLib: Add WakeUpAP() UefiCpuPkg/MpInitLib: Send INIT-SIPI-SIPI to get processor count UefiCpuPkg/MpInitLib: Enable x2APIC mode on BSP/APs UefiCpuPkg/MpInitLib: Sort processor by ascending order of APIC ID UefiCpuPkg/MpInitLib: Skip collect processor count if GUIDed HOB exist UefiCpuPkg/MpInitLib: Implementation of MpInitLibGetNumberOfProcessors() UefiCpuPkg/MpInitLib: Implementation of MpInitLibGetProcessorInfo() UefiCpuPkg/MpInitLib: Implementation of MpInitLibWhoAmI() UefiCpuPkg/MpInitLib: Implementation of MpInitLibSwitchBSP() UefiCpuPkg/MpInitLib: Implementation of MpInitLibEnableDisableAP() UefiCpuPkg/MpInitLib: Check APs Status and update APs status UefiCpuPkg/MpInitLib: Implementation of MpInitLibStartupThisAP() UefiCpuPkg/MpInitLib: Implementation of MpInitLibStartupAllAPs() UefiCpuPkg/MpInitLib: Place APs in safe loop before hand-off to OS OvmfPkg: Add MpInitLib reference in DSC files. QuarkPlatformPkg: Add MpInitLib reference in DSC files. UefiCpuPkg/CpuMpPei: Consume MpInitLib to produce CPU MP PPI services UefiCpuPkg/CpuMpPei: Remove unused files and codes UefiCpuPkg/CpuMpPei: Delete PeiMpServices.c and PeiMpServices.h UefiCpuPkg/CpuDxe: Consume MpInitLib to produce CPU MP Protocol services UefiCpuPkg/CpuDxe: Move SetMtrrsFromBuffer() location. UefiCpuPkg/CpuDxe: Remove unused codes and files UefiCpuPkg/CpuDxe: Remove PcdCpuMaxLogicalProcessorNumber consuming MdePkg/MpService.h: Fixed typo in function header to match PI spec MdePkg/MpService.h: Trim whitespace at end of line UefiCpuPkg/CpuDxe: Fixed typo in function header to match PI spec UefiCpuPkg/PiSmmCpuDxeSmm: Add gEfiVariableArchProtocolGuid dependency MdePkg/Include/Protocol/MpService.h | 490 ++--- OvmfPkg/OvmfPkgIa32.dsc | 2 + OvmfPkg/OvmfPkgIa32X64.dsc | 2 + OvmfPkg/OvmfPkgX64.dsc | 2 + QuarkPlatformPkg/Quark.dsc | 2 + QuarkPlatformPkg/QuarkMin.dsc | 4 +- .../DebugAgent/DebugAgentCommon/DebugAgent.h | 1 + .../Library/DebugAgent/DebugAgentCommon/DebugMp.c | 5 +- UefiCpuPkg/CpuDxe/ApStartup.c | 478 ----- UefiCpuPkg/CpuDxe/CpuDxe.c | 17 +- UefiCpuPkg/CpuDxe/CpuDxe.h | 13 +- UefiCpuPkg/CpuDxe/CpuDxe.inf | 17 +- UefiCpuPkg/CpuDxe/CpuDxe.uni | 10 +- UefiCpuPkg/CpuDxe/CpuDxeExtra.uni | 4 +- UefiCpuPkg/CpuDxe/CpuMp.c | 1306 +------------ UefiCpuPkg/CpuDxe/CpuMp.h | 186 +- UefiCpuPkg/CpuDxe/Ia32/MpAsm.asm | 76 - UefiCpuPkg/CpuDxe/Ia32/MpAsm.nasm | 68 - UefiCpuPkg/CpuDxe/X64/MpAsm.asm | 76 - UefiCpuPkg/CpuDxe/X64/MpAsm.nasm | 70 - UefiCpuPkg/CpuMpPei/CpuBist.c | 53 +- UefiCpuPkg/CpuMpPei/CpuMpPei.c | 1118 ++++------- UefiCpuPkg/CpuMpPei/CpuMpPei.h | 515 ++--- UefiCpuPkg/CpuMpPei/CpuMpPei.inf | 32 +- UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm | 250 --- UefiCpuPkg/CpuMpPei/Microcode.h | 58 - UefiCpuPkg/CpuMpPei/PeiMpServices.c | 956 ---------- UefiCpuPkg/CpuMpPei/PeiMpServices.h | 377 ---- UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm | 290 --- UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c | 42 +- UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf | 2 +- UefiCpuPkg/Include/Library/MpInitLib.h | 353 ++++ UefiCpuPkg/Include/Register/LocalApic.h | 20 +- UefiCpuPkg/Include/Register/Microcode.h | 200 ++ UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 29 +- .../BaseXApicX2ApicLib/BaseXApicX2ApicLib.c | 51 +- .../MpInitLib/DxeMpInitLib.inf} | 68 +- .../MpInitLib/DxeMpInitLib.uni} | 12 +- UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 649 +++++++ .../{CpuMpPei => Library/MpInitLib}/Ia32/MpEqu.inc | 4 +- .../MpInitLib}/Ia32/MpFuncs.nasm | 66 +- .../{CpuMpPei => Library/MpInitLib}/Microcode.c | 77 +- UefiCpuPkg/Library/MpInitLib/MpLib.c | 2013 ++++++++++++++++++++ UefiCpuPkg/Library/MpInitLib/MpLib.h | 554 ++++++ .../MpInitLib/PeiMpInitLib.inf} | 60 +- .../MpInitLib/PeiMpInitLib.uni} | 12 +- UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 643 +++++++ .../{CpuMpPei => Library/MpInitLib}/X64/MpEqu.inc | 6 +- .../MpInitLib}/X64/MpFuncs.nasm | 84 +- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 4 +- UefiCpuPkg/UefiCpuPkg.dec | 4 + UefiCpuPkg/UefiCpuPkg.dsc | 4 + 52 files changed, 5777 insertions(+), 5658 deletions(-) delete mode 100644 UefiCpuPkg/CpuDxe/ApStartup.c delete mode 100644 UefiCpuPkg/CpuDxe/Ia32/MpAsm.asm delete mode 100644 UefiCpuPkg/CpuDxe/Ia32/MpAsm.nasm delete mode 100644 UefiCpuPkg/CpuDxe/X64/MpAsm.asm delete mode 100644 UefiCpuPkg/CpuDxe/X64/MpAsm.nasm delete mode 100644 UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm delete mode 100644 UefiCpuPkg/CpuMpPei/Microcode.h delete mode 100644 UefiCpuPkg/CpuMpPei/PeiMpServices.c delete mode 100644 UefiCpuPkg/CpuMpPei/PeiMpServices.h delete mode 100644 UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm create mode 100644 UefiCpuPkg/Include/Library/MpInitLib.h create mode 100644 UefiCpuPkg/Include/Register/Microcode.h copy UefiCpuPkg/{CpuMpPei/CpuMpPei.inf => Library/MpInitLib/DxeMpInitLib.inf} (52%) copy UefiCpuPkg/{CpuDxe/CpuDxeExtra.uni => Library/MpInitLib/DxeMpInitLib.uni} (53%) create mode 100644 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c rename UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/Ia32/MpEqu.inc (88%) rename UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/Ia32/MpFuncs.nasm (77%) rename UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/Microcode.c (68%) create mode 100644 UefiCpuPkg/Library/MpInitLib/MpLib.c create mode 100644 UefiCpuPkg/Library/MpInitLib/MpLib.h copy UefiCpuPkg/{CpuMpPei/CpuMpPei.inf => Library/MpInitLib/PeiMpInitLib.inf} (58%) copy UefiCpuPkg/{CpuDxe/CpuDxeExtra.uni => Library/MpInitLib/PeiMpInitLib.uni} (53%) create mode 100644 UefiCpuPkg/Library/MpInitLib/PeiMpLib.c rename UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/X64/MpEqu.inc (88%) rename UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/X64/MpFuncs.nasm (73%) -- 2.7.4.windows.1