Skip to content

Integrate meta-seco-imx/linux-seco-imx/cma-uncached

Commit: https://git.seco.com/edgehog/layers/seco/meta-seco-imx/-/commit/c659a43cbd81f9f233c061e17f41c5bf5b02a008

Integrate linux-seco-imx/cma-uncached

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/08f75add27d4755c2060e21608aa14f58f77e167

[DRIVER] dma-buf: cma_heap: fix uncached heap name

Adapted from linux-imx lf-5.15.y version.

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/5b450fdfa4fbf092a2c58de78949fa2162454689

dma-buf: heaps: cma: add uncached

Change-Id: I80d8af626693b16eef4b576143c3093fa9ba19d3 Signed-off-by: Simon Xue xxm@rock-chips.com

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/d6248aef27dec55c8195bdc1a01ab9dec7e7f05e

[DRIVER] dma-heap: Let dma heap use dma_map_attrs to map & unmap iova

Import only cma_heap section.

REFERENCE: https://git.seco.com/edgehog/bsp/rockchip/linux-seco-rk/-/commit/956db89e711f9ab3d608f3b2bafc6cefef9cc347

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/c76d35e3226b33955991665f3606b6b1aebae641

UPSTREAM: dma-buf: cma_heap: Include linux/vmalloc.h to fix build failures on MIPS

We need to include <linux/vmalloc.h> in order for MIPS to find vmap(), as it doesn't otherwise get included there.

Without this patch, one can hit the following build error: drivers/dma-buf/heaps/cma_heap.c: In function 'cma_heap_do_vmap': drivers/dma-buf/heaps/cma_heap.c:195:10: error: implicit declaration of function 'vmap'

Cc: Sumit Semwal sumit.semwal@linaro.org Cc: Liam Mark lmark@codeaurora.org Cc: Laura Abbott labbott@kernel.org Cc: Brian Starkey Brian.Starkey@arm.com Cc: Hridya Valsaraju hridya@google.com Cc: Suren Baghdasaryan surenb@google.com Cc: Sandeep Patil sspatil@google.com Cc: Daniel Mentz danielmentz@google.com Cc: Chris Goldsworthy cgoldswo@codeaurora.org Cc: Ørjan Eide orjan.eide@arm.com Cc: Robin Murphy robin.murphy@arm.com Cc: Ezequiel Garcia ezequiel@collabora.com Cc: Simon Ser contact@emersion.fr Cc: James Jones jajones@nvidia.com Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Fixes: a5d2d29e24be ("dma-buf: heaps: Move heap-helper logic into the cma_heap implementation") Reported-by: Guenter Roeck linux@roeck-us.net Signed-off-by: John Stultz john.stultz@linaro.org Signed-off-by: Sumit Semwal sumit.semwal@linaro.org Link: https://patchwork.freedesktop.org/patch/msgid/20201216004931.113505-1-john.stultz@linaro.org (cherry picked from commit 8075c3005e4b1efa12dbbf6e84bc412a713de92c) Bug: 187129171 Signed-off-by: Connor O'Brien connoro@google.com Change-Id: Icc1f312d846620ce6900c8b4dbb2a26e1bc59e9a

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/4e07e45db9894bee11a5308afb494d14d647363f

[DRIVER] dma-buf: Add support for mapping buffers with DMA attributes

Adapt referenced patch to present version.

REFERENCE: https://git.seco.com/edgehog/bsp/rockchip/linux-seco-rk/-/commit/f57c5b53d9a29ac14a73d624b41c104c8141a444

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/be32a6a931df96857236b413492641b72dffc291

FROMGIT: dma-buf: cma_heap: Fix memory leak in CMA heap

Bing Song noticed the CMA heap was leaking memory due to a flub I made in commit a5d2d29e24be ("dma-buf: heaps: Move heap-helper logic into the cma_heap implementation"), and provided this fix which ensures the pagelist is also freed on release.

Cc: Bing Song bing.song@nxp.com Cc: Sumit Semwal sumit.semwal@linaro.org Cc: Liam Mark lmark@codeaurora.org Cc: Laura Abbott labbott@kernel.org Cc: Brian Starkey Brian.Starkey@arm.com Cc: Hridya Valsaraju hridya@google.com Cc: Suren Baghdasaryan surenb@google.com Cc: Sandeep Patil sspatil@google.com Cc: Daniel Mentz danielmentz@google.com Cc: Chris Goldsworthy cgoldswo@codeaurora.org Cc: Ørjan Eide orjan.eide@arm.com Cc: Robin Murphy robin.murphy@arm.com Cc: Ezequiel Garcia ezequiel@collabora.com Cc: Simon Ser contact@emersion.fr Cc: James Jones jajones@nvidia.com Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Reported-by: Bing Song bing.song@nxp.com Fixes: a5d2d29e24be ("dma-buf: heaps: Move heap-helper logic into the cma_heap implementation") Signed-off-by: John Stultz john.stultz@linaro.org Signed-off-by: Sumit Semwal sumit.semwal@linaro.org Link: https://patchwork.freedesktop.org/patch/msgid/20210107202616.75170-1-john.stultz@linaro.org (cherry picked from commit a0adc8eabb402cfb9f32d15edd9f65f65e35cdce git: //anongit.freedesktop.org/drm/drm-misc drm-misc-fixes) Signed-off-by: John Stultz john.stultz@linaro.org Change-Id: Ic532b71ad58699db1b11870eb0027966d93acac1

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/ce32ac46af1deb103164edacf5aa5629c9c3bb1d

BACKPORT: dma-buf: heaps: Skip sync if not mapped

This patch is basically a port of Ørjan Eide's similar patch for ION https://lore.kernel.org/lkml/20200414134629.54567-1-orjan.eide@arm.com/

Only sync the sg-list of dma-buf heap attachment when the attachment is actually mapped on the device.

dma-bufs may be synced at any time. It can be reached from user space via DMA_BUF_IOCTL_SYNC, so there are no guarantees from callers on when syncs may be attempted, and dma_buf_end_cpu_access() and dma_buf_begin_cpu_access() may not be paired.

Since the sg_list's dma_address isn't set up until the buffer is used on the device, and dma_map_sg() is called on it, the dma_address will be NULL if sync is attempted on the dma-buf before it's mapped on a device.

Before v5.0 (commit 55897af63091 ("dma-direct: merge swiotlb_dma_ops into the dma_direct code")) this was a problem as the dma-api (at least the swiotlb_dma_ops on arm64) would use the potentially invalid dma_address. How that failed depended on how the device handled physical address 0. If 0 was a valid address to physical ram, that page would get flushed a lot, while the actual pages in the buffer would not get synced correctly. While if 0 is an invalid physical address it may cause a fault and trigger a crash.

In v5.0 this was incidentally fixed by commit 55897af63091 ("dma-direct: merge swiotlb_dma_ops into the dma_direct code"), as this moved the dma-api to use the page pointer in the sg_list, and (for Ion buffers at least) this will always be valid if the sg_list exists at all.

But, this issue is re-introduced in v5.3 with commit 449fa54d6815 ("dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device") moves the dma-api back to the old behaviour and picks the dma_address that may be invalid.

dma-buf core doesn't ensure that the buffer is mapped on the device, and thus have a valid sg_list, before calling the exporter's begin_cpu_access.

Logic and commit message originally by: Ørjan Eide orjan.eide@arm.com

Cc: Sumit Semwal sumit.semwal@linaro.org Cc: Liam Mark lmark@codeaurora.org Cc: Laura Abbott labbott@kernel.org Cc: Brian Starkey Brian.Starkey@arm.com Cc: Hridya Valsaraju hridya@google.com Cc: Suren Baghdasaryan surenb@google.com Cc: Sandeep Patil sspatil@google.com Cc: Daniel Mentz danielmentz@google.com Cc: Chris Goldsworthy cgoldswo@codeaurora.org Cc: Ørjan Eide orjan.eide@arm.com Cc: Robin Murphy robin.murphy@arm.com Cc: Ezequiel Garcia ezequiel@collabora.com Cc: Simon Ser contact@emersion.fr Cc: James Jones jajones@nvidia.com Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Reviewed-by: Brian Starkey brian.starkey@arm.com Signed-off-by: John Stultz john.stultz@linaro.org

Bug: 173440990 (cherry picked from commit 4c68e499bb9d6d9ec3e18fcb2f68641abb22464a git: //anongit.freedesktop.org/drm/drm-misc tags/drm-misc-next-2020-11-27) Link: https://lore.kernel.org/patchwork/patch/1343071/ Change-Id: If1c7312e437a8166a7d3e65bcd4c352f46cab718 Signed-off-by: John Stultz john.stultz@linaro.org Signed-off-by: Hridya Valsaraju hridya@google.com

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/e31a840efd2dcd4dda98281d71ecc8a6c434ec65

BACKPORT: dma-buf: system_heap: Rework system heap to use sgtables instead of pagelists

In preparation for some patches to optmize the system heap code, rework the dmabuf exporter to utilize sgtables rather then pageslists for tracking the associated pages.

This will allow for large order page allocations, as well as more efficient page pooling.

In doing so, the system heap stops using the heap-helpers logic which sadly is not quite as generic as I was hoping it to be, so this patch adds heap specific implementations of the dma_buf_ops function handlers.

Cc: Sumit Semwal sumit.semwal@linaro.org Cc: Liam Mark lmark@codeaurora.org Cc: Laura Abbott labbott@kernel.org Cc: Brian Starkey Brian.Starkey@arm.com Cc: Hridya Valsaraju hridya@google.com Cc: Suren Baghdasaryan surenb@google.com Cc: Sandeep Patil sspatil@google.com Cc: Daniel Mentz danielmentz@google.com Cc: Chris Goldsworthy cgoldswo@codeaurora.org Cc: Ørjan Eide orjan.eide@arm.com Cc: Robin Murphy robin.murphy@arm.com Cc: Ezequiel Garcia ezequiel@collabora.com Cc: Simon Ser contact@emersion.fr Cc: James Jones jajones@nvidia.com Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Reviewed-by: Brian Starkey brian.starkey@arm.com Signed-off-by: John Stultz john.stultz@linaro.org Bug: 173440990 (cherry picked from commit 3812957587923ca325308ed9c4a5be5ca935e903 git: //anongit.freedesktop.org/drm/drm-misc tags/drm-misc-next-2020-11-27) Link: https://lore.kernel.org/patchwork/patch/1343069/ Change-Id: I69401e169ad766a4a4c46751ffaace51582b5a8c Signed-off-by: John Stultz john.stultz@linaro.org [hridya: patch needed minor rebase to accommodate the kernel allocation interface] Signed-off-by: Hridya Valsaraju hridya@google.com

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/25e62ba3f0e9464a5b06d9b6a32c892015254627

BACKPORT: dma-buf: heaps: Move heap-helper logic into the cma_heap implementation

Since the heap-helpers logic ended up not being as generic as hoped, move the heap-helpers dma_buf_ops implementations into the cma_heap directly.

This will allow us to remove the heap_helpers code in a following patch.

Cc: Sumit Semwal sumit.semwal@linaro.org Cc: Liam Mark lmark@codeaurora.org Cc: Laura Abbott labbott@kernel.org Cc: Brian Starkey Brian.Starkey@arm.com Cc: Hridya Valsaraju hridya@google.com Cc: Suren Baghdasaryan surenb@google.com Cc: Sandeep Patil sspatil@google.com Cc: Daniel Mentz danielmentz@google.com Cc: Chris Goldsworthy cgoldswo@codeaurora.org Cc: Ørjan Eide orjan.eide@arm.com Cc: Robin Murphy robin.murphy@arm.com Cc: Ezequiel Garcia ezequiel@collabora.com Cc: Simon Ser contact@emersion.fr Cc: James Jones jajones@nvidia.com Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Reviewed-by: Brian Starkey brian.starkey@arm.com Signed-off-by: John Stultz john.stultz@linaro.org Bug: 173440990 (cherry picked from commit a5d2d29e24be8967ef78a1b1fb2292413e3b3df9 git: //anongit.freedesktop.org/drm/drm-misc tags/drm-misc-next-2020-11-27) Link: https://lore.kernel.org/patchwork/patch/1343068/ Change-Id: I4672138353629a61c67ad7ad8aa03d7ebc6d98ed Signed-off-by: John Stultz john.stultz@linaro.org [hridya: patch needed minor rebase to accomodate the kernel allocation interface] Signed-off-by: Hridya Valsaraju hridya@google.com

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/d8b40b7e8801b1030c1c3249a927dca6683f3580

[DRIVER] dma-buf: dma-heap: Provide accessor to get heap name

Adapt referenced patch to present version.

REFERENCE: https://git.seco.com/edgehog/bsp/rockchip/linux-seco-rk/-/commit/e09764eb7da7fe2c5d52153c97aa262c217fb9a4

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/c6dedd16035984a240bab000766a4d8b7901420c

[DRIVER] dma-buf: dma-heap: Keep track of the heap device struct

Adapt referenced patch to present version.

REFERENCE: https://git.seco.com/edgehog/bsp/rockchip/linux-seco-rk/-/commit/c8bdd325554f410da577e15e7f6d5647c5dcffd5

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/dfb2fce7e1fe22b8fba6565c8bf8bf715bf82c58

[DRIVER] dma-heap: Rework allocation calls to return struct dma_buf instead of fd

Adapt referenced patch to present version of dma-heap, add rework to dsp_heap.

REFERENCE: https://git.seco.com/edgehog/bsp/rockchip/linux-seco-rk/-/commit/349e8360c9c85c907147ea2d1d4716468409f2ab

--

Commit: https://git.seco.com/edgehog/bsp/nxp/linux-seco-imx/-/commit/532345c75ebc0011970af864125752d1c8135d63

ANDROID: dma-heap: Add proper kref handling on dma-buf heaps

Add proper refcounting on the dma_heap structure. While existing heaps are built-in, we may eventually have heaps loaded from modules, and we'll need to be able to properly handle the references to the heaps

Also moves minor tracking into the heap structure so we can properly free things.

Cc: Sumit Semwal sumit.semwal@linaro.org Cc: Andrew F. Davis afd@ti.com Cc: Benjamin Gaignard benjamin.gaignard@linaro.org Cc: Liam Mark lmark@codeaurora.org Cc: Laura Abbott labbott@kernel.org Cc: Brian Starkey Brian.Starkey@arm.com Cc: Hridya Valsaraju hridya@google.com Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz john.stultz@linaro.org Change-Id: I9f9e27f640c926882a639d6ad5dc3019d7e2c2b0 Link: https://lore.kernel.org/lkml/20200725032633.125006-1-john.stultz@linaro.org/T/#u Bug: 154341375

Merge request reports

Loading