Skip to content

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

Commit: edgehog/layers/seco/meta-seco-imx@c659a43c

Integrate linux-seco-imx/cma-uncached

--

Commit: edgehog/bsp/nxp/linux-seco-imx@08f75add

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

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

--

Commit: edgehog/bsp/nxp/linux-seco-imx@5b450fdf

dma-buf: heaps: cma: add uncached

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

--

Commit: edgehog/bsp/nxp/linux-seco-imx@d6248aef

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

Import only cma_heap section.

REFERENCE: edgehog/bsp/rockchip/linux-seco-rk@956db89e

--

Commit: edgehog/bsp/nxp/linux-seco-imx@c76d35e3

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: edgehog/bsp/nxp/linux-seco-imx@4e07e45d

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

Adapt referenced patch to present version.

REFERENCE: edgehog/bsp/rockchip/linux-seco-rk@f57c5b53

--

Commit: edgehog/bsp/nxp/linux-seco-imx@be32a6a9

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: edgehog/bsp/nxp/linux-seco-imx@ce32ac46

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: edgehog/bsp/nxp/linux-seco-imx@e31a840e

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: edgehog/bsp/nxp/linux-seco-imx@25e62ba3

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: edgehog/bsp/nxp/linux-seco-imx@d8b40b7e

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

Adapt referenced patch to present version.

REFERENCE: edgehog/bsp/rockchip/linux-seco-rk@e09764eb

--

Commit: edgehog/bsp/nxp/linux-seco-imx@c6dedd16

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

Adapt referenced patch to present version.

REFERENCE: edgehog/bsp/rockchip/linux-seco-rk@c8bdd325

--

Commit: edgehog/bsp/nxp/linux-seco-imx@dfb2fce7

[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: edgehog/bsp/rockchip/linux-seco-rk@349e8360

--

Commit: edgehog/bsp/nxp/linux-seco-imx@532345c7

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