]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelSiliconPkg/VTdDxe: Clean up DXE flush memory.
authorJiewen Yao <jiewen.yao@intel.com>
Wed, 20 Sep 2017 08:33:15 +0000 (16:33 +0800)
committerJiewen Yao <jiewen.yao@intel.com>
Sat, 23 Sep 2017 08:14:27 +0000 (16:14 +0800)
Make sure the context table are flush to memory.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTableEx.c

index ccecc9520cf35cc5ae6da4f15be4f907d361df69..cecb5d23efbf36aa4d3c578db276cb9bcf8e3e1d 100644 (file)
@@ -124,7 +124,6 @@ CreateContextEntry (
       RootEntry->Bits.ContextTablePointerHi  = (UINT32) RShiftU64 ((UINT64)(UINTN)Buffer, 32);\r
       RootEntry->Bits.Present = 1;\r
       Buffer = (UINT8 *)Buffer + EFI_PAGES_TO_SIZE (ContextPages);\r
-      FlushPageTableMemory (VtdIndex, (UINTN)RootEntry, sizeof(*RootEntry));\r
     }\r
 \r
     ContextEntryTable = (VTD_CONTEXT_ENTRY *)(UINTN)VTD_64BITS_ADDRESS(RootEntry->Bits.ContextTablePointerLo, RootEntry->Bits.ContextTablePointerHi) ;\r
@@ -143,9 +142,10 @@ CreateContextEntry (
       ContextEntry->Bits.AddressWidth = 0x2;\r
       break;\r
     }\r
-    FlushPageTableMemory (VtdIndex, (UINTN)ContextEntry, sizeof(*ContextEntry));\r
   }\r
 \r
+  FlushPageTableMemory (VtdIndex, (UINTN)mVtdUnitInformation[VtdIndex].RootEntryTable, EFI_PAGES_TO_SIZE(EntryTablePages));\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -196,6 +196,7 @@ CreateSecondLevelPagingEntryTable (
       DEBUG ((DEBUG_ERROR,"Could not Alloc LVL4 PT. \n"));\r
       return NULL;\r
     }\r
+    FlushPageTableMemory (VtdIndex, (UINTN)SecondLevelPagingEntry, EFI_PAGES_TO_SIZE(1));\r
   }\r
 \r
   //\r
@@ -219,6 +220,7 @@ CreateSecondLevelPagingEntryTable (
         ASSERT(FALSE);\r
         return NULL;\r
       }\r
+      FlushPageTableMemory (VtdIndex, (UINTN)Lvl4PtEntry[Index4].Uint64, SIZE_4KB);\r
       SetSecondLevelPagingEntryAttribute (&Lvl4PtEntry[Index4], EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE);\r
     }\r
 \r
@@ -239,6 +241,7 @@ CreateSecondLevelPagingEntryTable (
           ASSERT(FALSE);\r
           return NULL;\r
         }\r
+        FlushPageTableMemory (VtdIndex, (UINTN)Lvl3PtEntry[Index3].Uint64, SIZE_4KB);\r
         SetSecondLevelPagingEntryAttribute (&Lvl3PtEntry[Index3], EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE);\r
       }\r
 \r
@@ -542,6 +545,7 @@ GetSecondLevelPageTableEntry (
       *PageAttribute = PageNone;\r
       return NULL;\r
     }\r
+    FlushPageTableMemory (VtdIndex, (UINTN)L4PageTable[Index4], SIZE_4KB);\r
     SetSecondLevelPagingEntryAttribute ((VTD_SECOND_LEVEL_PAGING_ENTRY *)&L4PageTable[Index4], EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE);\r
     FlushPageTableMemory (VtdIndex, (UINTN)&L4PageTable[Index4], sizeof(L4PageTable[Index4]));\r
   }\r
@@ -555,6 +559,7 @@ GetSecondLevelPageTableEntry (
       *PageAttribute = PageNone;\r
       return NULL;\r
     }\r
+    FlushPageTableMemory (VtdIndex, (UINTN)L3PageTable[Index3], SIZE_4KB);\r
     SetSecondLevelPagingEntryAttribute ((VTD_SECOND_LEVEL_PAGING_ENTRY *)&L3PageTable[Index3], EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE);\r
     FlushPageTableMemory (VtdIndex, (UINTN)&L3PageTable[Index3], sizeof(L3PageTable[Index3]));\r
   }\r
index 68b25a79bf390c9ee2d2e7b55a7bec6e43756298..0b3006a3c5019932181bb0e1773b26a065893f9c 100644 (file)
@@ -73,7 +73,6 @@ CreateExtContextEntry (
       ExtRootEntry->Bits.UpperContextTablePointerLo  = (UINT32) RShiftU64 ((UINT64)(UINTN)Buffer, 12) + 1;\r
       ExtRootEntry->Bits.UpperContextTablePointerHi  = (UINT32) RShiftU64 (RShiftU64 ((UINT64)(UINTN)Buffer, 12) + 1, 20);\r
       ExtRootEntry->Bits.UpperPresent = 1;\r
-      FlushPageTableMemory (VtdIndex, (UINTN)ExtRootEntry, sizeof(*ExtRootEntry));\r
       Buffer = (UINT8 *)Buffer + EFI_PAGES_TO_SIZE (ContextPages);\r
     }\r
 \r
@@ -93,9 +92,10 @@ CreateExtContextEntry (
       ExtContextEntry->Bits.AddressWidth = 0x2;\r
       break;\r
     }\r
-    FlushPageTableMemory (VtdIndex, (UINTN)ExtContextEntry, sizeof(*ExtContextEntry));\r
   }\r
 \r
+  FlushPageTableMemory (VtdIndex, (UINTN)mVtdUnitInformation[VtdIndex].ExtRootEntryTable, EFI_PAGES_TO_SIZE(EntryTablePages));\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r