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

Commit de931a66 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "arm64: Honor limits set by boot parameter"

parents 4e1b15cf 9f9d04a0
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -333,7 +333,16 @@ static void __init update_memory_limit(void)
	phys_addr_t min_ddr_sz = 0, offline_sz = 0;
	int t_len = (2 * dt_root_size_cells) * sizeof(__be32);

	if (memory_limit == PHYS_ADDR_MAX)
		ram_sz = memblock_phys_mem_size();
	else if (IS_ALIGNED(memory_limit, MIN_MEMORY_BLOCK_SIZE))
		ram_sz = memory_limit;
	else {
		WARN(1, "mem-offline is not supported for DDR size %lld\n",
				memory_limit);
		return;
	}

	node = of_get_flat_dt_subnode_by_name(dt_root, "mem-offline");
	if (node == -FDT_ERR_NOTFOUND) {
		pr_err("mem-offine node not found in FDT\n");
@@ -486,12 +495,16 @@ void __init arm64_memblock_init(void)
		memblock_remove(0, memstart_addr);
	}

	update_memory_limit();
	/*
	 * Save bootloader imposed memory limit before we overwirte
	 * memblock.
	 */
	if (memory_limit == PHYS_ADDR_MAX)
		bootloader_memory_limit = memblock_end_of_DRAM();
	else
		bootloader_memory_limit = memblock_max_addr(memory_limit);

	update_memory_limit();

	/*
	 * Apply the memory limit if it was set. Since the kernel may be loaded