From: "Min Xu" <min.m.xu@intel.com>
To: devel@edk2.groups.io
Cc: Min M Xu <min.m.xu@intel.com>,
Erdem Aktas <erdemaktas@google.com>,
James Bottomley <jejb@linux.ibm.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Tom Lendacky <thomas.lendacky@amd.com>
Subject: [PATCH V4 10/10] OvmfPkg: Call gEdkiiMemoryAcceptProtocolGuid to accept pages
Date: Tue, 13 Sep 2022 08:02:14 +0800 [thread overview]
Message-ID: <94f2b47d407484585db944c085d4de087769cb03.1663026445.git.min.m.xu@intel.com> (raw)
In-Reply-To: <cover.1663026445.git.min.m.xu@intel.com>
From: Min M Xu <min.m.xu@intel.com>
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3937
After EdkiiMemoryAcceptProtocol is implemented in TdxDxe driver, we can
call it to accept pages in DXE phase.
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
.../BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf | 3 +++
.../Library/BaseMemEncryptTdxLib/MemoryEncryption.c | 12 +++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf b/OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf
index a8abfec12fa3..11768825f8ca 100644
--- a/OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf
+++ b/OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf
@@ -42,3 +42,6 @@
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr
+
+[Protocols]
+ gEdkiiMemoryAcceptProtocolGuid
diff --git a/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c b/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c
index 9d11c6e4df72..503f626d75c6 100644
--- a/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c
+++ b/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c
@@ -27,6 +27,8 @@
#include "VirtualMemory.h"
#include <IndustryStandard/Tdx.h>
#include <Library/TdxLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Protocol/MemoryAccept.h>
#include <ConfidentialComputingGuestAttr.h>
typedef enum {
@@ -517,8 +519,9 @@ SetOrClearSharedBit (
IN UINT64 Length
)
{
- UINT64 AddressEncMask;
- UINT64 Status;
+ UINT64 AddressEncMask;
+ UINT64 Status;
+ EDKII_MEMORY_ACCEPT_PROTOCOL *MemoryAcceptProtocol;
AddressEncMask = GetMemEncryptionAddressMask ();
@@ -539,7 +542,10 @@ SetOrClearSharedBit (
// If changing shared to private, must accept-page again
//
if (Mode == ClearSharedBit) {
- TdAcceptPages (PhysicalAddress, Length / EFI_PAGE_SIZE, EFI_PAGE_SIZE);
+ Status = gBS->LocateProtocol (&gEdkiiMemoryAcceptProtocolGuid, NULL, (VOID **)&MemoryAcceptProtocol);
+ ASSERT (!EFI_ERROR (Status));
+ Status = MemoryAcceptProtocol->AcceptMemory (MemoryAcceptProtocol, PhysicalAddress, Length);
+ ASSERT (!EFI_ERROR (Status));
}
DEBUG ((
--
2.29.2.windows.2
next prev parent reply other threads:[~2022-09-13 0:02 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-13 0:02 [PATCH V4 00/10] Introduce Lazy-accept for Tdx guest Min Xu
2022-09-13 0:02 ` [PATCH V4 01/10] MdeModulePkg: Add PrePiHob.h Min Xu
2022-09-13 0:02 ` [PATCH V4 02/10] MdePkg: Increase EFI_RESOURCE_MAX_MEMORY_TYPE Min Xu
2022-09-21 8:10 ` Gerd Hoffmann
2022-09-13 0:02 ` [PATCH V4 03/10] OvmfPkg: Use BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED defined in MdeModulePkg Min Xu
2022-09-13 0:02 ` [PATCH V4 04/10] MdePkg: Add UEFI Unaccepted memory definition Min Xu
2022-09-13 0:02 ` [PATCH V4 05/10] MdeModulePkg: Update Dxe to handle unaccepted memory type Min Xu
2022-09-13 0:02 ` [PATCH V4 06/10] ShellPkg: Update shell command memmap to show unaccepted memory Min Xu
2022-09-13 0:02 ` [PATCH V4 07/10] OvmfPkg: Introduce lazy accept in PlatformInitLib and PlatformPei Min Xu
2022-09-21 8:11 ` Gerd Hoffmann
2022-09-13 0:02 ` [PATCH V4 08/10] MdePkg: The prototype definition of EdkiiMemoryAcceptProtocol Min Xu
2022-09-13 0:02 ` [PATCH V4 09/10] OvmfPkg: Realize EdkiiMemoryAcceptProtocol in TdxDxe Min Xu
2022-09-13 0:02 ` Min Xu [this message]
2022-09-22 5:25 ` [PATCH V4 00/10] Introduce Lazy-accept for Tdx guest Min Xu
2022-09-29 6:56 ` Min Xu
2022-10-10 2:27 ` 回复: " gaoliming
2022-10-10 3:08 ` [edk2-devel] " Min Xu
2022-10-10 3:18 ` Ni, Ray
2022-10-10 15:50 ` Dionna Glaze
2022-10-12 5:29 ` Min Xu
2022-10-13 5:27 ` Dionna Glaze
2022-10-18 1:13 ` Min Xu
2022-10-19 1:17 ` 回复: " gaoliming
2022-10-19 2:02 ` Min Xu
2022-10-21 15:58 ` Dionna Glaze
2022-10-25 1:07 ` Min Xu
2022-10-26 1:27 ` 回复: " gaoliming
2022-10-26 13:35 ` Min Xu
2022-11-01 1:18 ` 回复: " gaoliming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=94f2b47d407484585db944c085d4de087769cb03.1663026445.git.min.m.xu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox