]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/ArmMmuLib: Add new attribute WRITE_BACK_NONSHAREABLE
authorPeicong Li <lipeicong@huawei.com>
Tue, 7 Nov 2017 12:56:51 +0000 (20:56 +0800)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 7 Nov 2017 13:29:46 +0000 (13:29 +0000)
Flash region needs to be set as cacheable (write back) to increase
performance, if PEI is still XIP on flash or DXE FV is decompressed
from flash FV. However some ARM platforms do not support to set flash
as inner shareable since flash is not normal DDR memory and it will
not respond to cache snoop request, which will causes system hang
after MMU is enabled.

So we need a new ARM memory region attribute WRITE_BACK_NONSHAREABLE
for flash region on these platforms specifically. This attribute will
set the region as write back but not inner shared.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Peicong Li <lipeicong@huawei.com>
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPkg/Include/Library/ArmLib.h
ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c

index 24ffe9f1aaa7d5c54bc585ec9ddde5269f3dd40e..24e84c7a19658df8fd9941813931b39432c28e5d 100644 (file)
@@ -41,6 +41,14 @@ typedef enum {
   ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_UNCACHED_UNBUFFERED,\r
   ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK,\r
   ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK,\r
+\r
+  // On some platforms, memory mapped flash region is designed as not supporting\r
+  // shareable attribute, so WRITE_BACK_NONSHAREABLE is added for such special\r
+  // need.\r
+  // Do NOT use below two attributes if you are not sure.\r
+  ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_NONSHAREABLE,\r
+  ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK_NONSHAREABLE,\r
+\r
   ARM_MEMORY_REGION_ATTRIBUTE_WRITE_THROUGH,\r
   ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_THROUGH,\r
   ARM_MEMORY_REGION_ATTRIBUTE_DEVICE,\r
index 8bd1c6fad95f7c57c19a5f66f963f73ce8a6eb0a..4b62ecb6a47650b318b852815f02e26251b8b789 100644 (file)
@@ -35,6 +35,10 @@ ArmMemoryAttributeToPageAttribute (
   )\r
 {\r
   switch (Attributes) {\r
+  case ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_NONSHAREABLE:\r
+  case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK_NONSHAREABLE:\r
+    return TT_ATTR_INDX_MEMORY_WRITE_BACK;\r
+\r
   case ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK:\r
   case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK:\r
     return TT_ATTR_INDX_MEMORY_WRITE_BACK | TT_SH_INNER_SHAREABLE;\r