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

Commit d58f5a0e authored by Susheel Khiani's avatar Susheel Khiani Committed by Patrick Daly
Browse files

msm: ion: Export msm_ion_do_cache_offset_op to do cache operations



The current API exposed to clients for doing
cache operations didn't provide option to
specify offset within ion buffer and goes
and performs operation on complete buffer.
Export new function for clients which wants to
perform cache operation on specific range
within ion buffer.

We would also need to amend the current generic
ion_do_cache_op function to correctly take into
account the offset within buffer.

Change-Id: I5e4e7beda47cbbd43783048c64fe5adb2beb7023
Signed-off-by: default avatarSusheel Khiani <skhiani@codeaurora.org>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent 78d7fb5e
Loading
Loading
Loading
Loading
+22 −3
Original line number Diff line number Diff line
@@ -301,13 +301,23 @@ static int ion_pages_cache_ops(
	};

	for_each_sg(table->sgl, sg, table->nents, i) {
		unsigned int sg_offset, sg_left, size = 0;

		len += sg->length;
		if (len < offset)
		if (len <= offset)
			continue;

		__do_cache_ops(sg_page(sg), sg->offset, sg->length, op);
		sg_left = len - offset;
		sg_offset = sg->length - sg_left;

		size = (length < sg_left) ? length : sg_left;

		__do_cache_ops(sg_page(sg), sg_offset, size, op);

		offset += size;
		length -= size;

		if (len > length + offset)
		if (length == 0)
			break;
	}
	return 0;
@@ -356,6 +366,15 @@ int msm_ion_do_cache_op(struct ion_client *client, struct ion_handle *handle,
}
EXPORT_SYMBOL(msm_ion_do_cache_op);

int msm_ion_do_cache_offset_op(
		struct ion_client *client, struct ion_handle *handle,
		void *vaddr, unsigned int offset, unsigned long len,
		unsigned int cmd)
{
	return ion_do_cache_op(client, handle, vaddr, offset, len, cmd);
}
EXPORT_SYMBOL(msm_ion_do_cache_offset_op);

static void msm_ion_allocate(struct ion_platform_heap *heap)
{
	if (!heap->base && heap->extra_data) {
+13 −0
Original line number Diff line number Diff line
@@ -167,6 +167,11 @@ int ion_handle_get_size(struct ion_client *client, struct ion_handle *handle,
int msm_ion_do_cache_op(struct ion_client *client, struct ion_handle *handle,
			void *vaddr, unsigned long len, unsigned int cmd);

int msm_ion_do_cache_offset_op(
		struct ion_client *client, struct ion_handle *handle,
		void *vaddr, unsigned int offset, unsigned long len,
		unsigned int cmd);

#else
static inline struct ion_client *msm_ion_client_create(const char *name)
{
@@ -187,6 +192,14 @@ static inline int msm_ion_do_cache_op(
	return -ENODEV;
}

int msm_ion_do_cache_offset_op(
		struct ion_client *client, struct ion_handle *handle,
		void *vaddr, unsigned int offset, unsigned long len,
		unsigned int cmd)
{
	return -ENODEV;
}

#endif /* CONFIG_ION */

#endif