Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp68291ybg; Fri, 25 Oct 2019 16:49:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqweCIebadERJa6zSjBxz0izQSpD/Jp0b8wFUhIg8RSJ+dhQEqSzt6KVRetOQsM8KqS96VR4 X-Received: by 2002:a17:906:1dd3:: with SMTP id v19mr6095788ejh.35.1572047382304; Fri, 25 Oct 2019 16:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572047382; cv=none; d=google.com; s=arc-20160816; b=VtWCkehVWSVuwJbQv/LdhiMR8NG0fIWR1fZ/HjNu2B8603VCaeoVmjgAUNY5sRbapm ru+EmVg6rhYkDx5eI8Elpu/+2O4MY0eQxd+xz1VcMxesFWTNDh32gqey+YEaRLz+60Sv 0QnQF5diClHTFFdVdsjuAq/S63qEYQPSMKTC8Cb4L2P7MimS8TI3ggAmnycWPJbzzgud gCENAHAqFWnsi1ZX5TxSOqZWQvLQhKElR2HdwoxOFDkis6K0wMnK9vEFsuCjNCRxH/oX QUAWXldK0Posk4VtNfHbyBFfyAG71zy0WzN326htUZmkNn/f6zjfAgBZuH8c8aXV21Nv tpTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=akimG7mgtSazW0Xv9weq5WdYsXvPJgD82qEofxZDZEo=; b=06TpN8UBsQzheTjsvFRVOsl1seEZa0x+F5VvOAOncXEJyCMnq4lLe06YKW3k6tzOGw +eSrC+pJ89ECJOseedeRpZtAJfI0Y0tZczPjyxmPCc5GoqrkeVcktCbLjvhCfejT216C brkbkmtmQKCOfS6MD9Vb7weZNcv5Vb4StwxgiHGVVQVplkrQ8OxWNKlLIFNF1iAYtCGv lYDdZVFiyV5az8qy/MPyJEJO4ELR7R3A/GtOz5aeLmfE9nNMKK2V+iEh8i9nYZVcpJ5e onZsiMwcj4dl+VfWtaTK2GI/CeBTucaaKXsOCk1qmU2+Oy59AqzQrKHNL/zC1KBTSq/w su7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kYbg0nUp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23si2187982ejf.390.2019.10.25.16.49.15; Fri, 25 Oct 2019 16:49:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kYbg0nUp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726082AbfJYXsm (ORCPT + 99 others); Fri, 25 Oct 2019 19:48:42 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:43150 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725874AbfJYXsm (ORCPT ); Fri, 25 Oct 2019 19:48:42 -0400 Received: by mail-pg1-f194.google.com with SMTP id l24so2571801pgh.10 for ; Fri, 25 Oct 2019 16:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=akimG7mgtSazW0Xv9weq5WdYsXvPJgD82qEofxZDZEo=; b=kYbg0nUp/PxzkjVrb1KGOJVPc1ih+UCUGjDKAgLLtvpaZ9Pp+/Q3cv4t0dB71G44aS 1wF3g90STc7JgIzQVNFd2OT47TMuSNGhWq6p3nERUIVHd5+QBDoi779pCYC6SDgp24GO WPFPM2iiqEYEZem9oWs2cJTf8hNVxEWG4h3ruJZzab15rfukexYiWFkNqjiorjlihRVj VcKekKIMo2nCLNOYMa8cqJA9lIn7e/RWWLtB65doGIXpH4JFEeeqg+ua2yA7dmZatZzj xh4go74AhdfigrguMdEtk2DgBS+XrR+zbHEJPdNUFIuJft1as404b2m+OKIUe0iRozLD UMew== 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; bh=akimG7mgtSazW0Xv9weq5WdYsXvPJgD82qEofxZDZEo=; b=sTBWRjN+2EljJQ0bqC/N5nYWtQLmx1Y0hYeY39Vrjml/LfxDsVD9BPsm1X5/tgRGed Z3T5He8j9e/+iyTIe3Hpf/fwm9BXAZR4xRqA3Hpu62FtrVNCemfyxficFIrd1NPmPFPQ DewO5YFRpnAWdTWmTplvIGJWUk3isdxxFRhTLmuOcWZMq82oRDMAOzAM0Rac6KiDu9lS zQ9G611CdhQheLqf+4ym2FHu1dFRjqZt6/iB9ZFSwgCjtRb8SI4BnXXRoT9mzxO++IAM 1YZS+F72Urh/3xcLIdb8hV4P28Ub0Td7OzdX4Sy/X+hHFleQ4x0GqKwK8GBRRUKgxw4R BJeA== X-Gm-Message-State: APjAAAWNCyJac1bH6YZlm8ukxc1hRX2omk0qzOzRxtuImVSfxUJRYkEC dmc7hLxAdNpBNqwSjNDSJ00wWD8o+Hs= X-Received: by 2002:a17:90a:d58f:: with SMTP id v15mr7476798pju.17.1572047320896; Fri, 25 Oct 2019 16:48:40 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id cx22sm2817179pjb.19.2019.10.25.16.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 16:48:40 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Laura Abbott , Benjamin Gaignard , Sumit Semwal , Liam Mark , Pratik Patel , Brian Starkey , "Andrew F . Davis" , Andrew Morton , Yue Hu , Mike Rapoport , Chenbo Feng , Alistair Strachan , Sandeep Patil , Hridya Valsaraju , dri-devel@lists.freedesktop.org Subject: [RFC][PATCH 2/2] dma-buf: heaps: Allow system & cma heaps to be configured as a modules Date: Fri, 25 Oct 2019 23:48:34 +0000 Message-Id: <20191025234834.28214-3-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191025234834.28214-1-john.stultz@linaro.org> References: <20191025234834.28214-1-john.stultz@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow loading system and cma heap as a module instead of just as a statically built in heap. Since there isn't a good mechanism for dmabuf lifetime tracking it isn't safe to allow the heap drivers to be unloaded, so these drivers do not implement any module unloading functionality and will show up in lsmod as "[permanent]". This patch also exports key functions from dmabuf heaps core and the heap helper functions so they can be accessed by the module. Cc: Laura Abbott Cc: Benjamin Gaignard Cc: Sumit Semwal Cc: Liam Mark Cc: Pratik Patel Cc: Brian Starkey Cc: Andrew F. Davis Cc: Andrew Morton Cc: Yue Hu Cc: Mike Rapoport Cc: Chenbo Feng Cc: Alistair Strachan Cc: Sandeep Patil Cc: Hridya Valsaraju Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz --- drivers/dma-buf/dma-heap.c | 2 ++ drivers/dma-buf/heaps/Kconfig | 4 ++-- drivers/dma-buf/heaps/heap-helpers.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c index 9a41b73e54b4..2c4ac71a715b 100644 --- a/drivers/dma-buf/dma-heap.c +++ b/drivers/dma-buf/dma-heap.c @@ -161,6 +161,7 @@ void *dma_heap_get_drvdata(struct dma_heap *heap) { return heap->priv; } +EXPORT_SYMBOL_GPL(dma_heap_get_drvdata); struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info) { @@ -243,6 +244,7 @@ struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info) kfree(heap); return err_ret; } +EXPORT_SYMBOL_GPL(dma_heap_add); static char *dma_heap_devnode(struct device *dev, umode_t *mode) { diff --git a/drivers/dma-buf/heaps/Kconfig b/drivers/dma-buf/heaps/Kconfig index a5eef06c4226..e273fb18feca 100644 --- a/drivers/dma-buf/heaps/Kconfig +++ b/drivers/dma-buf/heaps/Kconfig @@ -1,12 +1,12 @@ config DMABUF_HEAPS_SYSTEM - bool "DMA-BUF System Heap" + tristate "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. config DMABUF_HEAPS_CMA - bool "DMA-BUF CMA Heap" + tristate "DMA-BUF CMA Heap" depends on DMABUF_HEAPS && DMA_CMA help Choose this option to enable dma-buf CMA heap. This heap is backed diff --git a/drivers/dma-buf/heaps/heap-helpers.c b/drivers/dma-buf/heaps/heap-helpers.c index 750bef4e902d..fb9835126893 100644 --- a/drivers/dma-buf/heaps/heap-helpers.c +++ b/drivers/dma-buf/heaps/heap-helpers.c @@ -24,6 +24,7 @@ void init_heap_helper_buffer(struct heap_helper_buffer *buffer, INIT_LIST_HEAD(&buffer->attachments); buffer->free = free; } +EXPORT_SYMBOL_GPL(init_heap_helper_buffer); struct dma_buf *heap_helper_export_dmabuf(struct heap_helper_buffer *buffer, int fd_flags) @@ -37,6 +38,7 @@ struct dma_buf *heap_helper_export_dmabuf(struct heap_helper_buffer *buffer, return dma_buf_export(&exp_info); } +EXPORT_SYMBOL_GPL(heap_helper_export_dmabuf); static void *dma_heap_map_kernel(struct heap_helper_buffer *buffer) { -- 2.17.1