xen/arm: mm: Move create_mappings function earlier in the file

This function will be called by other function later one. This will
avoid forward declaration and keep the new function close to sibling
ones.

This was moved just after *_fixmap helpers as they are page table
handling functions too.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Julien Grall authored and Stefano Stabellini committed 2017-04-20 10:31:17 -07:00
1 parent dfb5a92cf8
commit caa4742f2f
1 file changed
+34 -34
+34 -34
View File
@@ -269,6 +269,40 @@ void clear_fixmap(unsigned map)
flush_xen_data_tlb_range_va(FIXMAP_ADDR(map), PAGE_SIZE);
}
/* Create Xen's mappings of memory.
* Mapping_size must be either 2MB or 32MB.
* Base and virt must be mapping_size aligned.
* Size must be a multiple of mapping_size.
* second must be a contiguous set of second level page tables
* covering the region starting at virt_offset. */
static void __init create_mappings(lpae_t *second,
unsigned long virt_offset,
unsigned long base_mfn,
unsigned long nr_mfns,
unsigned int mapping_size)
{
unsigned long i, count;
const unsigned long granularity = mapping_size >> PAGE_SHIFT;
lpae_t pte, *p;
ASSERT((mapping_size == MB(2)) || (mapping_size == MB(32)));
ASSERT(!((virt_offset >> PAGE_SHIFT) % granularity));
ASSERT(!(base_mfn % granularity));
ASSERT(!(nr_mfns % granularity));
count = nr_mfns / LPAE_ENTRIES;
p = second + second_linear_offset(virt_offset);
pte = mfn_to_xen_entry(base_mfn, WRITEALLOC);
if ( granularity == 16 * LPAE_ENTRIES )
pte.pt.contig = 1; /* These maps are in 16-entry contiguous chunks. */
for ( i = 0; i < count; i++ )
{
write_pte(p + i, pte);
pte.pt.base += 1 << LPAE_SHIFT;
}
flush_xen_data_tlb_local();
}
#ifdef CONFIG_DOMAIN_PAGE
void *map_domain_page_global(mfn_t mfn)
{
@@ -633,40 +667,6 @@ void mmu_init_secondary_cpu(void)
flush_xen_text_tlb_local();
}
/* Create Xen's mappings of memory.
* Mapping_size must be either 2MB or 32MB.
* Base and virt must be mapping_size aligned.
* Size must be a multiple of mapping_size.
* second must be a contiguous set of second level page tables
* covering the region starting at virt_offset. */
static void __init create_mappings(lpae_t *second,
unsigned long virt_offset,
unsigned long base_mfn,
unsigned long nr_mfns,
unsigned int mapping_size)
{
unsigned long i, count;
const unsigned long granularity = mapping_size >> PAGE_SHIFT;
lpae_t pte, *p;
ASSERT((mapping_size == MB(2)) || (mapping_size == MB(32)));
ASSERT(!((virt_offset >> PAGE_SHIFT) % granularity));
ASSERT(!(base_mfn % granularity));
ASSERT(!(nr_mfns % granularity));
count = nr_mfns / LPAE_ENTRIES;
p = second + second_linear_offset(virt_offset);
pte = mfn_to_xen_entry(base_mfn, WRITEALLOC);
if ( granularity == 16 * LPAE_ENTRIES )
pte.pt.contig = 1; /* These maps are in 16-entry contiguous chunks. */
for ( i = 0; i < count; i++ )
{
write_pte(p + i, pte);
pte.pt.base += 1 << LPAE_SHIFT;
}
flush_xen_data_tlb_local();
}
#ifdef CONFIG_ARM_32
/* Set up the xenheap: up to 1GB of contiguous, always-mapped memory. */
void __init setup_xenheap_mappings(unsigned long base_mfn,
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.