From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: [PATCH 04/10] xen: arm: refactor create_mappings Date: Tue, 18 Jun 2013 14:26:51 +0100 Message-ID: <1371562017-5379-4-git-send-email-ian.campbell@citrix.com> References: <1371562002.22783.25.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1371562002.22783.25.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: julien.grall@citrix.com, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org Allow it to work on contiguous second level tables mapping an arbitrary region of memory. Rename it to create_32mb_mappings. Signed-off-by: Ian Campbell --- xen/arch/arm/mm.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index d57e44e..0698c75 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -511,20 +511,23 @@ void __cpuinit mmu_init_secondary_cpu(void) } /* Create Xen's mappings of memory. - * Base and virt must be 32MB aligned and size a multiple of 32MB. */ -static void __init create_mappings(unsigned long virt, - unsigned long base_mfn, - unsigned long nr_mfns) + * Base and virt must be 32MB aligned and size a multiple of 32MB. + * second must be a contiguous set of second level page tables + * covering the region starting at virt_offset. */ +static void __init create_32mb_mappings(lpae_t *second, + unsigned long virt_offset, + unsigned long base_mfn, + unsigned long nr_mfns) { unsigned long i, count; lpae_t pte, *p; - ASSERT(!((virt >> PAGE_SHIFT) % (16 * LPAE_ENTRIES))); + ASSERT(!((virt_offset >> PAGE_SHIFT) % (16 * LPAE_ENTRIES))); ASSERT(!(base_mfn % (16 * LPAE_ENTRIES))); ASSERT(!(nr_mfns % (16 * LPAE_ENTRIES))); count = nr_mfns / LPAE_ENTRIES; - p = xen_second + second_linear_offset(virt); + p = second + second_linear_offset(virt_offset); pte = mfn_to_xen_entry(base_mfn); pte.pt.contig = 1; /* These maps are in 16-entry contiguous chunks. */ for ( i = 0; i < count; i++ ) @@ -539,7 +542,7 @@ static void __init create_mappings(unsigned long virt, void __init setup_xenheap_mappings(unsigned long base_mfn, unsigned long nr_mfns) { - create_mappings(XENHEAP_VIRT_START, base_mfn, nr_mfns); + create_32mb_mappings(xen_second, XENHEAP_VIRT_START, base_mfn, nr_mfns); /* Record where the xenheap is, for translation routines. */ xenheap_virt_end = XENHEAP_VIRT_START + nr_mfns * PAGE_SIZE; @@ -559,7 +562,7 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) /* Round up to 32M boundary */ frametable_size = (frametable_size + 0x1ffffff) & ~0x1ffffff; base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 32<<(20-12)); - create_mappings(FRAMETABLE_VIRT_START, base_mfn, frametable_size >> PAGE_SHIFT); + create_32mb_mappings(xen_second, FRAMETABLE_VIRT_START, base_mfn, frametable_size >> PAGE_SHIFT); memset(&frame_table[0], 0, nr_pages * sizeof(struct page_info)); memset(&frame_table[nr_pages], -1, -- 1.7.2.5