From 4f30235981d7f4b246acb6ec94fdae3ce4f17b26 Mon Sep 17 00:00:00 2001 From: Chris Goldsworthy Date: Thu, 16 Jun 2022 12:27:47 -0700 Subject: [PATCH 1/4] modules.list.msm.pineapple: Add the mem-buf modules Add the mem-buf modules to the list of first stage modules. Change-Id: I246070b9708119554511148d3437895d3ec3f90b Signed-off-by: Chris Goldsworthy --- modules.list.msm.pineapple | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules.list.msm.pineapple b/modules.list.msm.pineapple index e42f92b4c80a..77c3b2d0be4c 100644 --- a/modules.list.msm.pineapple +++ b/modules.list.msm.pineapple @@ -4,6 +4,9 @@ qcom-pdc.ko qcom_iommu_util.ko arm_smmu.ko secure_buffer.ko +mem_buf_dev.ko +mem_buf_msgq.ko +mem_buf.ko qcom-scm.ko pinctrl-msm.ko pinctrl-pineapple.ko From d89608f45d7a95a07fdc60dfa4d8b360dff07aae Mon Sep 17 00:00:00 2001 From: Chris Goldsworthy Date: Thu, 16 Jun 2022 12:22:39 -0700 Subject: [PATCH 2/4] defconfig: pineapple-gki: Enable the mem-buf driver Enable our mem-buf driver on pineapple. Change-Id: If038f847b89cb37a9ba4c09679b980ed8d3b7cf1 Signed-off-by: Chris Goldsworthy --- arch/arm64/configs/vendor/pineapple_GKI.config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/configs/vendor/pineapple_GKI.config b/arch/arm64/configs/vendor/pineapple_GKI.config index ab38f0305870..3c37e1487bd8 100644 --- a/arch/arm64/configs/vendor/pineapple_GKI.config +++ b/arch/arm64/configs/vendor/pineapple_GKI.config @@ -21,6 +21,8 @@ CONFIG_PINCTRL_PINEAPPLE=m CONFIG_QCOM_COMMAND_DB=m CONFIG_QCOM_GDSC_REGULATOR=m CONFIG_QCOM_IOMMU_UTIL=m +CONFIG_QCOM_MEM_BUF=m +CONFIG_QCOM_MEM_BUF_DEV=m # CONFIG_QCOM_MINIDUMP is not set CONFIG_QCOM_PDC=m # CONFIG_QCOM_Q6V5_ADSP is not set From 88f5b52bd5e2a72cfe6c8ce9754f182f43595484 Mon Sep 17 00:00:00 2001 From: Chris Goldsworthy Date: Wed, 15 Jun 2022 18:59:41 -0700 Subject: [PATCH 3/4] dma-heap: qcom: Replace dma_buf_map* references with iosys_map* commit 7938f4218168 ("dma-buf-map: Rename to iosys-map") renames all struct dma_buf_map variables to reflect that the mapping interface is more generic and can be used outside of the context of DMA-BUFs. Update the relevant struct names and associated helpers accordingly, to fix compilation issues. Change-Id: I2682ebe1846273c84413f3f3bff991f7397c9bcb Signed-off-by: Chris Goldsworthy --- drivers/dma-buf/heaps/qcom_sg_ops.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/dma-buf/heaps/qcom_sg_ops.c b/drivers/dma-buf/heaps/qcom_sg_ops.c index dee93ec563fb..e6a1850dd015 100644 --- a/drivers/dma-buf/heaps/qcom_sg_ops.c +++ b/drivers/dma-buf/heaps/qcom_sg_ops.c @@ -14,6 +14,7 @@ * https://lore.kernel.org/lkml/20201017013255.43568-2-john.stultz@linaro.org/ * * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -456,7 +457,7 @@ static void *qcom_sg_do_vmap(struct qcom_sg_buffer *buffer) return vaddr; } -static int qcom_sg_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map) +static int qcom_sg_vmap(struct dma_buf *dmabuf, struct iosys_map *map) { struct qcom_sg_buffer *buffer = dmabuf->priv; void *vaddr; @@ -471,7 +472,7 @@ static int qcom_sg_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map) mutex_lock(&buffer->lock); if (buffer->vmap_cnt) { buffer->vmap_cnt++; - dma_buf_map_set_vaddr(map, buffer->vaddr); + iosys_map_set_vaddr(map, buffer->vaddr); goto out; } @@ -484,14 +485,14 @@ static int qcom_sg_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map) buffer->vaddr = vaddr; buffer->vmap_cnt++; - dma_buf_map_set_vaddr(map, buffer->vaddr); + iosys_map_set_vaddr(map, buffer->vaddr); out: mutex_unlock(&buffer->lock); return ret; } -static void qcom_sg_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map) +static void qcom_sg_vunmap(struct dma_buf *dmabuf, struct iosys_map *map) { struct qcom_sg_buffer *buffer = dmabuf->priv; @@ -502,7 +503,7 @@ static void qcom_sg_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map) } mem_buf_vmperm_unpin(buffer->vmperm); mutex_unlock(&buffer->lock); - dma_buf_map_clear(map); + iosys_map_clear(map); } static void qcom_sg_release(struct dma_buf *dmabuf) From c5548864b15a11e0c0a14dbac15320cd22995ff1 Mon Sep 17 00:00:00 2001 From: Chris Goldsworthy Date: Thu, 16 Jun 2022 12:40:30 -0700 Subject: [PATCH 4/4] android: abi_gki_aarch64_qcom: Add mem_section to whitelist Our DMA-BUF heaps depend on having access to mem_section - add it to the whitelist accordingly. Change-Id: I5ce793a78c2eeb366ba470881226a458c6e1dca0 Signed-off-by: Chris Goldsworthy --- android/abi_gki_aarch64_qcom | 1 + 1 file changed, 1 insertion(+) diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index e752499426a8..46079079be57 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -944,6 +944,7 @@ memory_read_from_buffer memparse memremap + mem_section memset memset64 __memset_io