BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3108 In order to be able to issue messages or make interface calls that cause another #VC (e.g. GetLocalApicBaseAddress () issues RDMSR), add support for nested #VCs. In order to support nested #VCs, GHCB backup pages are required. If a #VC is received while currently processing a #VC, a backup of the current GHCB content is made. This allows the #VC handler to continue processing the new #VC. Upon completion of the new #VC, the GHCB is restored from the backup page. The #VC recursion level is tracked in the per-vCPU variable area. Support is added to handle up to one nested #VC (or two #VCs total). If a second nested #VC is encountered, an ASSERT will be issued and the vCPU will enter CpuDeadLoop (). For SEC, the GHCB backup pages are reserved in the OvmfPkgX64.fdf memory layout, with two new fixed PCDs to provide the address and size of the backup area. For PEI/DXE, the GHCB backup pages are allocated as boot services pages using the memory allocation library. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Brijesh Singh <brijesh.singh@amd.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Message-Id: <ac2e8203fc41a351b43f60d68bdad6b57c4fb106.1610045305.git.thomas.lendacky@amd.com>
54 lines
1.4 KiB
C
54 lines
1.4 KiB
C
/** @file
|
|
X64 #VC Exception Handler functon header file.
|
|
|
|
Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
#ifndef __VMG_EXIT_VC_HANDLER_H__
|
|
#define __VMG_EXIT_VC_HANDLER_H__
|
|
|
|
#include <Base.h>
|
|
#include <Uefi.h>
|
|
#include <Library/VmgExitLib.h>
|
|
|
|
/**
|
|
Handle a #VC exception.
|
|
|
|
Performs the necessary processing to handle a #VC exception.
|
|
|
|
@param[in, out] Ghcb Pointer to the GHCB
|
|
@param[in, out] ExceptionType Pointer to an EFI_EXCEPTION_TYPE to be set
|
|
as value to use on error.
|
|
@param[in, out] SystemContext Pointer to EFI_SYSTEM_CONTEXT
|
|
|
|
@retval EFI_SUCCESS Exception handled
|
|
@retval EFI_UNSUPPORTED #VC not supported, (new) exception value to
|
|
propagate provided
|
|
@retval EFI_PROTOCOL_ERROR #VC handling failed, (new) exception value to
|
|
propagate provided
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
InternalVmgExitHandleVc (
|
|
IN OUT GHCB *Ghcb,
|
|
IN OUT EFI_EXCEPTION_TYPE *ExceptionType,
|
|
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
|
);
|
|
|
|
/**
|
|
Routine to allow ASSERT from within #VC.
|
|
|
|
@param[in, out] SevEsData Pointer to the per-CPU data
|
|
|
|
**/
|
|
VOID
|
|
EFIAPI
|
|
VmgExitIssueAssert (
|
|
IN OUT SEV_ES_PER_CPU_DATA *SevEsData
|
|
);
|
|
|
|
#endif
|