mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
video: tegra: nvmap: Don't expose non-embedded code in embedded builds
The following functions are exported from nvmap code and being used by nvgpu in non-DriveOS code like L4T. Hence we should not include these functions in embedded builds. - nvmap_get_vpr_dev - nvmap_get_vpr1_dev The following functions get used in DriveOS as well by nvmap, but no need to export to nvgpu, as they are not supposed to be used on DrivOS by other modules. Hence do not export this in embedded builds. - nvmap_dma_alloc_attrs - nvmap_dma_free_attrs In order to achieve this, define a new config file for embedded-linux and define config and ccflag which can be used in any OOT driver to differentiate between embedded-linux and non embedded-linux builds. JIRA TMM-5842 Change-Id: Ic52106709723910e03362977472fb3597dc255f0 Signed-off-by: Ketan Patil <ketanp@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3258866 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
7
configs/Makefile.config.embedded-linux
Normal file
7
configs/Makefile.config.embedded-linux
Normal file
@@ -0,0 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
|
||||
# Embedded linux specific environment variables to distinguish between embedded-linux and non embedded-linux builds.
|
||||
|
||||
export NV_OOT_NVMAP_IN_EMBEDDED_LINUX=y
|
||||
subdir-ccflags-y += -DNV_CONFIG_NVMAP_IN_EMBEDDED_LINUX
|
||||
@@ -5,9 +5,11 @@
|
||||
#ifndef __NVMAP_EXPORTS_H
|
||||
#define __NVMAP_EXPORTS_H
|
||||
|
||||
#ifndef NV_CONFIG_NVMAP_IN_EMBEDDED_LINUX
|
||||
void *nvmap_dma_alloc_attrs(struct device *dev, size_t size,
|
||||
dma_addr_t *dma_handle, gfp_t flag,
|
||||
unsigned long attrs);
|
||||
|
||||
void nvmap_dma_free_attrs(struct device *dev, size_t size, void *cpu_addr,
|
||||
dma_addr_t dma_handle, unsigned long attrs);
|
||||
|
||||
@@ -15,4 +17,5 @@ struct device *nvmap_get_vpr_dev(void);
|
||||
|
||||
struct device *nvmap_get_vpr1_dev(void);
|
||||
|
||||
#endif /* !NV_CONFIG_NVMAP_IN_EMBEDDED_LINUX */
|
||||
#endif /* __NVMAP_EXPORTS_H */
|
||||
|
||||
@@ -476,9 +476,15 @@ err:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef NV_CONFIG_NVMAP_IN_EMBEDDED_LINUX
|
||||
void *nvmap_dma_alloc_attrs(struct device *dev, size_t size,
|
||||
dma_addr_t *dma_handle,
|
||||
gfp_t flag, unsigned long attrs)
|
||||
#else
|
||||
static void *nvmap_dma_alloc_attrs(struct device *dev, size_t size,
|
||||
dma_addr_t *dma_handle,
|
||||
gfp_t flag, unsigned long attrs)
|
||||
#endif /* NV_CONFIG_NVMAP_IN_EMBEDDED_LINUX */
|
||||
{
|
||||
struct dma_coherent_mem_replica *mem;
|
||||
|
||||
@@ -492,7 +498,9 @@ void *nvmap_dma_alloc_attrs(struct device *dev, size_t size,
|
||||
return __nvmap_dma_alloc_from_coherent(dev, mem, size, dma_handle,
|
||||
attrs, 0);
|
||||
}
|
||||
#ifndef NV_CONFIG_NVMAP_IN_EMBEDDED_LINUX
|
||||
EXPORT_SYMBOL(nvmap_dma_alloc_attrs);
|
||||
#endif /* !NV_CONFIG_NVMAP_IN_EMBEDDED_LINUX */
|
||||
|
||||
#ifdef CONFIG_TEGRA_VIRTUALIZATION
|
||||
static void *nvmap_dma_mark_declared_memory_occupied(struct device *dev,
|
||||
@@ -578,8 +586,13 @@ static phys_addr_t nvmap_alloc_mem(struct nvmap_heap *h, size_t len,
|
||||
return pa;
|
||||
}
|
||||
|
||||
#ifndef NV_CONFIG_NVMAP_IN_EMBEDDED_LINUX
|
||||
void nvmap_dma_free_attrs(struct device *dev, size_t size, void *cpu_addr,
|
||||
dma_addr_t dma_handle, unsigned long attrs)
|
||||
#else
|
||||
static void nvmap_dma_free_attrs(struct device *dev, size_t size, void *cpu_addr,
|
||||
dma_addr_t dma_handle, unsigned long attrs)
|
||||
#endif /* NV_CONFIG_NVMAP_IN_EMBEDDED_LINUX */
|
||||
{
|
||||
void *mem_addr;
|
||||
unsigned long flags;
|
||||
@@ -629,7 +642,9 @@ void nvmap_dma_free_attrs(struct device *dev, size_t size, void *cpu_addr,
|
||||
spin_unlock_irqrestore(&mem->spinlock, flags);
|
||||
}
|
||||
}
|
||||
#ifndef NV_CONFIG_NVMAP_IN_EMBEDDED_LINUX
|
||||
EXPORT_SYMBOL(nvmap_dma_free_attrs);
|
||||
#endif /* !NV_CONFIG_NVMAP_IN_EMBEDDED_LINUX */
|
||||
|
||||
static void nvmap_free_mem(struct nvmap_heap *h, phys_addr_t base,
|
||||
size_t len)
|
||||
|
||||
@@ -255,6 +255,7 @@ static int __nvmap_init_dt(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef NV_CONFIG_NVMAP_IN_EMBEDDED_LINUX
|
||||
struct device *nvmap_get_vpr_dev(void)
|
||||
{
|
||||
struct device_node *dn = of_find_compatible_node(NULL, NULL, "nvidia,vpr-carveout");
|
||||
@@ -288,6 +289,7 @@ struct device *nvmap_get_vpr1_dev(void)
|
||||
return &tegra_vpr1_dev;
|
||||
}
|
||||
EXPORT_SYMBOL(nvmap_get_vpr1_dev);
|
||||
#endif /* !NV_CONFIG_NVMAP_IN_EMBEDDED_LINUX */
|
||||
|
||||
static int __init nvmap_co_device_init(struct reserved_mem *rmem,
|
||||
struct device *dev)
|
||||
|
||||
Reference in New Issue
Block a user