6587e08 OvmfPkg/VmgExitLib: Add support for CPUID NAE events

1 file Authored by Tom Lendacky 3 years ago, Committed by mergify[bot] 3 years ago,
    OvmfPkg/VmgExitLib: Add support for CPUID NAE events
    
    BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
    
    Under SEV-ES, a CPUID intercept generates a #VC exception. VMGEXIT must be
    used to allow the hypervisor to handle this intercept.
    
    Add support to construct the required GHCB values to support a CPUID NAE
    event. Additionally, CPUID 0x0000_000d (CPUID_EXTENDED_STATE) requires
    XCR0 to be supplied in the GHCB, so add support to issue the XGETBV
    instruction.
    
    Cc: Jordan Justen <jordan.l.justen@intel.com>
    Cc: Laszlo Ersek <lersek@redhat.com>
    Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
    Acked-by: Laszlo Ersek <lersek@redhat.com>
    Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
    Regression-tested-by: Laszlo Ersek <lersek@redhat.com>