android: ion: add ion_cached_dmabuf()
authorCho KyongHo <pullip.cho@samsung.com>
Mon, 12 Feb 2018 05:35:24 +0000 (14:35 +0900)
committerSangwook Ju <sw.ju@samsung.com>
Mon, 14 May 2018 10:45:23 +0000 (19:45 +0900)
Some kernel clients of ION need to know if an ION buffer is cached.

Change-Id: I8a179e2ba4476408732e2d32441268883c9dc2c6
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
drivers/staging/android/ion/ion_exynos.c
include/linux/ion_exynos.h

index 2f067d1ceed59402489c4ddf0bc8e75934b336a7..72350f8bce3ef2c42b5f39aa367f044558c35041 100644 (file)
@@ -34,6 +34,11 @@ struct dma_buf *ion_alloc_dmabuf(const char *heap_name,
        return __ion_alloc(len, 1 << heap->id, flags);
 }
 
+bool ion_cached_dmabuf(struct dma_buf *dmabuf)
+{
+       return ion_buffer_cached(dmabuf->priv);
+}
+
 struct ion_iovm_map {
        struct list_head list;
        struct device *dev;
index b43fb18147bb3ea2ec7de3eb0a22464311643738..8a40bc38549017874fd1f031746df8c2fcd1d3c1 100644 (file)
@@ -26,12 +26,17 @@ struct dma_buf_attachment;
 #ifdef CONFIG_ION_EXYNOS
 struct dma_buf *ion_alloc_dmabuf(const char *heap_name,
                                 size_t len, unsigned int flags);
+bool ion_cached_dmabuf(struct dma_buf *dmabuf);
 #else
 static inline struct dma_buf *ion_alloc_dmabuf(const char *heap_name,
                                               size_t len, unsigned int flags)
 {
        return ERR_PTR(-ENODEV);
 }
+static inline bool ion_cached_dmabuf(struct dma_buf *dmabuf)
+{
+       return false;
+}
 #endif
 
 #if defined(CONFIG_EXYNOS_IOVMM) && defined(CONFIG_ION_EXYNOS)