Revert "dma-buf: dma-heap: heap ops supports get_phys"

This partially reverts commit 61a32e157e.
Convert to use rk_cma_heap.c and keep fixes to dma-heap.c

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Change-Id: I740d0de75d8b526f7de987b0b1c18dc3f6298705
This commit is contained in:
Jianqun Xu
2022-09-26 14:46:08 +08:00
committed by Tao Huang
parent 449b29d7ab
commit 23cdadf8a5

View File

@@ -21,7 +21,6 @@
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <uapi/linux/dma-heap.h>
struct cma_heap {
@@ -441,42 +440,8 @@ static struct dma_buf *cma_heap_allocate(struct dma_heap *heap,
return cma_heap_do_allocate(heap, len, fd_flags, heap_flags, false);
}
static int cma_heap_get_phys(struct dma_heap *heap,
struct dma_heap_phys_data *phys)
{
struct cma_heap *cma_heap = dma_heap_get_drvdata(heap);
struct cma_heap_buffer *buffer;
struct dma_buf *dmabuf;
phys->paddr = (__u64)-1;
if (IS_ERR_OR_NULL(phys))
return -EINVAL;
dmabuf = dma_buf_get(phys->fd);
if (IS_ERR_OR_NULL(dmabuf))
return -EBADFD;
buffer = dmabuf->priv;
if (IS_ERR_OR_NULL(buffer))
goto err;
if (buffer->heap != cma_heap)
goto err;
phys->paddr = page_to_phys(buffer->cma_pages);
err:
dma_buf_put(dmabuf);
return (phys->paddr == (__u64)-1) ? -EINVAL : 0;
}
static const struct dma_heap_ops cma_heap_ops = {
.allocate = cma_heap_allocate,
#if IS_ENABLED(CONFIG_NO_GKI)
.get_phys = cma_heap_get_phys,
#endif
};
static struct dma_buf *cma_uncached_heap_allocate(struct dma_heap *heap,