arm: map device tree blob in initial page tables
authorDavid Vrabel <david.vrabel@citrix.com>
Mon, 13 Feb 2012 14:24:49 +0000 (14:24 +0000)
committerDavid Vrabel <david.vrabel@citrix.com>
Mon, 13 Feb 2012 14:24:49 +0000 (14:24 +0000)
Add a mapping for the device tree blob in the initial page tables.
This will allow the DTB to be parsed for memory information prior to
setting up the real page tables.

It is mapped into the first L2 slot after the fixmap.  When this slot
is reused in setup_pagetables(), flush the TLB.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/head.S
xen/arch/arm/mm.c
xen/include/asm-arm/config.h

index ea557c21cf4f1128f9b4bd41b5d98423597bfa66..8b2342465c6c035f0d33ac6af46c0707739bf627 100644 (file)
@@ -202,7 +202,16 @@ hyp:
        orr   r2, r2, #0x071         /* r2:r3 := 2MB dev map including UART */
        add   r4, r4, #8
        strd  r2, r3, [r1, r4]       /* Map it in the fixmap's slot */
+#else
+       add   r4, r4, #8             /* Skip over unused fixmap slot */
 #endif
+       mov   r3, #0x0
+       lsr   r2, r8, #21
+       lsl   r2, r2, #21            /* 2MB-aligned paddr of DTB */
+       orr   r2, r2, #0xf00
+       orr   r2, r2, #0x07d         /* r2:r3 := 2MB RAM incl. DTB */
+       add   r4, r4, #8
+       strd  r2, r3, [r1, r4]       /* Map it in the early boot slot */
 
        PRINT("- Turning on paging -\r\n")
 
index c8635072d2d450a3759ac26e4a7bde48c4e3f9e6..f1fe4ba4fdbd36b18503ab8bff928fd73e5de0c3 100644 (file)
@@ -161,10 +161,11 @@ void __init setup_pagetables(unsigned long boot_phys_offset)
 
     xen_paddr = XEN_PADDR;
 
-    /* Map the destination in the empty L2 above the fixmap */
-    dest_va = FIXMAP_ADDR(0) + (1u << SECOND_SHIFT);
+    /* Map the destination in the boot misc area. */
+    dest_va = BOOT_MISC_VIRT_START;
     pte = mfn_to_xen_entry(xen_paddr >> PAGE_SHIFT);
     write_pte(xen_second + second_table_offset(dest_va), pte);
+    flush_xen_data_tlb_va(dest_va);
 
     /* Calculate virt-to-phys offset for the new location */
     phys_offset = xen_paddr - (unsigned long) _start;
index 9294f8f71f75c6be3f30eb74387c509441aa397d..c2ab0a21a2ddedbe5d72ff6a44e76fa6b8c85ba7 100644 (file)
  *  0  -   2M   Unmapped
  *  2M -   4M   Xen text, data, bss
  *  4M -   6M   Fixmap: special-purpose 4K mapping slots
+ *  6M  -  8M   Early boot misc (see below)
  *
  * 32M - 128M   Frametable: 24 bytes per page for 16GB of RAM
  *
  *  1G -   2G   Xenheap: always-mapped memory
  *  2G -   4G   Domheap: on-demand-mapped
+ *
+ * The early boot misc area is used:
+ *   - in head.S for the DTB for device_tree_early_init().
+ *   - in setup_pagetables() when relocating Xen.
  */
 
 #define XEN_VIRT_START         0x00200000
 #define FIXMAP_ADDR(n)        (0x00400000 + (n) * PAGE_SIZE)
+#define BOOT_MISC_VIRT_START   0x00600000
 #define FRAMETABLE_VIRT_START  0x02000000
 #define XENHEAP_VIRT_START     0x40000000
 #define DOMHEAP_VIRT_START     0x80000000