mirror of https://github.com/acidanthera/audk.git
OvmfPkg: Call gEdkiiMemoryAcceptProtocolGuid to accept pages
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> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
parent
7dcc2f3870
commit
720c25ab41
|
@ -42,3 +42,6 @@
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr
|
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr
|
||||||
|
|
||||||
|
[Protocols]
|
||||||
|
gEdkiiMemoryAcceptProtocolGuid
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include "VirtualMemory.h"
|
#include "VirtualMemory.h"
|
||||||
#include <IndustryStandard/Tdx.h>
|
#include <IndustryStandard/Tdx.h>
|
||||||
#include <Library/TdxLib.h>
|
#include <Library/TdxLib.h>
|
||||||
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
#include <Protocol/MemoryAccept.h>
|
||||||
#include <ConfidentialComputingGuestAttr.h>
|
#include <ConfidentialComputingGuestAttr.h>
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -517,8 +519,9 @@ SetOrClearSharedBit (
|
||||||
IN UINT64 Length
|
IN UINT64 Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 AddressEncMask;
|
UINT64 AddressEncMask;
|
||||||
UINT64 Status;
|
UINT64 Status;
|
||||||
|
EDKII_MEMORY_ACCEPT_PROTOCOL *MemoryAcceptProtocol;
|
||||||
|
|
||||||
AddressEncMask = GetMemEncryptionAddressMask ();
|
AddressEncMask = GetMemEncryptionAddressMask ();
|
||||||
|
|
||||||
|
@ -539,7 +542,10 @@ SetOrClearSharedBit (
|
||||||
// If changing shared to private, must accept-page again
|
// If changing shared to private, must accept-page again
|
||||||
//
|
//
|
||||||
if (Mode == ClearSharedBit) {
|
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 ((
|
DEBUG ((
|
||||||
|
|
Loading…
Reference in New Issue