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

Commit cec9c695 authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

gpu: ion: system_heap: invalidate cache on cached pool allocations



We need to invalidate the cache when allocating pages for the cached
page pools to avoid the possibility of a stale cached value from a
different mapping being written back after we allocate our page.

Change-Id: I9b0ebfd143850cf4a4ef309a264f947a57abff77
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent da890d00
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -355,7 +355,8 @@ static void ion_system_heap_destroy_pools(struct ion_page_pool **pools)
 * nothing. If it succeeds you'll eventually need to use
 * ion_system_heap_destroy_pools to destroy the pools.
 */
static int ion_system_heap_create_pools(struct ion_page_pool **pools)
static int ion_system_heap_create_pools(struct ion_page_pool **pools,
					bool should_invalidate)
{
	int i;
	for (i = 0; i < num_orders; i++) {
@@ -364,7 +365,8 @@ static int ion_system_heap_create_pools(struct ion_page_pool **pools)

		if (orders[i] > 4)
			gfp_flags = high_order_gfp_flags;
		pool = ion_page_pool_create(gfp_flags, orders[i], false);
		pool = ion_page_pool_create(gfp_flags, orders[i],
					should_invalidate);
		if (!pool)
			goto err_create_pool;
		pools[i] = pool;
@@ -395,10 +397,10 @@ struct ion_heap *ion_system_heap_create(struct ion_platform_heap *unused)
	if (!heap->cached_pools)
		goto err_alloc_cached_pools;

	if (ion_system_heap_create_pools(heap->uncached_pools))
	if (ion_system_heap_create_pools(heap->uncached_pools, false))
		goto err_create_uncached_pools;

	if (ion_system_heap_create_pools(heap->cached_pools))
	if (ion_system_heap_create_pools(heap->cached_pools, true))
		goto err_create_cached_pools;

	heap->heap.shrinker.shrink = ion_system_heap_shrink;