public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH 00/16] Provide SEV-SNP support for running under an SVSM
@ 2024-01-26 22:12 Lendacky, Thomas via groups.io
  2024-01-26 22:13 ` [edk2-devel] [PATCH 01/16] OvmfPkg/BaseMemEncryptSevLib: Re-organize page state change support Lendacky, Thomas via groups.io
                   ` (16 more replies)
  0 siblings, 17 replies; 56+ messages in thread
From: Lendacky, Thomas via groups.io @ 2024-01-26 22:12 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Erdem Aktas, Gerd Hoffmann, Jiewen Yao,
	Laszlo Ersek, Liming Gao, Michael D Kinney, Min Xu, Zhiguang Liu,
	Rahul Kumar, Ray Ni, Michael Roth


BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4654

This series adds SEV-SNP support for running OVMF under an Secure VM
Service Module (SVSM) at a less privileged VM Privilege Level (VMPL).
By running at a less priviledged VMPL, the SVSM can be used to provide
services, e.g. a virtual TPM, for the guest OS within the SEV-SNP
confidential VM (CVM) rather than trust such services from the hypervisor.

Currently, OVMF expects to run at the highest VMPL, VMPL0, and there are
certain SNP related operations that require that VMPL level. Specifically,
the PVALIDATE instruction and the RMPADJUST instruction when setting the
the VMSA attribute of a page (used when starting APs).

If OVMF is to run at a less privileged VMPL, e.g. VMPL2, then it must
use an SVSM (which is running at VMPL0) to perform the operations that
it is no longer able to perform.

How OVMF interacts with and uses the SVSM is documented in the SVSM
specification [1] and the GHCB specification [2].

This series introduces support to run OVMF under an SVSM. It consists
of:
  - Reorganize the page state change support to not directly use the
    GHCB buffer since an SVSM will use the calling area buffer, instead
  - Detecting the presence of an SVSM
  - When not running at VMPL0, invoking the SVSM for page validation and
    VMSA page creation/deletion
  - Retrieving the list of vCPU APIC IDs and starting up all APs without
    performing a broadcast SIPI
  - Detecting and allowing OVMF to run in a VMPL other than 0 when an
    SVSM is present

The series is based off of commit:

  7d7decfa3dc8 ("UefiPayloadPkg/Crypto: Support external Crypto drivers.")

[1] https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/58019.pdf
[2] https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/56421.pdf

---

Tom Lendacky (16):
  OvmfPkg/BaseMemEncryptSevLib: Re-organize page state change support
  MdePkg/Register/Amd: Define the SVSM related information
  MdePkg/BaseLib: Add a new VMGEXIT instruction invocation for SVSM
  UefiCpuPkg/CcExitLib: Extend the CcExitLib library to support an SVSM
  Ovmfpkg/CcExitLib: Extend CcExitLib to handle SVSM related services
  OvmfPkg: Create a calling area used to communicate with the SVSM
  OvmfPkg/CcExitLib: Add support for the SVSM_CORE_PVALIDATE call
  OvmfPkg/CcExitLib: Add support for the SVSM create/delete vCPU calls
  UefiCpuPkg/MpInitLib: Use CcExitSnpVmsaRmpAdjust() to set/clear VMSA
  MdePkg: GHCB APIC ID retrieval support definitions
  UefiCpuPkg: Create APIC ID list PCD
  OvmfPkg/PlatformPei: Retrieve APIC IDs from the hypervisor
  UefiCpuPkg/MpInitLib: Always use AP Create if PcdSevSnpApicIds is set
  UefiCpuPkg/MpInitLib: AP creation support under an SVSM
  Ovmfpkg/CcExitLib: Provide SVSM discovery support
  OvmfPkg/BaseMemEncryptLib: Check for presence of an SVSM when not at
    VMPL0

 OvmfPkg/OvmfPkg.dec                                                   |   4 +
 UefiCpuPkg/UefiCpuPkg.dec                                             |   7 +-
 OvmfPkg/AmdSev/AmdSevX64.fdf                                          |   9 +-
 OvmfPkg/OvmfPkgX64.fdf                                                |   3 +
 MdePkg/Library/BaseLib/BaseLib.inf                                    |   2 +
 OvmfPkg/Library/CcExitLib/CcExitLib.inf                               |   5 +-
 OvmfPkg/Library/CcExitLib/SecCcExitLib.inf                            |   5 +-
 OvmfPkg/PlatformPei/PlatformPei.inf                                   |   3 +
 OvmfPkg/ResetVector/ResetVector.inf                                   |   2 +
 UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf                         |   1 +
 UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf                         |   3 +-
 MdePkg/Include/Library/BaseLib.h                                      |  39 ++
 MdePkg/Include/Register/Amd/Fam17Msr.h                                |  19 +-
 MdePkg/Include/Register/Amd/Ghcb.h                                    |  19 +-
 MdePkg/Include/Register/Amd/Msr.h                                     |   3 +-
 MdePkg/Include/Register/Amd/Svsm.h                                    | 101 ++++
 MdePkg/Include/Register/Amd/SvsmMsr.h                                 |  35 ++
 OvmfPkg/Include/WorkArea.h                                            |   7 +
 OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChange.h         |   4 +-
 OvmfPkg/Library/CcExitLib/CcExitSvsm.h                                |  29 ++
 UefiCpuPkg/Include/Library/CcExitLib.h                                |  71 ++-
 UefiCpuPkg/Library/MpInitLib/MpLib.h                                  |  27 +-
 OvmfPkg/Library/BaseMemEncryptSevLib/X64/DxeSnpSystemRamValidate.c    |  16 +-
 OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c        |  25 +-
 OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiSnpSystemRamValidate.c    |  20 +-
 OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c    |  25 +-
 OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c | 203 ++++----
 OvmfPkg/Library/CcExitLib/CcExitSvsm.c                                | 532 ++++++++++++++++++++
 OvmfPkg/Library/CcExitLib/CcExitVcHandler.c                           |  29 +-
 OvmfPkg/PlatformPei/AmdSev.c                                          | 100 +++-
 UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.c                      |  82 ++-
 UefiCpuPkg/Library/MpInitLib/Ia32/AmdSev.c                            |  19 +-
 UefiCpuPkg/Library/MpInitLib/MpLib.c                                  |   7 +-
 UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c                             | 127 +++--
 MdePkg/Library/BaseLib/Ia32/VmgExitSvsm.nasm                          |  39 ++
 MdePkg/Library/BaseLib/X64/VmgExitSvsm.nasm                           |  94 ++++
 OvmfPkg/ResetVector/ResetVector.nasmb                                 |   6 +-
 OvmfPkg/ResetVector/X64/OvmfSevMetadata.asm                           |   9 +
 UefiCpuPkg/UefiCpuPkg.uni                                             |   3 +
 39 files changed, 1524 insertions(+), 210 deletions(-)
 create mode 100644 MdePkg/Include/Register/Amd/Svsm.h
 create mode 100644 MdePkg/Include/Register/Amd/SvsmMsr.h
 create mode 100644 OvmfPkg/Library/CcExitLib/CcExitSvsm.h
 create mode 100644 OvmfPkg/Library/CcExitLib/CcExitSvsm.c
 create mode 100644 MdePkg/Library/BaseLib/Ia32/VmgExitSvsm.nasm
 create mode 100644 MdePkg/Library/BaseLib/X64/VmgExitSvsm.nasm

-- 
2.42.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114626): https://edk2.groups.io/g/devel/message/114626
Mute This Topic: https://groups.io/mt/103986434/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

end of thread, other threads:[~2024-02-09 16:17 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-26 22:12 [edk2-devel] [PATCH 00/16] Provide SEV-SNP support for running under an SVSM Lendacky, Thomas via groups.io
2024-01-26 22:13 ` [edk2-devel] [PATCH 01/16] OvmfPkg/BaseMemEncryptSevLib: Re-organize page state change support Lendacky, Thomas via groups.io
2024-01-29 12:59   ` Gerd Hoffmann
2024-01-29 15:39     ` Lendacky, Thomas via groups.io
2024-01-26 22:13 ` [edk2-devel] [PATCH 02/16] MdePkg/Register/Amd: Define the SVSM related information Lendacky, Thomas via groups.io
2024-01-29 13:12   ` Gerd Hoffmann
2024-01-26 22:13 ` [edk2-devel] [PATCH 03/16] MdePkg/BaseLib: Add a new VMGEXIT instruction invocation for SVSM Lendacky, Thomas via groups.io
2024-01-29 13:22   ` Gerd Hoffmann
2024-01-29 15:51     ` Lendacky, Thomas via groups.io
2024-01-30 11:51       ` Gerd Hoffmann
2024-01-31 18:30         ` Lendacky, Thomas via groups.io
2024-02-01  8:35           ` Gerd Hoffmann
2024-01-26 22:13 ` [edk2-devel] [PATCH 04/16] UefiCpuPkg/CcExitLib: Extend the CcExitLib library to support an SVSM Lendacky, Thomas via groups.io
2024-02-02  6:06   ` Ni, Ray
2024-01-26 22:13 ` [edk2-devel] [PATCH 05/16] Ovmfpkg/CcExitLib: Extend CcExitLib to handle SVSM related services Lendacky, Thomas via groups.io
2024-01-26 22:13 ` [edk2-devel] [PATCH 06/16] OvmfPkg: Create a calling area used to communicate with the SVSM Lendacky, Thomas via groups.io
2024-01-26 22:13 ` [edk2-devel] [PATCH 07/16] OvmfPkg/CcExitLib: Add support for the SVSM_CORE_PVALIDATE call Lendacky, Thomas via groups.io
2024-01-29 14:40   ` Gerd Hoffmann
2024-01-29 17:34     ` Lendacky, Thomas via groups.io
2024-01-31 18:40       ` Lendacky, Thomas via groups.io
2024-01-26 22:13 ` [edk2-devel] [PATCH 08/16] OvmfPkg/CcExitLib: Add support for the SVSM create/delete vCPU calls Lendacky, Thomas via groups.io
2024-01-29 14:46   ` Gerd Hoffmann
2024-01-29 17:37     ` Lendacky, Thomas via groups.io
2024-01-26 22:13 ` [edk2-devel] [PATCH 09/16] UefiCpuPkg/MpInitLib: Use CcExitSnpVmsaRmpAdjust() to set/clear VMSA Lendacky, Thomas via groups.io
2024-02-02  6:07   ` Ni, Ray
2024-01-26 22:13 ` [edk2-devel] [PATCH 10/16] MdePkg: GHCB APIC ID retrieval support definitions Lendacky, Thomas via groups.io
2024-01-29 14:52   ` Gerd Hoffmann
2024-01-26 22:13 ` [edk2-devel] [PATCH 11/16] UefiCpuPkg: Create APIC ID list PCD Lendacky, Thomas via groups.io
2024-01-29 14:57   ` Gerd Hoffmann
2024-02-02  6:08   ` Ni, Ray
2024-02-02 22:56     ` Lendacky, Thomas via groups.io
2024-01-26 22:13 ` [edk2-devel] [PATCH 12/16] OvmfPkg/PlatformPei: Retrieve APIC IDs from the hypervisor Lendacky, Thomas via groups.io
2024-01-29 15:00   ` Gerd Hoffmann
2024-01-29 17:49     ` Lendacky, Thomas via groups.io
2024-01-30 11:25       ` Gerd Hoffmann
2024-01-26 22:13 ` [edk2-devel] [PATCH 13/16] UefiCpuPkg/MpInitLib: Always use AP Create if PcdSevSnpApicIds is set Lendacky, Thomas via groups.io
2024-01-29 15:21   ` Gerd Hoffmann
2024-01-29 18:00     ` Lendacky, Thomas via groups.io
2024-02-02  6:20   ` Ni, Ray
2024-02-02 22:58     ` Lendacky, Thomas via groups.io
2024-02-05  5:06       ` Ni, Ray
2024-01-26 22:13 ` [edk2-devel] [PATCH 14/16] UefiCpuPkg/MpInitLib: AP creation support under an SVSM Lendacky, Thomas via groups.io
2024-01-29 15:21   ` Gerd Hoffmann
2024-02-02  6:48   ` Ni, Ray
2024-01-26 22:13 ` [edk2-devel] [PATCH 15/16] Ovmfpkg/CcExitLib: Provide SVSM discovery support Lendacky, Thomas via groups.io
2024-01-29 15:23   ` Gerd Hoffmann
2024-01-29 18:04     ` Lendacky, Thomas via groups.io
2024-01-30 11:38       ` Gerd Hoffmann
2024-01-30 16:13         ` Lendacky, Thomas via groups.io
2024-01-26 22:13 ` [edk2-devel] [PATCH 16/16] OvmfPkg/BaseMemEncryptLib: Check for presence of an SVSM when not at VMPL0 Lendacky, Thomas via groups.io
2024-01-29 15:24   ` Gerd Hoffmann
2024-01-27  4:04 ` [edk2-devel] [PATCH 00/16] Provide SEV-SNP support for running under an SVSM Yao, Jiewen
2024-01-27 17:48   ` Lendacky, Thomas via groups.io
2024-01-28  4:11     ` Yao, Jiewen
     [not found]     ` <17AE677D909D4A42.23935@groups.io>
2024-02-09  8:11       ` Yao, Jiewen
2024-02-09 16:17         ` Lendacky, Thomas via groups.io

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