]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c
IntelSiliconPkg/IntelVTdDxe: Do global invalidation before boot
[mirror_edk2.git] / IntelSiliconPkg / Feature / VTd / IntelVTdDxe / DmaProtection.c
index f221e459380962352fee7a9fdd2889cd5ab2fdae..956ebb2d3d3d5c77be22e631c288b1a73b1daaee 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -581,9 +581,20 @@ OnExitBootServices (
   IN VOID                                    *Context\r
   )\r
 {\r
+  UINTN   VtdIndex;\r
+\r
   DEBUG ((DEBUG_INFO, "Vtd OnExitBootServices\n"));\r
   DumpVtdRegsAll ();\r
 \r
+  DEBUG ((DEBUG_INFO, "Invalidate all\n"));\r
+  for (VtdIndex = 0; VtdIndex < mVtdUnitNumber; VtdIndex++) {\r
+    FlushWriteBuffer (VtdIndex);\r
+\r
+    InvalidateContextCache (VtdIndex);\r
+\r
+    InvalidateIOTLB (VtdIndex);\r
+  }\r
+\r
   if ((PcdGet8(PcdVTdPolicyPropertyMask) & BIT1) == 0) {\r
     DisableDmar ();\r
     DumpVtdRegsAll ();\r