]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/ResetVector: move clearing GHCB in SecMain
authorBrijesh Singh via groups.io <brijesh.singh=amd.com@groups.io>
Thu, 9 Dec 2021 03:27:31 +0000 (11:27 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 9 Dec 2021 06:28:10 +0000 (06:28 +0000)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3275

In preparation for SEV-SNP support move clearing of the GHCB memory from
the ResetVector/AmdSev.asm to SecMain/AmdSev.c. The GHCB page is not
accessed until SevEsProtocolCheck() switch to full GHCB. So, the move
does not make any changes in the code flow or logic. The move will
simplify the SEV-SNP support.

Cc: Michael Roth <michael.roth@amd.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
OvmfPkg/ResetVector/Ia32/AmdSev.asm
OvmfPkg/Sec/AmdSev.c

index 250ac8d8b1806341b0229287546bc11d3825fdd4..48d9178168b03ca04e64a6d5ba9a0e84b18a5bda 100644 (file)
@@ -177,12 +177,6 @@ pageTableEntries4kLoop:
     mov     ecx, (GHCB_BASE & 0x1F_FFFF) >> 12\r
     mov     [ecx * 8 + GHCB_PT_ADDR + 4], strict dword 0\r
 \r
-    mov     ecx, GHCB_SIZE / 4\r
-    xor     eax, eax\r
-clearGhcbMemoryLoop:\r
-    mov     dword[ecx * 4 + GHCB_BASE - 4], eax\r
-    loop    clearGhcbMemoryLoop\r
-\r
 SevClearPageEncMaskForGhcbPageExit:\r
     OneTimeCallRet SevClearPageEncMaskForGhcbPage\r
 \r
index 27fd24fc137ee565effb151246d123eb9ff823a4..0828d090feaf5a186481afb72719f7285733137e 100644 (file)
@@ -96,7 +96,7 @@ SevEsProtocolCheck (
   AsmWriteMsr64 (MSR_SEV_ES_GHCB, Msr.GhcbPhysicalAddress);\r
 \r
   Ghcb = Msr.Ghcb;\r
-  SetMem (Ghcb, sizeof (*Ghcb), 0);\r
+  SetMem (Ghcb, FixedPcdGet32 (PcdOvmfSecGhcbSize), 0);\r
 \r
   //\r
   // Set the version to the maximum that can be supported\r