public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V2 0/6] Enable Multi-core based lazy-accept for TDVF
@ 2022-12-20  8:42 Min Xu
  2022-12-20  8:42 ` [PATCH V2 1/6] OvmfPkg/TdxMailboxLib: Delete global variables Min Xu
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Min Xu @ 2022-12-20  8:42 UTC (permalink / raw)
  To: devel
  Cc: Min Xu, Erdem Aktas, Gerd Hoffmann, James Bottomley, Jiewen Yao,
	Tom Lendacky

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 <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-12-21  8:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-20  8:42 [PATCH V2 0/6] Enable Multi-core based lazy-accept for TDVF Min Xu
2022-12-20  8:42 ` [PATCH V2 1/6] OvmfPkg/TdxMailboxLib: Delete global variables Min Xu
2022-12-20  8:42 ` [PATCH V2 2/6] OvmfPkg/TdxMailboxLib: Add NULL instance of TdxMailboxLib Min Xu
2022-12-20  8:42 ` [PATCH V2 3/6] OvmfPkg: Add TdxMailboxLibNull in some platform dsc Min Xu
2022-12-20  8:42 ` [PATCH V2 4/6] OvmfPkg/Sec: Move TDX APs related nasm code to IntelTdxAPs.nasm Min Xu
2022-12-20  8:42 ` [PATCH V2 5/6] OvmfPkg: Enable APs to accept memory for TDVF Min Xu
2022-12-20  8:42 ` [PATCH V2 6/6] OvmfPkg/PlatformInitLib: Implement multi-core " Min Xu
2022-12-21  8:07 ` [PATCH V2 0/6] Enable Multi-core based lazy-accept " Yao, Jiewen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox