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

Commit 4c8217a2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Restrict GPU memory object alignment to 32MB"

parents 76c6e6b4 c3173590
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -3241,6 +3241,9 @@ static int kgsl_filter_cachemode(unsigned int flags)
}
#endif

/* The largest allowable alignment for a GPU object is 32MB */
#define KGSL_MAX_ALIGN (32 * SZ_1M)

/*
 * The common parts of kgsl_ioctl_gpumem_alloc and kgsl_ioctl_gpumem_alloc_id.
 */
@@ -3276,11 +3279,13 @@ _gpumem_alloc(struct kgsl_device_private *dev_priv,
	/* Cap the alignment bits to the highest number we can handle */

	align = (flags & KGSL_MEMALIGN_MASK) >> KGSL_MEMALIGN_SHIFT;
	if (align >= 32) {
		KGSL_CORE_ERR("Alignment too big, restricting to 2^31\n");
	if (align >= ilog2(KGSL_MAX_ALIGN)) {
		KGSL_CORE_ERR("Alignment too large; restricting to %dK\n",
			KGSL_MAX_ALIGN >> 10);

		flags &= ~KGSL_MEMALIGN_MASK;
		flags |= (31 << KGSL_MEMALIGN_SHIFT) & KGSL_MEMALIGN_MASK;
		flags |= (ilog2(KGSL_MAX_ALIGN) << KGSL_MEMALIGN_SHIFT) &
			KGSL_MEMALIGN_MASK;
	}

	flags = kgsl_filter_cachemode(flags);
+6 −2
Original line number Diff line number Diff line
@@ -574,8 +574,12 @@ _kgsl_sharedmem_page_alloc(struct kgsl_memdesc *memdesc,

	page_size = get_page_size(size, align);

	/* update align flags for what we actually use */
	if (page_size != PAGE_SIZE)
	/*
	 * The alignment cannot be less than the intended page size - it can be
	 * larger however to accomodate hardware quirks
	 */

	if (ilog2(align) < page_size)
		kgsl_memdesc_set_align(memdesc, ilog2(page_size));

	/*