From: David Vrabel <david.vrabel@citrix.com>
To: Tim Deegan <tim@xen.org>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 4/7] arm: map device tree blob in initial page tables
Date: Mon, 6 Feb 2012 17:36:19 +0000 [thread overview]
Message-ID: <4F300F93.3020404@citrix.com> (raw)
In-Reply-To: <20120203211836.GD78380@ocelot.phlegethon.org>
On 03/02/12 21:18, Tim Deegan wrote:
> At 19:15 +0000 on 03 Feb (1328296512), David Vrabel wrote:
>> From: David Vrabel <david.vrabel@citrix.com>
>>
>> Add a 1:1 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.
>>
>> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
>> ---
>> xen/arch/arm/head.S | 5 +++++
>> 1 files changed, 5 insertions(+), 0 deletions(-)
>>
>> diff --git a/xen/arch/arm/head.S b/xen/arch/arm/head.S
>> index 9951f37..8385481 100644
>> --- a/xen/arch/arm/head.S
>> +++ b/xen/arch/arm/head.S
>> @@ -202,6 +202,11 @@ hyp:
>> add r4, r4, #8
>> strd r2, r3, [r1, r4] /* Map it in the fixmap's slot */
>> #endif
>> + mov r3, #0x0
>> + orr r2, r8, #0xe00
>> + orr r2, r2, #0x07d
>> + mov r4, r8, lsr #18 /* Slot for (r8 == atag_paddr) */
>> + strd r2, r3, [r1, r4] /* Map DTB there */
>
> It might be better to map the DTB at a fixed VA (say, the next
> second-level slot up from the fixmap one) so we don't have to worry
> about the DTB's PA clashing with Xen's VAs.
That was already used in setup_pagetables() to relocate Xen but since
the two uses don't overlap they can share the same slot. Not 100% sure
on the TLB flush after updating the L2 PTE -- it makes it work but is it
sufficient/optimal?
8<-------
arm: map device tree blob in initial page tables
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>
---
xen/arch/arm/head.S | 7 +++++++
xen/arch/arm/mm.c | 5 +++--
xen/include/asm-arm/config.h | 6 ++++++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/head.S b/xen/arch/arm/head.S
index 3c1f624..f1a81b3 100644
--- a/xen/arch/arm/head.S
+++ b/xen/arch/arm/head.S
@@ -201,6 +201,13 @@ hyp:
add r4, r4, #8
strd r2, r3, [r1, r4] /* Map it in the fixmap's 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")
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 613d084..0599102 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -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();
/* Calculate virt-to-phys offset for the new location */
phys_offset = xen_paddr - (unsigned long) _start;
diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
index 12285dd..8546a50 100644
--- a/xen/include/asm-arm/config.h
+++ b/xen/include/asm-arm/config.h
@@ -52,15 +52,21 @@
* 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
David
next prev parent reply other threads:[~2012-02-06 17:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-03 19:15 [PATCH 0/7] RFC: arm: (really) minimal device tree support David Vrabel
2012-02-03 19:15 ` [PATCH 1/7] libfdt: add version 1.3.0 David Vrabel
2012-02-03 19:15 ` [PATCH 2/7] libfdt: add to build David Vrabel
2012-02-03 19:15 ` [PATCH 3/7] arm: link a device tree blob into the xen image David Vrabel
2012-02-03 20:22 ` Tim Deegan
2012-02-03 19:15 ` [PATCH 4/7] arm: map device tree blob in initial page tables David Vrabel
2012-02-03 21:18 ` Tim Deegan
2012-02-06 17:36 ` David Vrabel [this message]
2012-02-07 9:28 ` Tim Deegan
2012-02-03 19:15 ` [PATCH 5/7] libfdt: fixup libfdt_env.h for xen David Vrabel
2012-02-03 19:15 ` [PATCH 6/7] arm: add early_printk() David Vrabel
2012-02-03 19:15 ` [PATCH 7/7] arm, device tree: parse the DTB for RAM location and size David Vrabel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F300F93.3020404@citrix.com \
--to=david.vrabel@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).