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

Commit 6b40080d authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Remove full flush option from bulk cache flush on ARM64



It appear that flush_cache_all() (which uses the set/way ops)
doesn't affect the state of the caches of other CPUs so there is
still a risk of getting stale data from a CPU that was blissfully
unaware that a flush happened.

So far this has only been seen on ARM64 targets (8994 and 8939) and
we are optimistic that the damage is limited to those targets so
disable the full flush safety valve from the bulk cache operation
on ARM64.  The downside is that the performance for flushing lots
of caches goes way way down but right now we should be far more
concerned with making sure the bits are right than we should be
with the bits going fast.

Change-Id: Ic0dedbadf099b842338c3edd953b50c4246c140c
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent 8e7973e2
Loading
Loading
Loading
Loading
+20 −6
Original line number Diff line number Diff line
@@ -3343,6 +3343,23 @@ static int mem_id_cmp(const void *_a, const void *_b)
	return (*a > *b) ? 1 : -1;
}

#ifdef CONFIG_ARM64
/* Do not support full flush on ARM64 targets */
static inline bool check_full_flush(size_t size, int op)
{
	return false;
}
#else
/* Support full flush if the size is bigger than the threshold */
static inline bool check_full_flush(size_t size, int op)
{
	/* If we exceed the breakeven point, flush the entire cache */
	return (kgsl_driver.full_cache_threshold != 0) &&
		(size >= kgsl_driver.full_cache_threshold) &&
		(op == KGSL_GPUMEM_CACHE_FLUSH);
}
#endif

long kgsl_ioctl_gpumem_sync_cache_bulk(struct kgsl_device_private *dev_priv,
	unsigned int cmd, void *data)
{
@@ -3401,13 +3418,10 @@ long kgsl_ioctl_gpumem_sync_cache_bulk(struct kgsl_device_private *dev_priv,
		op_size += entry->memdesc.size;
		entries[actual_count++] = entry;

		/* If we exceed the breakeven point, flush the entire cache */
		if (kgsl_driver.full_cache_threshold != 0 &&
		    op_size >= kgsl_driver.full_cache_threshold &&
		    param->op == KGSL_GPUMEM_CACHE_FLUSH) {
			full_flush = true;
		full_flush  = check_full_flush(op_size, param->op);
		if (full_flush)
			break;
		}

		last_id = id;
	}
	if (full_flush) {