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

Commit b7f89698 authored by Neeti Desai's avatar Neeti Desai
Browse files

msm: ion: Do not check for overlapping ion heaps



To support new usecases, HLOS will permit of sharing
of the CMA pool between the ion heaps. Going forward
we do not need to check if the heaps overlap.

Change-Id: I1dee72147fad994a1c88ea9dfcf7402ba98f3609
Signed-off-by: default avatarNeeti Desai <neetid@codeaurora.org>
parent 3311f658
Loading
Loading
Loading
Loading
+0 −40
Original line number Diff line number Diff line
@@ -307,45 +307,6 @@ static void msm_ion_allocate(struct ion_platform_heap *heap)
	}
}

static int is_heap_overlapping(const struct ion_platform_heap *heap1,
				const struct ion_platform_heap *heap2)
{
	ion_phys_addr_t heap1_base = heap1->base;
	ion_phys_addr_t heap2_base = heap2->base;
	ion_phys_addr_t heap1_end = heap1->base + heap1->size - 1;
	ion_phys_addr_t heap2_end = heap2->base + heap2->size - 1;

	if (heap1_base == heap2_base)
		return 1;
	if (heap1_base < heap2_base && heap1_end >= heap2_base)
		return 1;
	if (heap2_base < heap1_base && heap2_end >= heap1_base)
		return 1;
	return 0;
}

static void check_for_heap_overlap(const struct ion_platform_heap heap_list[],
				   unsigned long nheaps)
{
	unsigned long i;
	unsigned long j;

	for (i = 0; i < nheaps; ++i) {
		const struct ion_platform_heap *heap1 = &heap_list[i];
		if (!heap1->base)
			continue;
		for (j = i + 1; j < nheaps; ++j) {
			const struct ion_platform_heap *heap2 = &heap_list[j];
			if (!heap2->base)
				continue;
			if (is_heap_overlapping(heap1, heap2)) {
				panic("Memory in heap %s overlaps with heap %s\n",
					heap1->name, heap2->name);
			}
		}
	}
}

#ifdef CONFIG_OF
static int msm_init_extra_data(struct device_node *node,
			       struct ion_platform_heap *heap,
@@ -1054,7 +1015,6 @@ static int msm_ion_probe(struct platform_device *pdev)

		ion_device_add_heap(new_dev, heaps[i]);
	}
	check_for_heap_overlap(pdata->heaps, num_heaps);
	if (pdata_needs_to_be_freed)
		free_pdata(pdata);