From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: julien.grall@citrix.com, tim@xen.org,
Ian Campbell <ian.campbell@citrix.com>,
stefano.stabellini@eu.citrix.com
Subject: [PATCH v3 06/10] xen: arm: Add a pte_of_xenaddr helper
Date: Thu, 8 Aug 2013 13:15:13 +0100 [thread overview]
Message-ID: <1375964117-23120-6-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1375964079.970.94.camel@kazak.uk.xensource.com>
The open coded version is pretty ugly, not helped by rigid enforcement of an
80 character line length.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
xen/arch/arm/mm.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 7781202..974d6df 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -331,6 +331,13 @@ void __cpuinit setup_virt_paging(void)
* write to TTBR0 has completed. */ \
flush_xen_text_tlb()
+static inline lpae_t pte_of_xenaddr(vaddr_t va)
+{
+ paddr_t ma = va + phys_offset;
+ unsigned long mfn = ma >> PAGE_SHIFT;
+ return mfn_to_xen_entry(mfn);
+}
+
/* Boot-time pagetable setup.
* Changes here may need matching changes in head.S */
void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
@@ -387,8 +394,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
flush_xen_text_tlb();
/* Link in the fixmap pagetable */
- pte = mfn_to_xen_entry((((unsigned long) xen_fixmap) + phys_offset)
- >> PAGE_SHIFT);
+ pte = pte_of_xenaddr((vaddr_t)xen_fixmap);
pte.pt.table = 1;
write_pte(xen_second + second_table_offset(FIXMAP_ADDR(0)), pte);
/*
@@ -415,8 +421,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
write_pte(xen_xenmap + i, pte);
/* No flush required here as page table is not hooked in yet. */
}
- pte = mfn_to_xen_entry((((unsigned long) xen_xenmap) + phys_offset)
- >> PAGE_SHIFT);
+ pte = pte_of_xenaddr((vaddr_t)xen_xenmap);
pte.pt.table = 1;
write_pte(xen_second + second_linear_offset(XEN_VIRT_START), pte);
/* TLBFLUSH and ISB would be needed here, but wait until we set WXN */
--
1.7.2.5
next prev parent reply other threads:[~2013-08-08 12:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-08 12:14 [PATCH v3 00/10] xen: arm: direct 1:1 map on 64 bit Ian Campbell
2013-08-08 12:15 ` [PATCH v3 01/10] xen: arm: Use _AC macros in config.h Ian Campbell
2013-08-08 12:15 ` [PATCH v3 02/10] xen: arm: Add zeroeth level page table macros and defines Ian Campbell
2013-08-08 14:01 ` Tim Deegan
2013-08-08 12:15 ` [PATCH v3 03/10] xen: arm: Rename page table "hint" field to slightly more descriptive "contig" Ian Campbell
2013-08-08 12:15 ` [PATCH v3 04/10] xen: arm: refactor create_mappings Ian Campbell
2013-08-08 12:15 ` [PATCH v3 05/10] xen: arm: define a macro to get this CPUs page table root Ian Campbell
2013-08-08 12:15 ` Ian Campbell [this message]
2013-08-08 12:15 ` [PATCH v3 07/10] xen: arm: fix is_xen_fixed_mfn Ian Campbell
2013-08-08 12:15 ` [PATCH v3 08/10] xen: arm: allow virt_to_maddr to take either a pointer or an integer Ian Campbell
2013-08-08 12:15 ` [PATCH v3 09/10] xen: gate split heap code on its own config option rather than !X86 Ian Campbell
2013-08-08 12:15 ` [PATCH v3 10/10] xen: arm: Use a direct mapping of RAM on arm64 Ian Campbell
2013-08-20 15:02 ` [PATCH v3 00/10] xen: arm: direct 1:1 map on 64 bit Ian Campbell
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=1375964117-23120-6-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=julien.grall@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/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).