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

Commit fe48ed94 authored by Stephen Boyd's avatar Stephen Boyd Committed by Suren Baghdasaryan
Browse files

ANDROID: GKI: memblock: Add memblock_overlaps_memory() to fix ABI diff



This is needed to reduce the ABI diff for vendors.
Add a new function, memblock_overlaps_memory(), to check if a
region overlaps with a memory bank. This will be used by
peripheral loader code to detect when kernel memory would be
overwritten.

Signed-off-by: default avatarSwathi Sridhar <swatsrid@codeaurora.org>
(cherry picked from commit bbbc80b6)
[surenb: cherry-picked parts from:
bbbc80b6 "ion : Merge ion changes..."
to fix ABI diff caused by memblock_overlaps_memory function]
Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
Bug: 150875716
Test: build
Change-Id: I6ee723c99ef171f23a621d130eded843222ba4f7
parent f32f289c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -352,6 +352,7 @@ bool memblock_is_map_memory(phys_addr_t addr);
bool memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
bool memblock_is_reserved(phys_addr_t addr);
bool memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
bool memblock_overlaps_memory(phys_addr_t base, phys_addr_t size);

extern void __memblock_dump_all(void);

+8 −0
Original line number Diff line number Diff line
@@ -1773,6 +1773,14 @@ bool __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t siz
		 memblock.memory.regions[idx].size) >= end;
}

bool __init_memblock memblock_overlaps_memory(phys_addr_t base,
					      phys_addr_t size)
{
	memblock_cap_size(base, &size);

	return memblock_overlaps_region(&memblock.memory, base, size);
}

/**
 * memblock_is_region_reserved - check if a region intersects reserved memory
 * @base: base of region to check