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: 178585 Delivered-To: patches@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp78507ilf; Tue, 5 Nov 2019 20:23:01 -0800 (PST) X-Received: by 2002:a17:90a:3651:: with SMTP id s75mr1030322pjb.30.1573014181492; Tue, 05 Nov 2019 20:23:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573014181; cv=none; d=google.com; s=arc-20160816; b=ZzA/ZoJKq2Axrhz5KKO87tgbjleRwv0L6Gc6bXK8TRqeHEHRb1lssQXA8udbp3rMMi kvopEpCii66PnyH3Em+D0EUC67Mk9JPaaC77rBGwloo1dOaSIwnT2dwgxMSrkW5Ulruq waOTPbm1Tq1EXY/65f7uvhs+jeymayC/kNK+Pv6dmCJbevyfEZhzoChhlPMR9j2W6x/4 pnGwoevck+7cr9x7SCb4xC0bSsy0qY9/c5jzaFprQQk5FOOL/B0wil4TxKs/yHfrqi7Q QMmWXpf73/3wFLcEhg01wAu0aDYImDobBQINo8+joU2o7t4moxRyUWye7GkoPPhoh9ba PWjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=d1as87Sr0+uZOQFdm8joum2TejhuthHY4TqHQCXSeyE=; b=VXzZgUGE7JWfLfwcSF+rhK4UUSxLqsrkt6AQWQz/d1npOeORQItGPGzgepYsVbs+Uj 3b35cF4TBV99kCi9B9+o5ILN5bG5K7GKjp11uDfCz0VU+xAVh2Q4xy3TwDw8KjMr+cnW gX5EtPo8ECkZPmlFl9wS/3o4dflTYxamiGJ5uFbUWKSbT55NA5dWyyPHPy+Viy2k35Aj O281Ul0wW2sEY4njsb8cgwup7KLiLV5wAFMRpNzBwwVsTz4X2HKyGfOlOoQ9sY1afWFa 1Sz9lq/iYJdm7D++8yKXe0KoMJ00CK8xpTLmN/XvJM+KmxwlFMGEr23gImu/c99OyO1Y egkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ty7bVJ0u; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id k6sor27030908pfh.4.2019.11.05.20.23.01 for (Google Transport Security); Tue, 05 Nov 2019 20:23:01 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ty7bVJ0u; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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-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=L92xYNx6KbtYbXY1KspO4VzZfuch+xTPThNbyaSxZXK84JrSuEhPRQ0H594tl+9lom 0S5TvSRj/jlnHaRlBGlIDb7w6vRoYnd/wVvBWidGw4PxN+oSTFs8eMCCa/1wI3OYZMGo +QbNiplleu7U9TFxnNEu2RlTfJWJoGvClLsQrZNjzWshMEsNYGwsLHIuiVo3JV7kCBR4 W6TbypINqLYBPX7lXwUHORDiD1ie69FwsQFWYHmG00qZS5f6sbncrX14ryMB6zpshuwn bo1arNHA2+iakKf6nJT8x9qK6TavLyH0je5pkATAqZtUFpZLYc/5NnMZUDD7E0J/F0jN xwhw== X-Gm-Message-State: APjAAAU4irIeY66g6JbHO7EabMKdu4lFXusF/XvjxmaigOLDxWXyb4yD i9cUcR2MVWF8mfzt55BYvGFcvkoH 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) Return-Path: 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 Cc: John Stultz , Laura Abbott , Benjamin Gaignard , Sumit Semwal , Liam Mark , Pratik Patel , Brian Starkey , Vincent Donnefort , Sudipto Paul , "Andrew F . Davis" , Christoph Hellwig , Chenbo Feng , Alistair Strachan , Hridya Valsaraju , Sandeep Patil , Hillf Danton , Dave Airlie , dri-devel@lists.freedesktop.org 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 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 -- 2.17.1