Revision: 18568
          http://sourceforge.net/p/edk2/code/18568
Author:   abiesheuvel
Date:     2015-10-02 14:48:21 +0000 (Fri, 02 Oct 2015)
Log Message:
-----------
ArmPkg/Mmu: do not configure block translations at level 0

Now that the AArch64 MMU code correctly identifies and handles
naturally aligned regions of more than 2 MB in size, it will happily
try to use block mappings at level 0 to map huge memory regions, such
as the single cacheable 1:1 mapping we use for Xen domU to map the
entire PA space. However, block mappings are not supported at level 0
so the resulting translation tables will be incorrect, causing
execution to fail as soon as the MMU is enabled.

So use level 1 as the minimum level at which to perform block
translations.

Reported-by: Julien Grall <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <[email protected]>
Tested-by: Stefano Stabellini <[email protected]>
Reviewed-by: Leif Lindholm <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c

Modified: trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c
===================================================================
--- trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c       2015-10-01 
14:01:24 UTC (rev 18567)
+++ trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c       2015-10-02 
14:48:21 UTC (rev 18568)
@@ -295,8 +295,9 @@
     BaseAddressAlignment = LowBitSet64 (RegionStart);
   }
 
-  // Identify the Page Level the RegionStart must belongs to
-  PageLevel = 3 - ((BaseAddressAlignment - 12) / 9);
+  // Identify the Page Level the RegionStart must belong to. Note that 
PageLevel
+  // should be at least 1 since block translations are not supported at level 0
+  PageLevel = MAX (3 - ((BaseAddressAlignment - 12) / 9), 1);
 
   // If the required size is smaller than the current block size then we need 
to go to the page below.
   // The PageLevel was calculated on the Base Address alignment but did not 
take in account the alignment


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to