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

Commit 46d635e8 authored by Arun KS's avatar Arun KS Committed by Isaac J. Manjarres
Browse files

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: default avatarArun KS <arunks@codeaurora.org>
[sudaraja@codeaurora.org: check limit with physical address of page]
Signed-off-by: default avatarSudarshan Rajagopalan <sudaraja@codeaurora.org>
[swatsrid@codeaurora.org: Fix merge conflicts]
Signed-off-by: default avatarSwathi Sridhar <swatsrid@codeaurora.org>
[isaacm@codeaurora.org: Fix merge conflicts/use generic page onlining]
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent e5198921
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;
+7 −0
Original line number Diff line number Diff line
@@ -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