6995a1b OvmfPkg: Create a GHCB page for use during Sec phase

5 files Authored by Tom Lendacky 3 years ago, Committed by mergify[bot] 3 years ago,
    OvmfPkg: Create a GHCB page for use during Sec phase
    
    BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
    
    A GHCB page is needed during the Sec phase, so this new page must be
    created. Since the #VC exception handler routines assume that a per-CPU
    variable area is immediately after the GHCB, this per-CPU variable area
    must also be created. Since the GHCB must be marked as an un-encrypted,
    or shared, page, an additional pagetable page is required to break down
    the 2MB region where the GHCB page lives into 4K pagetable entries.
    
    Create a new entry in the OVMF memory layout for the new page table
    page and for the SEC GHCB and per-CPU variable pages. After breaking down
    the 2MB page, update the GHCB page table entry to remove the encryption
    mask.
    
    The GHCB page will be used by the SEC #VC exception handler. The #VC
    exception handler will fill in the necessary fields of the GHCB and exit
    to the hypervisor using the VMGEXIT instruction. The hypervisor then
    accesses the GHCB in order to perform the requested function.
    
    Four new fixed PCDs are needed to support the SEC GHCB page:
      - PcdOvmfSecGhcbBase  UINT32 value that is the base address of the
                            GHCB used during the SEC phase.
      - PcdOvmfSecGhcbSize  UINT32 value that is the size, in bytes, of the
                            GHCB area used during the SEC phase.
    
      - PcdOvmfSecGhcbPageTableBase  UINT32 value that is address of a page
                            table page used to break down the 2MB page into
                            512 4K pages.
      - PcdOvmfSecGhcbPageTableSize  UINT32 value that is the size, in bytes,
                            of the page table page.
    
    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>
    
        
file modified
+9 -0
file modified
+6 -0