Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5226ba1 authored by Sudarshan Rajagopalan's avatar Sudarshan Rajagopalan Committed by Hridya Valsaraju
Browse files

ANDROID: GKI: Add API to create pagetable mappings.



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

Test: build
Bug: 150811237
Signed-off-by: default avatarSudarshan Rajagopalan <sudaraja@codeaurora.org>
(cherry picked from commit 5ea86bc1)
[hridya: added EXPORT_SYMBOL_GPL, documentation]
Signed-off-by: default avatarHridya Valsaraju <hridya@google.com>
Change-Id: Ia5cd5f350d63fbe56b592f7f7190cb5e59317647
parent b582ef5b
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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