From patchwork Wed Nov 6 04:22:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11229261 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 6BA4715AB for ; Wed, 6 Nov 2019 04:23:03 +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 496362084C for ; Wed, 6 Nov 2019 04:23:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 496362084C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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 A12626EBE5; Wed, 6 Nov 2019 04:23:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 73C7F6EBE5 for ; Wed, 6 Nov 2019 04:23:01 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id z24so11680103pgu.4 for ; Tue, 05 Nov 2019 20:23:01 -0800 (PST) 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; bh=d1as87Sr0+uZOQFdm8joum2TejhuthHY4TqHQCXSeyE=; b=t8udWWhgXi8W0cwQbmVa8zz5lg4ZavL93dmOlZ3hpvGsdch2IbPEBMmguRkOFfZ0xW CEAGJSjUsIiavhMy3dTMc02R3WkWgBAklMkpI6qjJ9M5eFbzgm9Y/wuvtYlAvIlkJdNh 0A/8N2NRHm+023Xe6XNzWZuAbiwk6YQzz1FGL8k9yAvSxLMX5UQ63v4qBmuwdIUTPq43 dHU0vjd2UR+ESluhtl1OmQoWlUu4gBhfndhv2tV9vUkdXD89iHWMZ8Avr8/mEGXzWRBC 2RjdfbZ7XUcC0jDjCdpl8NvB89reZOga94otFjY0Rh8Lk+falYujV3ti+YZsvg4+Gctt 5HJQ== X-Gm-Message-State: APjAAAXAcUKoPB4weWqHYiq10ZZYmRRhhRCsvTLhh4pvuckbJfI6LCxA jYkOTmWBdsSueVLDMtOf6/9SBQ== X-Google-Smtp-Source: APXvYqxJ/eLZ1O/wEyv7aU5R5VcDbE/at06GP86l+CYFMwaGx7gOj+syCPEx8H9xQKXR9ODv74A56A== X-Received: by 2002:a65:664e:: with SMTP id z14mr477142pgv.201.1573014180775; Tue, 05 Nov 2019 20:23:00 -0800 (PST) Received: from localhost.localdomain (c-67-170-172-113.hsd1.or.comcast.net. [67.170.172.113]) by smtp.gmail.com with ESMTPSA id n15sm23730289pfq.146.2019.11.05.20.22.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 20:23:00 -0800 (PST) From: John Stultz To: lkml Subject: [PATCH v15 0/5] DMA-BUF Heaps (destaging ION) Date: Wed, 6 Nov 2019 04:22:47 +0000 Message-Id: <20191106042252.72452-1-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=d1as87Sr0+uZOQFdm8joum2TejhuthHY4TqHQCXSeyE=; b=ty7bVJ0uKNUqnK+FvWEpAZZDVfk/ahCaVANdTvRblHQZ/xokbZaDnPyuK1QrD2N6lG w7YdpCcu0gS4v0qpcvs/3T6yD9/6xDHSLvib2RqQdK/3XkKYYEsF2fSLJx0DaoZFiROl +N+tzsrViXqYhXFeqD6mK3mIQegYaqX5KyUnYenfMaYdr5VHpFqZk1Nv518zGhhqIBJ+ 5yAfzkugnQjSSEB/aR3L+WMozre/06/cVjZ7uh30foPLdV1VJ+0Gd3XYEr0a+FTPkvT6 YYIlRd7C0iaDovh1K6RI0mZb4VoCMU+dXSFQ99pPYztDOPH9Q92ADBYf4pyDrT72bery 4h8w== 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: Hillf Danton , Sudipto Paul , Sandeep Patil , Vincent Donnefort , Chenbo Feng , Alistair Strachan , Liam Mark , Christoph Hellwig , dri-devel@lists.freedesktop.org, "Andrew F . Davis" , Hridya Valsaraju , Pratik Patel MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Once again, here we are with v15: This patchset implements per-heap devices which can be opened directly and then an ioctl is used to allocate a dmabuf from the heap. The interface is similar, but much simpler then IONs, only providing an ALLOC ioctl. Also, I've provided relatively simple system and cma heaps. I've booted and tested these patches with AOSP on the HiKey960 using the kernel tree here: https://git.linaro.org/people/john.stultz/android-dev.git/log/?h=dev/dma-buf-heap And the userspace changes here: https://android-review.googlesource.com/c/device/linaro/hikey/+/909436 Compared to ION, this patchset is missing the system-contig, carveout and chunk heaps, as I don't have a device that uses those, so I'm unable to do much useful validation there. Additionally we have no upstream users of chunk or carveout, and the system-contig has been deprecated in the common/andoid-* kernels, so this should be ok. I've also removed the stats accounting, since any such accounting should be implemented by dma-buf core or the heaps themselves. New in v15: * Dropped the get_features ioctl as suggested by Brian Starkey and Daniel Vetter * Add listhead comment suggested by Sandeep Patil * Dropped minor value in struct dma_heap as suggested by Sandeep Patil * Drop unused flags field from heap_helper_buffer as suggested by Sandeep Patil * Fix grammar typo from Brian Starkey * Remove usage of dropped get_features ioctl in kselftest test Thanks again for all the reviews and feedback! -john 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: Sandeep Patil Cc: Hillf Danton Cc: Dave Airlie Cc: dri-devel@lists.freedesktop.org Andrew F. Davis (1): dma-buf: Add dma-buf heaps framework John Stultz (4): dma-buf: heaps: Add heap helpers dma-buf: heaps: Add system heap to dmabuf heaps dma-buf: heaps: Add CMA heap to dmabuf heaps kselftests: Add dma-heap test MAINTAINERS | 18 ++ drivers/dma-buf/Kconfig | 11 + drivers/dma-buf/Makefile | 2 + drivers/dma-buf/dma-heap.c | 297 ++++++++++++++++++ drivers/dma-buf/heaps/Kconfig | 14 + drivers/dma-buf/heaps/Makefile | 4 + drivers/dma-buf/heaps/cma_heap.c | 177 +++++++++++ drivers/dma-buf/heaps/heap-helpers.c | 271 ++++++++++++++++ drivers/dma-buf/heaps/heap-helpers.h | 53 ++++ drivers/dma-buf/heaps/system_heap.c | 123 ++++++++ include/linux/dma-heap.h | 59 ++++ include/uapi/linux/dma-heap.h | 53 ++++ tools/testing/selftests/dmabuf-heaps/Makefile | 6 + .../selftests/dmabuf-heaps/dmabuf-heap.c | 238 ++++++++++++++ 14 files changed, 1326 insertions(+) create mode 100644 drivers/dma-buf/dma-heap.c create mode 100644 drivers/dma-buf/heaps/Kconfig create mode 100644 drivers/dma-buf/heaps/Makefile create mode 100644 drivers/dma-buf/heaps/cma_heap.c create mode 100644 drivers/dma-buf/heaps/heap-helpers.c create mode 100644 drivers/dma-buf/heaps/heap-helpers.h create mode 100644 drivers/dma-buf/heaps/system_heap.c create mode 100644 include/linux/dma-heap.h create mode 100644 include/uapi/linux/dma-heap.h create mode 100644 tools/testing/selftests/dmabuf-heaps/Makefile create mode 100644 tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c