mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 21:22:09 -04:00
arm64: Honor limits set by bootloader
Introduce a variable to save bootloader enforced memory limits and restricts adding beyond this boundary during a memory hotplug. Also, export this symbol so that other kernel module have access to it. Change-Id: I28c100644b7287ec4625c4c018b5fffc865e2e72 Signed-off-by: Arun KS <arunks@codeaurora.org> [sudaraja@codeaurora.org: check limit with physical address of page] Signed-off-by: Sudarshan Rajagopalan <sudaraja@codeaurora.org> [swatsrid@codeaurora.org: Fix merge conflicts] Signed-off-by: Swathi Sridhar <swatsrid@codeaurora.org> [isaacm@codeaurora.org: Fix merge conflicts/use generic page onlining] Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
parent
e5198921dc
commit
46d635e8bd
2 changed files with 10 additions and 0 deletions
|
|
@ -189,6 +189,9 @@ extern u64 kimage_vaddr;
|
|||
/* the offset between the kernel virtual and physical mappings */
|
||||
extern u64 kimage_voffset;
|
||||
|
||||
/* physical memory limit imposed by the booloader */
|
||||
extern phys_addr_t bootloader_memory_limit;
|
||||
|
||||
static inline unsigned long kaslr_offset(void)
|
||||
{
|
||||
return kimage_vaddr - KIMAGE_VADDR;
|
||||
|
|
|
|||
|
|
@ -257,6 +257,7 @@ int pfn_valid(unsigned long pfn)
|
|||
EXPORT_SYMBOL(pfn_valid);
|
||||
|
||||
static phys_addr_t memory_limit = PHYS_ADDR_MAX;
|
||||
phys_addr_t bootloader_memory_limit;
|
||||
|
||||
/*
|
||||
* Limit the memory size that was specified via FDT.
|
||||
|
|
@ -349,6 +350,12 @@ void __init arm64_memblock_init(void)
|
|||
memblock_remove(0, memstart_addr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Save bootloader imposed memory limit before we overwirte
|
||||
* memblock.
|
||||
*/
|
||||
bootloader_memory_limit = memblock_end_of_DRAM();
|
||||
|
||||
/*
|
||||
* Apply the memory limit if it was set. Since the kernel may be loaded
|
||||
* high up in memory, add back the kernel region that must be accessible
|
||||
|
|
|
|||
Loading…
Reference in a new issue