summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/AmdSevDxe
diff options
context:
space:
mode:
authorDionna Glaze <dionnaglaze@google.com>2023-01-26 21:17:39 +0000
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-01-26 23:00:51 +0000
commit466d8f65e3c7f748d52e7a0046a1f7c1febe5691 (patch)
tree689002441ed9a71a169b22019d3fd75a0be33309 /OvmfPkg/AmdSevDxe
parent26847fb6be7fff83a834a3154224588afede0073 (diff)
downloadedk2-466d8f65e3c7f748d52e7a0046a1f7c1febe5691.tar.gz
edk2-466d8f65e3c7f748d52e7a0046a1f7c1febe5691.tar.bz2
edk2-466d8f65e3c7f748d52e7a0046a1f7c1febe5691.zip
OvmfPkg: Implement AcceptAllUnacceptedMemory in AmdSevDxe
This protocol implementation disables the accept-all-memory behavior of the BeforeExitBootServices event this driver adds. 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>
Diffstat (limited to 'OvmfPkg/AmdSevDxe')
-rw-r--r--OvmfPkg/AmdSevDxe/AmdSevDxe.c24
-rw-r--r--OvmfPkg/AmdSevDxe/AmdSevDxe.inf1
2 files changed, 22 insertions, 3 deletions
diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
index 37d1a3ff55..6391d1f775 100644
--- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c
+++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
@@ -21,6 +21,7 @@
#include <Guid/ConfidentialComputingSevSnpBlob.h>
#include <Library/PcdLib.h>
#include <Pi/PrePiDxeCis.h>
+#include <Protocol/SevMemoryAcceptance.h>
#include <Protocol/MemoryAccept.h>
STATIC CONFIDENTIAL_COMPUTING_SNP_BLOB_LOCATION mSnpBootDxeTable = {
@@ -143,6 +144,21 @@ ResolveUnacceptedMemory (
ASSERT_EFI_ERROR (Status);
}
+STATIC
+EFI_STATUS
+EFIAPI
+AllowUnacceptedMemory (
+ IN OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL *This
+ )
+{
+ mAcceptAllMemoryAtEBS = FALSE;
+ return EFI_SUCCESS;
+}
+
+STATIC
+OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL
+ mMemoryAcceptanceProtocol = { AllowUnacceptedMemory };
+
STATIC EDKII_MEMORY_ACCEPT_PROTOCOL mMemoryAcceptProtocol = {
AmdSevMemoryAccept
};
@@ -268,11 +284,13 @@ AmdSevDxeEntryPoint (
// Memory acceptance began being required in SEV-SNP, so install the
// memory accept protocol implementation for a SEV-SNP active guest.
//
- Status = gBS->InstallProtocolInterface (
+ Status = gBS->InstallMultipleProtocolInterfaces (
&mAmdSevDxeHandle,
&gEdkiiMemoryAcceptProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mMemoryAcceptProtocol
+ &mMemoryAcceptProtocol,
+ &gOvmfSevMemoryAcceptanceProtocolGuid,
+ &mMemoryAcceptanceProtocol,
+ NULL
);
ASSERT_EFI_ERROR (Status);
diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.inf b/OvmfPkg/AmdSevDxe/AmdSevDxe.inf
index 5b443d45bc..e7c7d526c9 100644
--- a/OvmfPkg/AmdSevDxe/AmdSevDxe.inf
+++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.inf
@@ -49,6 +49,7 @@
[Protocols]
gEdkiiMemoryAcceptProtocolGuid
+ gOvmfSevMemoryAcceptanceProtocolGuid
[Guids]
gConfidentialComputingSevSnpBlobGuid