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

Commit c0c4dd61 authored by Laura Abbott's avatar Laura Abbott
Browse files

cma: Drop alignment requirements for regions not in system



CMA requires that regions be aligned to page block order or higher
to ensure migration types can be changed for whole regions. This
is not applicable if the memory is removed from the system completely.
Keep the alignment requirement at PAGE_SIZE if the memory is outside
the system allocator. Note that if there are alignment requirements
these can still be set up by manually aligning the base/size.

Change-Id: I316008095469492c150e8b69bb20b369579e3a36
Signed-off-by: default avatarLaura Abbott <lauraa@codeaurora.org>
parent d6b5770a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t *res_base,
				       bool to_system, bool remove)
{
	phys_addr_t base = *res_base;
	phys_addr_t alignment;
	phys_addr_t alignment = PAGE_SIZE;
	int ret = 0;

	pr_debug("%s(size %lx, base %pa, limit %pa)\n", __func__,
@@ -353,6 +353,7 @@ int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t *res_base,
		return -EINVAL;

	/* Sanitise input arguments */
	if (!remove)
		alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
	base = ALIGN(base, alignment);
	size = ALIGN(size, alignment);