]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c
OvmfPkg/MemEncryptSevLib: add support to validate system RAM
[mirror_edk2.git] / OvmfPkg / Library / BaseMemEncryptSevLib / X64 / SecSnpSystemRamValidate.c
1 /** @file
2
3 SEV-SNP Page Validation functions.
4
5 Copyright (c) 2021 AMD Incorporated. All rights reserved.<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #include <Uefi/UefiBaseType.h>
12 #include <Library/BaseLib.h>
13 #include <Library/MemEncryptSevLib.h>
14
15 #include "SnpPageStateChange.h"
16
17 /**
18 Pre-validate the system RAM when SEV-SNP is enabled in the guest VM.
19
20 @param[in] BaseAddress Base address
21 @param[in] NumPages Number of pages starting from the base address
22
23 **/
24 VOID
25 EFIAPI
26 MemEncryptSevSnpPreValidateSystemRam (
27 IN PHYSICAL_ADDRESS BaseAddress,
28 IN UINTN NumPages
29 )
30 {
31 if (!MemEncryptSevSnpIsEnabled ()) {
32 return;
33 }
34
35 InternalSetPageState (BaseAddress, NumPages, SevSnpPagePrivate, TRUE);
36 }