]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/Sec: Enable cache early to speed up booting
authorTom Lendacky <thomas.lendacky@amd.com>
Wed, 12 Aug 2020 20:21:41 +0000 (15:21 -0500)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 17 Aug 2020 02:46:39 +0000 (02:46 +0000)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198

Currently, the OVMF code relies on the hypervisor to enable the cache
support on the processor in order to improve the boot speed. However,
with SEV-ES, the hypervisor is not allowed to change the CR0 register
to enable caching.

Update the OVMF Sec support to enable caching in order to improve the
boot speed when running as an SEV-ES guest.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
OvmfPkg/Sec/SecMain.c

index 169c04b9cec71a6dc16712039c9afaf2af1c696e..63aca702072745880150c446392fca6057b7f339 100644 (file)
@@ -906,6 +906,13 @@ SecCoreStartupWithStack (
     // For non SEV-ES guests, just load the IDTR.\r
     //\r
     AsmWriteIdtr (&IdtDescriptor);\r
+  } else {\r
+    //\r
+    // Under SEV-ES, the hypervisor can't modify CR0 and so can't enable\r
+    // caching in order to speed up the boot. Enable caching early for\r
+    // an SEV-ES guest.\r
+    //\r
+    AsmEnableCache ();\r
   }\r
 \r
   DEBUG ((DEBUG_INFO,\r