video: tegra: nvmap: Protect dma memory code

nvmap_dma_mark_declared_memory_occupied/unoccupied functions are only getting called when CONFIG_TEGRA_VIRTUALIZATION is defined. So protect the functions under the respective flag.

Bug 4479027

Change-Id: If4c00084fde5079778f47fc09c91dccde36fe4d4
Signed-off-by: Yash Bhatt <ybhatt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3103557
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
This commit is contained in:
Yash Bhatt
2024-03-25 07:28:30 +00:00
committed by mobile promotions
parent 4f69d815e6
commit 7acc8a556a
2 changed files with 5 additions and 0 deletions

View File

@@ -580,6 +580,7 @@ void nvmap_dma_free_attrs(struct device *dev, size_t size, void *cpu_addr,
}
EXPORT_SYMBOL(nvmap_dma_free_attrs);
#ifdef CONFIG_TEGRA_VIRTUALIZATION
void *nvmap_dma_mark_declared_memory_occupied(struct device *dev,
dma_addr_t device_addr, size_t size)
{
@@ -631,6 +632,7 @@ void nvmap_dma_mark_declared_memory_unoccupied(struct device *dev,
bitmap_clear(mem->bitmap, pos, alloc_size);
spin_unlock_irqrestore(&mem->spinlock, flags);
}
#endif /* CONFIG_TEGRA_VIRTUALIZATION */
void nvmap_dma_release_coherent_memory(struct dma_coherent_mem_replica *mem)
{

View File

@@ -881,10 +881,13 @@ void nvmap_remove_device_name(char *device_name, u32 heap_type);
bool dmabuf_is_nvmap(struct dma_buf *dmabuf);
struct nvmap_handle *nvmap_handle_get_from_id(struct nvmap_client *client,
u32 id);
#ifdef CONFIG_TEGRA_VIRTUALIZATION
void *nvmap_dma_mark_declared_memory_occupied(struct device *dev,
dma_addr_t device_addr, size_t size);
void nvmap_dma_mark_declared_memory_unoccupied(struct device *dev,
dma_addr_t device_addr, size_t size);
#endif /* CONFIG_TEGRA_VIRTUALIZATION */
extern void __dma_flush_area(const void *cpu_va, size_t size);
extern void __dma_map_area(const void *cpu_va, size_t size, int dir);