]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg: restrict mapping attributes of normal memory to EFI_MEMORY_WB
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 8 Sep 2016 07:40:09 +0000 (08:40 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 8 Sep 2016 09:35:22 +0000 (10:35 +0100)
In general, on an ARM system, mapping normal memory as device memory may
have unintended side effects, given that unaligned accesses or loads and
stores with special semantics (e.g., load/store exclusive) may fault or
may not work as expected.

Under KVM, the situation is even worse, since the host may not expect the
guest to perform uncached accesses, and so writes to such an uncached
region may get lost completely.

Since the only safe mapping type under KVM is EFI_MEMORY_WB, remove all
other memory type attributes.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
ArmVirtPkg/HighMemDxe/HighMemDxe.c
ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c

index 7fd7e8e9a5390ee8e4ba417521dce3bfe53e7927..4d56e6236b54eeac81e80550c924cd66347d57f9 100644 (file)
@@ -78,8 +78,7 @@ InitializeHighMemDxe (
           Status = gDS->AddMemorySpace (\r
                           EfiGcdMemoryTypeSystemMemory,\r
                           CurBase, CurSize,\r
-                          EFI_MEMORY_WB | EFI_MEMORY_WC |\r
-                          EFI_MEMORY_WT | EFI_MEMORY_UC);\r
+                          EFI_MEMORY_WB);\r
 \r
           if (EFI_ERROR (Status)) {\r
             DEBUG ((EFI_D_ERROR,\r
index 251e5314e61dcf4295528bbd2c07bc6848cdb6ac..6f3e54b7afcb6ecc9eae5af53c6449244250a6d8 100644 (file)
@@ -68,9 +68,6 @@ MemoryPeim (
   ResourceAttributes = (\r
       EFI_RESOURCE_ATTRIBUTE_PRESENT |\r
       EFI_RESOURCE_ATTRIBUTE_INITIALIZED |\r
-      EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |\r
-      EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |\r
-      EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |\r
       EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |\r
       EFI_RESOURCE_ATTRIBUTE_TESTED\r
   );\r