From patchwork Tue Dec 3 17:26:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 180728 Delivered-To: patches@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1797824ile; Tue, 3 Dec 2019 09:26:45 -0800 (PST) X-Received: by 2002:aa7:8b17:: with SMTP id f23mr1442421pfd.197.1575394005243; Tue, 03 Dec 2019 09:26:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575394005; cv=none; d=google.com; s=arc-20160816; b=gOQuVmAvCGzX5BloYX4+g3Js4FEi0DelP8uL3PiSVyu9lUUiRLvnAoicGKzFGMmHYT CFi+Y6heKPm8da4PYQ6B/Tge3Anfca3ZAChZDr966hSY5w/KLMxthgNBFu569I/2ylMb 7jOA4p1emeAXHkyK2ffoNJM6qZ1WRyssYvmqIXcRQQqQGSF8VlA92GWS9ATw1HxNRIYp rNHaH9ms4dkDKCeycbzIzVMsAgHIEENdZieg2FKw6SZHGVYTiN40yovCU2qU3D7kwE7w 3B/ygkmfp22E6jj6opJGWLWC6nFZAMuvecMfVdQ3FbAOIbmD5pzDQLy6hmbBNL8gjtFI GmWQ== 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=ocQPUWmBDA1ShS30D9CjTE8lnIkFhXXMmEypYP4B6rw=; b=PGNXK0D8W3O5YOaxVjauf8p1VHyCumtThjnO1dXfbskBhOyZhH5EiJhg6IjVkFZvHJ Q1GAjKSg3EoiTbHnTwnhXq3JB4Cic/GGeU7KJRs/kddjX4d6xsw+4ZWbbtudf2omUh8P NomH0S5c9XGCW93WjwnOsGqzmpftt0YnzsIrdhFCyJQ7YBpp4K1azE/mnBndPFLOvQSD fHOr2TV9b/fv4vD7l3lIW7P3S5j260s9hT2wdYlkKurzjSYluf866YJcw6j3ttOdxuEo QU1nyv6xB4uXf+VPFHPSLsemoKDxccf6OpePb3yhWrmCUXTt5yMAS+y2zntYMWWu/Q31 141w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kccTZ+9U; 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 x9sor4312288plv.66.2019.12.03.09.26.45 for (Google Transport Security); Tue, 03 Dec 2019 09:26:45 -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=kccTZ+9U; 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=ocQPUWmBDA1ShS30D9CjTE8lnIkFhXXMmEypYP4B6rw=; b=kccTZ+9Uc4KNGSKUxGhO+iaAN6wsFLsJrzJpvClvxh6T1hom4ViXkofIEeffvYb0eY 3uweP6vw8BTxO6bKV2yhHNeWLZbE719Lki0BZaKRvzrwJKyQQSpHMKplJSvnp4Heqalr +pP8ghsniOFqwIPO1ft4c7khgElThpULVOkZkMHmexB8xYCso+U7/nMSt6BlWtrW+5Qf kSVaSOFB8fj+PEsYKVXc4ihEDtpMMGtih6gDjH5TLA/Wtv618d5dw9Qky98TLt6IBdgY d2bLK3UJ4ka6Z3Wep2oSiro1LqsruRGcqMEE9DOsrSAJg8bhsNSN39wub3g3I+ohFuAH XZrQ== 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=ocQPUWmBDA1ShS30D9CjTE8lnIkFhXXMmEypYP4B6rw=; b=js6R981ei9NL9Mt0O1q6NrrAm/ILVBWF4WPNrXithBgW0aJFLO+BXKDwmd7sBA2u0d TgS572v0rTQ1Tz3wpCKboI2PewdFTjlWywicYXsrTpEFWDhBS3NzPXEAb3C/9fDNKEEf iMsjdfYcbvY7uJRbG841g5nzFFSfHdED5zNiRgchAh/1jHggg28E5BXSdxiNgQJO+Vyt +6B6Otn4YTUlmAYw39T+efg0OvA23somgzoGim2QZNbYzb59SF5oIqrMHKTgJHmXEHhj IYfjHrsuBDqqclgZM/FMAiGDZm7Qv/Atbbsjzw2a+D/zUwrGvz5E4g3DTn/X49hvOaH0 mrrg== X-Gm-Message-State: APjAAAVGScIkfsGFLiO74/JHZZfnh+Q8hj9mEsr2iJ1wLx7LdmV1827M rA9fUaE+S2QEbMgwgC5MJNqlaNAa X-Google-Smtp-Source: APXvYqwy55wKG7PVnuQtP6CuY6wXN1tqggyfL0l53RKgpOyBd7xYIc/NDwo+Im4OU+AAfTYlCvPpuA== X-Received: by 2002:a17:902:59d8:: with SMTP id d24mr5711015plj.318.1575394004633; Tue, 03 Dec 2019 09:26:44 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id l9sm4066177pgh.34.2019.12.03.09.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:26:43 -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: [RESEND][PATCH v16 0/5] DMA-BUF Heaps (destaging ION) Date: Tue, 3 Dec 2019 17:26:36 +0000 Message-Id: <20191203172641.66642-1-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 Just wanted to resend v16. 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 reviewed (+2'ed) 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 v16: * Typo fix suggested by Hridya Valsaraju * Add extra error and ioctl compatibility testing suggested by Daniel Vetter to the 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 | 396 ++++++++++++++++++ 14 files changed, 1484 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