summaryrefslogtreecommitdiffstats
path: root/drivers/dma-buf
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2019-10-30 21:29:52 +0100
committerSean Paul <seanpaul@chromium.org>2019-10-30 21:41:33 +0100
commitd59c5e025081a4c1f4528010524a37ddc5a986be (patch)
tree88c992b23e41d03563889207410477a79c72bd35 /drivers/dma-buf
parentRevert "dma-buf: heaps: Add CMA heap to dmabuf heaps" (diff)
downloadlinux-d59c5e025081a4c1f4528010524a37ddc5a986be.tar.xz
linux-d59c5e025081a4c1f4528010524a37ddc5a986be.zip
Revert "dma-buf: heaps: Add system heap to dmabuf heaps"
This reverts commit 47a32f9c12266d450b92089148c6039591bd9909. This patchset doesn't meet the UAPI requirements set out in [1] for the DRM subsystem. Once the userspace component is reviewed and ready for merge we can try again. [1]- https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements Fixes: 47a32f9c1226 ("dma-buf: heaps: Add system heap to dmabuf heaps") Cc: Laura Abbott <labbott@redhat.com> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Liam Mark <lmark@codeaurora.org> Cc: Pratik Patel <pratikp@codeaurora.org> Cc: Brian Starkey <Brian.Starkey@arm.com> Cc: Vincent Donnefort <Vincent.Donnefort@arm.com> Cc: Sudipto Paul <Sudipto.Paul@arm.com> Cc: Andrew F. Davis <afd@ti.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Chenbo Feng <fengc@google.com> Cc: Alistair Strachan <astrachan@google.com> Cc: Hridya Valsaraju <hridya@google.com> Cc: Hillf Danton <hdanton@sina.com> Cc: dri-devel@lists.freedesktop.org Cc: Brian Starkey <brian.starkey@arm.com> Cc: John Stultz <john.stultz@linaro.org> Cc: "Andrew F. Davis" <afd@ti.com> Cc: linux-media@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org Acked-by: David Airlie <airlied@linux.ie> Signed-off-by: Sean Paul <sean@poorly.run> Link: https://patchwork.freedesktop.org/patch/msgid/20191030203003.101156-4-sean@poorly.run
Diffstat (limited to 'drivers/dma-buf')
-rw-r--r--drivers/dma-buf/Kconfig2
-rw-r--r--drivers/dma-buf/heaps/Kconfig6
-rw-r--r--drivers/dma-buf/heaps/Makefile1
-rw-r--r--drivers/dma-buf/heaps/system_heap.c124
4 files changed, 0 insertions, 133 deletions
diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
index 0613bb7770f5..bffa58fc3e6e 100644
--- a/drivers/dma-buf/Kconfig
+++ b/drivers/dma-buf/Kconfig
@@ -53,6 +53,4 @@ menuconfig DMABUF_HEAPS
allows userspace to allocate dma-bufs that can be shared
between drivers.
-source "drivers/dma-buf/heaps/Kconfig"
-
endmenu
diff --git a/drivers/dma-buf/heaps/Kconfig b/drivers/dma-buf/heaps/Kconfig
deleted file mode 100644
index 205052744169..000000000000
--- a/drivers/dma-buf/heaps/Kconfig
+++ /dev/null
@@ -1,6 +0,0 @@
-config DMABUF_HEAPS_SYSTEM
- bool "DMA-BUF System Heap"
- depends on DMABUF_HEAPS
- help
- Choose this option to enable the system dmabuf heap. The system heap
- is backed by pages from the buddy allocator. If in doubt, say Y.
diff --git a/drivers/dma-buf/heaps/Makefile b/drivers/dma-buf/heaps/Makefile
index d1808eca2581..de49898112db 100644
--- a/drivers/dma-buf/heaps/Makefile
+++ b/drivers/dma-buf/heaps/Makefile
@@ -1,3 +1,2 @@
# SPDX-License-Identifier: GPL-2.0
obj-y += heap-helpers.o
-obj-$(CONFIG_DMABUF_HEAPS_SYSTEM) += system_heap.o
diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
deleted file mode 100644
index 455782efbb32..000000000000
--- a/drivers/dma-buf/heaps/system_heap.c
+++ /dev/null
@@ -1,124 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * DMABUF System heap exporter
- *
- * Copyright (C) 2011 Google, Inc.
- * Copyright (C) 2019 Linaro Ltd.
- */
-
-#include <linux/dma-buf.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-heap.h>
-#include <linux/err.h>
-#include <linux/highmem.h>
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/scatterlist.h>
-#include <linux/slab.h>
-#include <linux/sched/signal.h>
-#include <asm/page.h>
-
-#include "heap-helpers.h"
-
-struct dma_heap *sys_heap;
-
-static void system_heap_free(struct heap_helper_buffer *buffer)
-{
- pgoff_t pg;
-
- for (pg = 0; pg < buffer->pagecount; pg++)
- __free_page(buffer->pages[pg]);
- kfree(buffer->pages);
- kfree(buffer);
-}
-
-static int system_heap_allocate(struct dma_heap *heap,
- unsigned long len,
- unsigned long fd_flags,
- unsigned long heap_flags)
-{
- struct heap_helper_buffer *helper_buffer;
- struct dma_buf *dmabuf;
- int ret = -ENOMEM;
- pgoff_t pg;
-
- helper_buffer = kzalloc(sizeof(*helper_buffer), GFP_KERNEL);
- if (!helper_buffer)
- return -ENOMEM;
-
- init_heap_helper_buffer(helper_buffer, system_heap_free);
- helper_buffer->flags = heap_flags;
- helper_buffer->heap = heap;
- helper_buffer->size = len;
-
- helper_buffer->pagecount = len / PAGE_SIZE;
- helper_buffer->pages = kmalloc_array(helper_buffer->pagecount,
- sizeof(*helper_buffer->pages),
- GFP_KERNEL);
- if (!helper_buffer->pages) {
- ret = -ENOMEM;
- goto err0;
- }
-
- for (pg = 0; pg < helper_buffer->pagecount; pg++) {
- /*
- * Avoid trying to allocate memory if the process
- * has been killed by by SIGKILL
- */
- if (fatal_signal_pending(current))
- goto err1;
-
- helper_buffer->pages[pg] = alloc_page(GFP_KERNEL | __GFP_ZERO);
- if (!helper_buffer->pages[pg])
- goto err1;
- }
-
- /* create the dmabuf */
- dmabuf = heap_helper_export_dmabuf(helper_buffer, fd_flags);
- if (IS_ERR(dmabuf)) {
- ret = PTR_ERR(dmabuf);
- goto err1;
- }
-
- helper_buffer->dmabuf = dmabuf;
-
- ret = dma_buf_fd(dmabuf, fd_flags);
- if (ret < 0) {
- dma_buf_put(dmabuf);
- /* just return, as put will call release and that will free */
- return ret;
- }
-
- return ret;
-
-err1:
- while (pg > 0)
- __free_page(helper_buffer->pages[--pg]);
- kfree(helper_buffer->pages);
-err0:
- kfree(helper_buffer);
-
- return -ENOMEM;
-}
-
-static const struct dma_heap_ops system_heap_ops = {
- .allocate = system_heap_allocate,
-};
-
-static int system_heap_create(void)
-{
- struct dma_heap_export_info exp_info;
- int ret = 0;
-
- exp_info.name = "system_heap";
- exp_info.ops = &system_heap_ops;
- exp_info.priv = NULL;
-
- sys_heap = dma_heap_add(&exp_info);
- if (IS_ERR(sys_heap))
- ret = PTR_ERR(sys_heap);
-
- return ret;
-}
-module_init(system_heap_create);
-MODULE_LICENSE("GPL v2");