]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: Introduce the OvmfSevMemoryAcceptance protocol
authorDionna Glaze <dionnaglaze@google.com>
Thu, 26 Jan 2023 21:17:38 +0000 (21:17 +0000)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 26 Jan 2023 23:00:51 +0000 (23:00 +0000)
The default behavior for unaccepted memory in SEV-SNP is to accept all
memory when ExitBootServices is called. An OS loader can use this
protocol to disable this behavior to assume responsibility for memory
acceptance and to affirm that the OS can handle the unaccepted memory
type.

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>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: "Min M. Xu" <min.m.xu@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: "Michael D. Kinney" <michael.d.kinney@intel.com>
Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
OvmfPkg/Include/Protocol/SevMemoryAcceptance.h [new file with mode: 0644]
OvmfPkg/OvmfPkg.dec

diff --git a/OvmfPkg/Include/Protocol/SevMemoryAcceptance.h b/OvmfPkg/Include/Protocol/SevMemoryAcceptance.h
new file mode 100644 (file)
index 0000000..c5ea3f3
--- /dev/null
@@ -0,0 +1,43 @@
+/** @file\r
+  The file provides the protocol that disables the behavior that all memory\r
+  gets accepted at ExitBootServices(). This protocol is only meant to be called\r
+  by the OS loader, and not EDK2 itself. The SEV naming is due to the\r
+  coincidence that only SEV-SNP needs this protocol, since SEV-SNP Linux\r
+  support was released before it had support for unaccepted memory. The\r
+  technology enablement thus does not strictly imply support for the unaccepted\r
+  memory type.\r
+\r
+  Copyright (c) 2023, Google LLC. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+**/\r
+\r
+#ifndef SEV_MEMORY_ACCEPTANCE_H_\r
+#define SEV_MEMORY_ACCEPTANCE_H_\r
+\r
+#define OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL_GUID \\r
+  {0xc5a010fe, \\r
+   0x38a7, \\r
+   0x4531, \\r
+   {0x8a, 0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}}\r
+\r
+typedef struct _OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL\r
+    OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL;\r
+\r
+/**\r
+  @param This A pointer to a OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL.\r
+**/\r
+typedef\r
+  EFI_STATUS\r
+(EFIAPI *OVMF_SEV_ALLOW_UNACCEPTED_MEMORY)(\r
+  IN  OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL  *This\r
+  );\r
+\r
+///\r
+/// The OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL allows the OS loader to\r
+/// indicate to EDK2 that ExitBootServices should not accept all memory.\r
+///\r
+struct _OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL {\r
+  OVMF_SEV_ALLOW_UNACCEPTED_MEMORY    AllowUnacceptedMemory;\r
+};\r
+\r
+#endif\r
index 1b521f2604ff612c6b7fc388e74e9cedbd190842..a22eb246c6252880464b383ca8b16a177e05c27d 100644 (file)
   gEfiLegacyInterruptProtocolGuid       = {0x31ce593d, 0x108a, 0x485d, {0xad, 0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe}}\r
   gEfiVgaMiniPortProtocolGuid           = {0xc7735a2f, 0x88f5, 0x4882, {0xae, 0x63, 0xfa, 0xac, 0x8c, 0x8b, 0x86, 0xb3}}\r
   gOvmfLoadedX86LinuxKernelProtocolGuid = {0xa3edc05d, 0xb618, 0x4ff6, {0x95, 0x52, 0x76, 0xd7, 0x88, 0x63, 0x43, 0xc8}}\r
+  gOvmfSevMemoryAcceptanceProtocolGuid  = {0xc5a010fe, 0x38a7, 0x4531, {0x8a, 0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}}\r
   gQemuAcpiTableNotifyProtocolGuid      = {0x928939b2, 0x4235, 0x462f, {0x95, 0x80, 0xf6, 0xa2, 0xb2, 0xc2, 0x1a, 0x4f}}\r
   gEfiMpInitLibMpDepProtocolGuid        = {0xbb00a5ca, 0x8ce,  0x462f, {0xa5, 0x37, 0x43, 0xc7, 0x4a, 0x82, 0x5c, 0xa4}}\r
   gEfiMpInitLibUpDepProtocolGuid        = {0xa9e7cef1, 0x5682, 0x42cc, {0xb1, 0x23, 0x99, 0x30, 0x97, 0x3f, 0x4a, 0x9f}}\r