From 170c9552c84bf0916faef800d6de02671decf953 Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Tue, 20 Sep 2022 09:36:58 -0700 Subject: [PATCH] tegra: hwpm: update dma buf pointer as per oot def OOT definition of dma_buf_vmap() is changed to accept 2 arguments. The second argumentt is used to return the dma mapping of the user buffer. However, this output pointer is expected to point to an allocated sma_buf_map structure. Add dma_buf_map structure as a member of struct tegra_hwpm_mem_mgmt. Bug 3768922 Change-Id: Ie776b7b7d0e364e6391212b9df87acbb4c43f1fa Signed-off-by: Vedashree Vidwans Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2778946 Reviewed-by: svc-mobile-coverity Reviewed-by: svcacv Reviewed-by: Seema Khowala GVS: Gerrit_Virtual_Submit --- os/linux/mem_mgmt_utils.c | 2 ++ os/linux/mem_mgmt_utils.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/os/linux/mem_mgmt_utils.c b/os/linux/mem_mgmt_utils.c index f8c896f..145242b 100644 --- a/os/linux/mem_mgmt_utils.c +++ b/os/linux/mem_mgmt_utils.c @@ -128,6 +128,8 @@ static int tegra_hwpm_dma_map_mem_bytes_buffer(struct tegra_soc_hwpm *hwpm, sg_dma_address(hwpm->mem_mgmt->mem_bytes_sgt->sgl); #if defined(CONFIG_TEGRA_HWPM_OOT) + hwpm->mem_mgmt->mem_bytes_kernel = + (struct dma_buf_map *) &hwpm->mem_mgmt->mem_bytes_map; err = dma_buf_vmap(hwpm->mem_mgmt->mem_bytes_dma_buf, #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) (struct iosys_map *)hwpm->mem_mgmt->mem_bytes_kernel); diff --git a/os/linux/mem_mgmt_utils.h b/os/linux/mem_mgmt_utils.h index 099d019..dd730b5 100644 --- a/os/linux/mem_mgmt_utils.h +++ b/os/linux/mem_mgmt_utils.h @@ -15,6 +15,9 @@ #define TEGRA_HWPM_OS_LINUX_MEM_MGMT_UTILS_H #include +#if defined(CONFIG_TEGRA_HWPM_OOT) +#include +#endif /* This macro is copy of TEGRA_SOC_HWPM_MEM_BYTES_INVALID */ #define TEGRA_HWPM_MEM_BYTES_INVALID 0xffffffff @@ -38,6 +41,9 @@ struct tegra_hwpm_mem_mgmt { struct dma_buf_attachment *mem_bytes_attach; u64 mem_bytes_buf_va; void *mem_bytes_kernel; +#if defined(CONFIG_TEGRA_HWPM_OOT) + struct dma_buf_map mem_bytes_map; +#endif }; struct tegra_hwpm_allowlist_map {