From patchwork Wed Oct 30 20:29:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11220039 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12F301390 for ; Wed, 30 Oct 2019 20:30:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EECF7205C9 for ; Wed, 30 Oct 2019 20:30:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EECF7205C9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0CC506EB68; Wed, 30 Oct 2019 20:30:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb42.google.com (mail-yb1-xb42.google.com [IPv6:2607:f8b0:4864:20::b42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1F8746EB65 for ; Wed, 30 Oct 2019 20:30:39 +0000 (UTC) Received: by mail-yb1-xb42.google.com with SMTP id b2so1452201ybr.8 for ; Wed, 30 Oct 2019 13:30:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PkjdSrZ3E9zkQ9Ztn0Eu35FRE4gi9xnr1qako38BwjY=; b=XBBd0Da8yMGHDjeyMDJqqOuORDc73kDZVhwKhJ6+OlMux0NIcEo2FFnr4gJs3yReHK Mg1HmSHgVbYfnPBaTPn5mj3gXYAR0RCsBkWcd6HX4w36plsTnL8hr8lYzHp+Z3kZokTT 0h84ob1U7T1zL04pEISYYCPkTcCEV2f8cZ63Ti60ELcONPkiJpH3NAFNZ746JoD04Gnc QS2idD+qexDJmEkuerzD0usCiIYCMoqlAKASGZiZ83JZLgArHfESnf60IT29LxhTFMex Z04GDPNyiSWRR2luZtmvkyw7vFbnNFCVFwNajFEXuJ1jZc1VperKthptF4TzVz5M1Qnr k3SQ== X-Gm-Message-State: APjAAAW9iEhRhhB+df3mQ1TqyLHG1DQDS1oBF13Lor9kMCnbd1khu3vZ c4Tn8dARjXas7Di7K43P0oaa0OoObEU= X-Google-Smtp-Source: APXvYqwxPm0bXgofifeJ0R7QvHZxz1P4sKd8T9IX39XjcztKk7AvxE3dV6X4teUseQWhwbXc6Z9NGw== X-Received: by 2002:a25:868c:: with SMTP id z12mr960656ybk.441.1572467437614; Wed, 30 Oct 2019 13:30:37 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id h35sm416432ywk.63.2019.10.30.13.30.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 13:30:37 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/5] Revert "dma-buf: heaps: Add system heap to dmabuf heaps" Date: Wed, 30 Oct 2019 16:29:52 -0400 Message-Id: <20191030203003.101156-4-sean@poorly.run> X-Mailer: git-send-email 2.24.0.rc0.303.g954a862665-goog In-Reply-To: <20191030203003.101156-1-sean@poorly.run> References: <20191030203003.101156-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PkjdSrZ3E9zkQ9Ztn0Eu35FRE4gi9xnr1qako38BwjY=; b=bXWhFOKqFT4ecf1J8QwN8+Y/njrkZZAOULWzlmxqAyVEHq64jDkc3QDGlsqaqOTJxA RU6bJ3xXxaOnBsZhKwKaPxlRqNJTjXabdzjvYZZ9QVlOQIcKXPBeFNLcaMsBRWQjLuTS 6pcTPLkuxNOgDV/5Sqxo7LHJ4Z1i0Z9P+EjQV1auh6+Pv3PQQqr2/HyA2eA7oKddotjj bn/XKr8hUdve6/9EQJ+I0PXOG4Y0xKkaVOsU6IZs0CBjBrmRf5+zjvNAFSdFXRKTmFNt w44k1rACUIKYxsoccnnr6GjrNe2tKV0R07MwGRgw52AFaVL8e8ezL4ZS8Z5A82i+eGQk EmLQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linaro-mm-sig@lists.linaro.org, Hillf Danton , Sudipto Paul , Vincent Donnefort , Sean Paul , Chenbo Feng , Alistair Strachan , Liam Mark , Christoph Hellwig , Sean Paul , "Andrew F . Davis" , Hridya Valsaraju , Pratik Patel , linux-media@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sean Paul 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 Cc: Benjamin Gaignard Cc: Sumit Semwal Cc: Liam Mark Cc: Pratik Patel Cc: Brian Starkey Cc: Vincent Donnefort Cc: Sudipto Paul Cc: Andrew F. Davis Cc: Christoph Hellwig Cc: Chenbo Feng Cc: Alistair Strachan Cc: Hridya Valsaraju Cc: Hillf Danton Cc: dri-devel@lists.freedesktop.org Cc: Brian Starkey Cc: John Stultz Cc: "Andrew F. Davis" Cc: linux-media@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org Signed-off-by: Sean Paul --- drivers/dma-buf/Kconfig | 2 - drivers/dma-buf/heaps/Kconfig | 6 -- drivers/dma-buf/heaps/Makefile | 1 - drivers/dma-buf/heaps/system_heap.c | 124 ---------------------------- 4 files changed, 133 deletions(-) delete mode 100644 drivers/dma-buf/heaps/Kconfig delete mode 100644 drivers/dma-buf/heaps/system_heap.c 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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");