
On 02/02/2017 10:58 AM, York Sun wrote:
Page descriptor uses different format than block descriptor. Both bit 1 and 0 must be set to indicate a valid page.
diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c
@@ -230,7 +230,7 @@ static void add_map(struct mm_region *map) /* Page fits, create block PTE */ debug("Setting PTE %p to block virt=%llx\n", pte, virt);
*pte = phys | attrs;
*pte = phys | attrs | (level == 3 ? PTE_TYPE_PAGE : 0);
The value of attrs already includes PTE_TYPE_BLOCK. Luckily, the bits set in the value of PTE_TYPE_BLOCK is a strict subset of the bits set in the value of PTE_TYPE_PAGE, so this works fine. Still, it might be clearer to explicitly remove PTE_TYPE_BLOCK before adding in PTE_TYPE_PAGE, or simply add a comment explaining why the code is OK as written.
With one of those fixes, Reviewed-by: Stephen Warren swarren@nvidia.com