ANDROID: GKI: Add API to create pagetable mappings.

This is modified version of commit 5ea86bc10f
to only include the ABI diff, i.e. the addition of
the create_pgtable_mapping() function.

Test: build
Bug: 150811237
Signed-off-by: Sudarshan Rajagopalan <sudaraja@codeaurora.org>
(cherry picked from commit 5ea86bc10f)
[hridya: added EXPORT_SYMBOL_GPL, documentation]
Signed-off-by: Hridya Valsaraju <hridya@google.com>
Change-Id: Ia5cd5f350d63fbe56b592f7f7190cb5e59317647
This commit is contained in:
Sudarshan Rajagopalan 2019-03-14 15:33:45 -07:00 committed by Hridya Valsaraju
parent b582ef5b4d
commit a5226ba1f0
2 changed files with 22 additions and 0 deletions

View file

@ -361,6 +361,27 @@ static phys_addr_t pgd_pgtable_alloc(void)
return __pa(ptr);
}
/**
* create_pgtable_mapping - create a pagetable mapping for given
* physical start and end addresses.
* @start: physical start address.
* @end: physical end address.
*/
void create_pgtable_mapping(phys_addr_t start, phys_addr_t end)
{
unsigned long virt = (unsigned long)phys_to_virt(start);
if (virt < VMALLOC_START) {
pr_warn("BUG: not creating mapping for %pa at 0x%016lx - outside kernel range\n",
&start, virt);
return;
}
__create_pgd_mapping(init_mm.pgd, start, virt, end - start,
PAGE_KERNEL, NULL, 0);
}
EXPORT_SYMBOL_GPL(create_pgtable_mapping);
/*
* This function can only be used to modify existing table entries,
* without allocating new levels of table. Note that this permits the

View file

@ -140,6 +140,7 @@ void __next_reserved_mem_region(u64 *idx, phys_addr_t *out_start,
void __memblock_free_early(phys_addr_t base, phys_addr_t size);
void __memblock_free_late(phys_addr_t base, phys_addr_t size);
void create_pgtable_mapping(phys_addr_t start, phys_addr_t end);
/**
* for_each_mem_range - iterate through memblock areas from type_a and not