]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
Re-instate "xen/arm: fix mask calculation in pdx_init_mask"
authorStefano Stabellini <sstabellini@kernel.org>
Fri, 21 Jun 2019 20:20:25 +0000 (13:20 -0700)
committerStefano Stabellini <sstabellini@kernel.org>
Fri, 26 Jul 2019 16:45:08 +0000 (09:45 -0700)
The commit 11911563610786615c2b3a01cdcaaf09a6f9e38d "xen/arm: fix mask
calculation in pdx_init_mask" was correct, but exposed a bug in
maddr_to_virt(). The bug in maddr_to_virt() was fixed by
612d476e74a314be514ee6a9744eea8db09d32e5 "xen/arm64: Correctly compute
the virtual address in maddr_to_virt()", so we can re-instate the
first commit now.

Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>
xen/arch/arm/setup.c
xen/common/pdx.c

index d5d188a10581dcec365dc9aab674a8387c1df6b3..215746a5c39676cd1db76cde9001361c4795ec96 100644 (file)
@@ -484,7 +484,14 @@ static void __init init_pdx(void)
 {
     paddr_t bank_start, bank_size, bank_end;
 
-    uint64_t mask = pdx_init_mask(bootinfo.mem.bank[0].start);
+    /*
+     * Arm does not have any restrictions on the bits to compress. Pass 0 to
+     * let the common code further restrict the mask.
+     *
+     * If the logic changes in pfn_pdx_hole_setup we might have to
+     * update this function too.
+     */
+    uint64_t mask = pdx_init_mask(0x0);
     int bank;
 
     for ( bank = 0 ; bank < bootinfo.mem.nr_banks; bank++ )
index 8356f03ce86e4f46779a887319392d1a90f18635..c91875fabe2b070ba42a043be2a95ec846c5f832 100644 (file)
@@ -50,9 +50,11 @@ static u64 __init fill_mask(u64 mask)
     return mask;
 }
 
+/* We don't want to compress the low MAX_ORDER bits of the addresses. */
 uint64_t __init pdx_init_mask(uint64_t base_addr)
 {
-    return fill_mask(base_addr - 1);
+    return fill_mask(max(base_addr,
+                         (uint64_t)1 << (MAX_ORDER + PAGE_SHIFT)) - 1);
 }
 
 u64 __init pdx_region_mask(u64 base, u64 len)
@@ -80,6 +82,9 @@ void __init pfn_pdx_hole_setup(unsigned long mask)
      * This guarantees that page-pointer arithmetic remains valid within
      * contiguous aligned ranges of 2^MAX_ORDER pages. Among others, our
      * buddy allocator relies on this assumption.
+     *
+     * If the logic changes here, we might have to update the ARM specific
+     * init_pdx too.
      */
     for ( j = MAX_ORDER-1; ; )
     {