BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4172
TDVF once accepts memory only by BSP. To improve the boot performance this patch-set introduce the multi-core accpet memory. Multi-core means BSP and APs work together to accept memory. TDVF leverages mailbox to wake up APs. It is not enabled in MpInitLib (Which requires SIPI). So multi-core accept memory cannot leverages MpInitLib to coordinate BSP and APs to work together. So TDVF split the accept memory into 2 phases. - AcceptMemoryForAPsStack: BSP accepts a small piece of memory which is then used by APs to setup stack. We assign a 16KB stack for each AP. So a td-guest with 256 vCPU requires 255*16KB = 4080KB. - AcceptMemory: After above small piece of memory is accepted, BSP commands APs to accept memory by sending AcceptPages command in td-mailbox. Together with the command and accpet-function, the APsStack address is send as well. APs then set the stack and jump to accept-function to accept memory. Patch 1-3: TdxMailboxLib is refactored to help multi-core lazy accept. Patch 4-5: Refactor APs' logical to support accpet page. Patch 6: Implement multi-core accept in TDVF. Code: https://github.com/mxu9/edk2/tree/Multi-Core-Lazy-Accept.v2 v2 changes: - Fix an override error when vCPU number is larger than 64. Cc: Erdem Aktas <erdemak...@google.com> Cc: Gerd Hoffmann <kra...@redhat.com> Cc: James Bottomley <j...@linux.ibm.com> Cc: Jiewen Yao <jiewen....@intel.com> Cc: Tom Lendacky <thomas.lenda...@amd.com> Signed-off-by: Min Xu <min.m...@intel.com> Min M Xu (6): OvmfPkg/TdxMailboxLib: Delete global variables OvmfPkg/TdxMailboxLib: Add NULL instance of TdxMailboxLib OvmfPkg: Add TdxMailboxLibNull in some platform dsc OvmfPkg/Sec: Move TDX APs related nasm code to IntelTdxAPs.nasm OvmfPkg: Enable APs to accept memory for TDVF OvmfPkg/PlatformInitLib: Implement multi-core accept memory for TDVF OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + OvmfPkg/CloudHv/CloudHvX64.dsc | 1 + OvmfPkg/Include/TdxCommondefs.inc | 4 +- OvmfPkg/IntelTdx/Sec/X64/IntelTdxAPs.nasm | 119 +++++ OvmfPkg/IntelTdx/Sec/X64/SecEntry.nasm | 58 +-- OvmfPkg/Library/PlatformInitLib/IntelTdx.c | 411 +++++++++++++++--- .../PlatformInitLib/PlatformInitLib.inf | 1 + OvmfPkg/Library/TdxMailboxLib/TdxMailbox.c | 22 +- .../Library/TdxMailboxLib/TdxMailboxLib.inf | 7 +- .../TdxMailboxLib/TdxMailboxLibNull.inf | 34 ++ OvmfPkg/Microvm/MicrovmX64.dsc | 1 + OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 2 +- OvmfPkg/Sec/X64/SecEntry.nasm | 58 +-- 14 files changed, 545 insertions(+), 175 deletions(-) create mode 100644 OvmfPkg/IntelTdx/Sec/X64/IntelTdxAPs.nasm create mode 100644 OvmfPkg/Library/TdxMailboxLib/TdxMailboxLibNull.inf -- 2.29.2.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#97618): https://edk2.groups.io/g/devel/message/97618 Mute This Topic: https://groups.io/mt/95782426/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-