IntelSiliconPkg/IntelVTdDxe: Do global invalidation before boot
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1547 V2: Abandon V1. Do global invalidation of context-cache and IOTLB at ExitBootServices. V1: Only doing IOTLB invalidation would cause a BSOD 'DRIVER_VERIFIER_DMA_VIOLATION' while changing the second level page entry's attributes. So always do the global invalidation of context-cache and IOTLB. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -581,9 +581,20 @@ OnExitBootServices (
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
UINTN VtdIndex;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "Vtd OnExitBootServices\n"));
|
DEBUG ((DEBUG_INFO, "Vtd OnExitBootServices\n"));
|
||||||
DumpVtdRegsAll ();
|
DumpVtdRegsAll ();
|
||||||
|
|
||||||
|
DEBUG ((DEBUG_INFO, "Invalidate all\n"));
|
||||||
|
for (VtdIndex = 0; VtdIndex < mVtdUnitNumber; VtdIndex++) {
|
||||||
|
FlushWriteBuffer (VtdIndex);
|
||||||
|
|
||||||
|
InvalidateContextCache (VtdIndex);
|
||||||
|
|
||||||
|
InvalidateIOTLB (VtdIndex);
|
||||||
|
}
|
||||||
|
|
||||||
if ((PcdGet8(PcdVTdPolicyPropertyMask) & BIT1) == 0) {
|
if ((PcdGet8(PcdVTdPolicyPropertyMask) & BIT1) == 0) {
|
||||||
DisableDmar ();
|
DisableDmar ();
|
||||||
DumpVtdRegsAll ();
|
DumpVtdRegsAll ();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -168,6 +168,36 @@ DisableDmar (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Flush VTd engine write buffer.
|
||||||
|
|
||||||
|
@param[in] VtdIndex The index used to identify a VTd engine.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
FlushWriteBuffer (
|
||||||
|
IN UINTN VtdIndex
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Invalidate VTd context cache.
|
||||||
|
|
||||||
|
@param[in] VtdIndex The index used to identify a VTd engine.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
InvalidateContextCache (
|
||||||
|
IN UINTN VtdIndex
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Invalidate VTd IOTLB.
|
||||||
|
|
||||||
|
@param[in] VtdIndex The index used to identify a VTd engine.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
InvalidateIOTLB (
|
||||||
|
IN UINTN VtdIndex
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Invalid VTd global IOTLB.
|
Invalid VTd global IOTLB.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user