From: Laura Abbott <labbott@redhat.com>
To: "Sumit Semwal" <sumit.semwal@linaro.org>,
"John Stultz" <john.stultz@linaro.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Riley Andrews" <riandrews@android.com>
Cc: Laura Abbott <labbott@redhat.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
linaro-mm-sig@lists.linaro.org, devel@driverdev.osuosl.org,
Russell King <linux@armlinux.org.uk>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Eun Taik Lee <eun.taik.lee@samsung.com>,
Rohit kumar <rohit.kr@samsung.com>,
Liviu Dudau <Liviu.Dudau@arm.com>, Jon Medhurst <tixy@linaro.org>,
Mitchel Humpherys <mitchelh@codeaurora.org>,
Jeremy Gebben <jgebben@codeaurora.org>,
Bryan Huntsman <bryanh@codeaurora.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Android Kernel Team <kernel-team@android.com>
Subject: [RFC][PATCH 2/3] staging: ion: Add support for syncing with DMA_BUF_IOCTL_SYNC
Date: Wed, 25 May 2016 12:48:03 -0700 [thread overview]
Message-ID: <1464205684-5587-3-git-send-email-labbott@redhat.com> (raw)
In-Reply-To: <1464205684-5587-1-git-send-email-labbott@redhat.com>
dma_buf added support for a userspace syncing ioctl. It is implemented
by calling dma_buf_begin_cpu_access and dma_buf_end_cpu_access. Ion
currently lacks cache operations on this code path. Add them for
compatibility with the dma_buf ioctl.
Signed-off-by: Laura Abbott <labbott@redhat.com>
---
drivers/staging/android/ion/ion.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 9282d96a..2096592 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1117,6 +1117,11 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
mutex_lock(&buffer->lock);
vaddr = ion_buffer_kmap_get(buffer);
mutex_unlock(&buffer->lock);
+
+ if (direction != DMA_TO_DEVICE) {
+ ion_invalidate_buffer(buffer);
+ }
+
return PTR_ERR_OR_ZERO(vaddr);
}
@@ -1129,6 +1134,12 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf,
ion_buffer_kmap_put(buffer);
mutex_unlock(&buffer->lock);
+ if (direction == DMA_FROM_DEVICE) {
+ ion_invalidate_buffer(buffer);
+ } else {
+ ion_clean_buffer(buffer);
+ }
+
return 0;
}
@@ -1259,6 +1270,8 @@ static int ion_sync_for_device(struct ion_client *client, int fd)
struct dma_buf *dmabuf;
struct ion_buffer *buffer;
+ WARN_ONCE(1, "This API is deprecated in favor of the dma_buf ioctl\n");
+
dmabuf = dma_buf_get(fd);
if (IS_ERR(dmabuf))
return PTR_ERR(dmabuf);
--
2.5.5
next prev parent reply other threads:[~2016-05-25 19:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-25 19:48 [RFC][PATCH 0/3] Clean up Ion mapping/caching Laura Abbott
2016-05-25 19:48 ` [RFC][PATCH 1/3] staging: ion: Move away from the DMA APIs for cache flushing Laura Abbott
2016-05-26 9:58 ` Liviu Dudau
2016-05-26 10:59 ` Russell King - ARM Linux
2016-05-26 12:06 ` Christoph Hellwig
2016-06-03 1:57 ` [Linaro-mm-sig] " Li, Xiaoquan
2016-05-25 19:48 ` Laura Abbott [this message]
2016-05-25 19:48 ` [RFC][PATCH 3/3] staging: ion: Add dma_map/dma_unmap calls to dma_buf calls Laura Abbott
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1464205684-5587-3-git-send-email-labbott@redhat.com \
--to=labbott@redhat.com \
--cc=Liviu.Dudau@arm.com \
--cc=arve@android.com \
--cc=bryanh@codeaurora.org \
--cc=catalin.marinas@arm.com \
--cc=daniel.vetter@ffwll.ch \
--cc=devel@driverdev.osuosl.org \
--cc=eun.taik.lee@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=jgebben@codeaurora.org \
--cc=john.stultz@linaro.org \
--cc=kernel-team@android.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mitchelh@codeaurora.org \
--cc=riandrews@android.com \
--cc=rohit.kr@samsung.com \
--cc=sumit.semwal@linaro.org \
--cc=tixy@linaro.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox