edk2/0075-OvmfPkg-BaseMemEncryptLib-Return-SUCCESS-if-not-supp.patch
hanliyang 8f8a38d6e0 Support live migration for Hygon CSV1/2/3 guests, fix nesting #VC
The live migration of Hygon CSV1/2/3 guest depends on the KVM
hypercall KVM_HC_MAP_GPA_RANGE, add code to sync page enc/dec
status to KVM.

The MMIO routine of VC handler will get memory encrypt status to
validate MMIO address. MemEncryptSevGetEncryptionMask() will enable
interrupt while interrupt must be disabled during VC. During DXE
stage, VC routine as below:
  CcExitHandleVc
    -> MemEncryptSevGetAddressRangeState
      -> MemEncryptSevGetEncryptionMask->PcdGet64(PcdPteMemoryEncryptionAddressOrMask)

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-10-23 18:02:32 +08:00

37 lines
1.3 KiB
Diff

From 6b7bb04614be39e9903c602dd65ba18426f6a6f2 Mon Sep 17 00:00:00 2001
From: hanliyang <hanliyang@hygon.cn>
Date: Sun, 19 Jun 2022 18:12:35 +0800
Subject: [PATCH 8/9] OvmfPkg/BaseMemEncryptLib: Return SUCCESS if not support
SEV live migration
Add this change to avoid trigger 'ASSERT_EFI_ERROR (Status = Unsupported)'
when QEMU doesn't support SEV live migration.
Signed-off-by: hanliyang <hanliyang@hygon.cn>
---
OvmfPkg/Library/BaseMemEncryptSevLib/X64/MemEncryptSevLib.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/MemEncryptSevLib.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/MemEncryptSevLib.c
index a64ff2a5..7b29582d 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/MemEncryptSevLib.c
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/MemEncryptSevLib.c
@@ -168,10 +168,12 @@ SetMemoryEncDecHypercall3 (
UINTN Error;
UINTN EncryptState;
- Ret = RETURN_UNSUPPORTED;
+ //
+ // Return success if not support migration.
+ //
+ Ret = RETURN_SUCCESS;
if (MemEncryptSevLiveMigrationIsEnabled ()) {
- Ret = RETURN_SUCCESS;
//
// The encryption bit is set/clear on the smallest page size, hence
// use the 4k page size in MAP_GPA_RANGE hypercall below.
--
2.25.1