Files
linux-nv-oot/drivers/video/tegra/nvmap/nvmap_alloc.h
Ketan Patil 8971a981c5 video: tegra: nvmap: Add helper functions for nvmap_heap
- Move all data structures from nvmap_heap.h header file to
nvmap_alloc_int.h file as they are owned by nvmap_alloc unit.
- Provide getter and setter functions to get or set the members of these
data structures.
- Provide forward declaration of such data structures.
- Remove nvmap_heap.h header file as nvmap_heap is part of the
nvmap_alloc unit and nvmap_alloc unit exposes nvmap_alloc.h as header
file to other units.

JIRA TMM-5621

Change-Id: I2c4dd95a1a1011e4a7c1b425aa7521c6f13202da
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3201354
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:06 +00:00

93 lines
2.8 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/* SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
#ifndef __NVMAP_ALLOC_H
#define __NVMAP_ALLOC_H
struct nvmap_heap;
struct debugfs_info;
void *nvmap_altalloc(size_t len);
void nvmap_altfree(void *ptr, size_t len);
int nvmap_alloc_handle(struct nvmap_client *client,
struct nvmap_handle *h, unsigned int heap_mask,
size_t align, u8 kind,
unsigned int flags, unsigned int peer);
int nvmap_alloc_handle_from_va(struct nvmap_client *client,
struct nvmap_handle *h,
ulong addr,
unsigned int flags,
unsigned int heap_mask);
void _nvmap_handle_free(struct nvmap_handle *h);
int __nvmap_cache_maint(struct nvmap_client *client,
struct nvmap_cache_op_64 *op);
int __nvmap_do_cache_maint(struct nvmap_client *client, struct nvmap_handle *h,
unsigned long start, unsigned long end,
unsigned int op, bool clean_only_dirty);
void inner_cache_maint(unsigned int op, void *vaddr, size_t size);
struct nvmap_heap_block *nvmap_carveout_alloc(struct nvmap_client *dev,
struct nvmap_handle *handle,
unsigned long type,
phys_addr_t *start);
int nvmap_create_carveout(const struct nvmap_platform_carveout *co);
int nvmap_query_heap_peer(struct nvmap_heap *heap, unsigned int *peer);
size_t nvmap_query_heap_size(struct nvmap_heap *heap);
struct nvmap_heap *nvmap_block_to_heap(struct nvmap_heap_block *b);
void nvmap_heap_free(struct nvmap_heap_block *block);
void nvmap_heap_destroy(struct nvmap_heap *heap);
int __init nvmap_heap_init(void);
void nvmap_heap_deinit(void);
struct page **nvmap_pages(struct page **pg_pages, u32 nr_pages);
struct page *nvmap_to_page(struct page *page);
#ifdef NVMAP_CONFIG_PAGE_POOLS
int nvmap_page_pool_clear(void);
int nvmap_page_pool_debugfs_init(struct dentry *nvmap_root);
int nvmap_page_pool_init(struct nvmap_device *dev);
int nvmap_page_pool_fini(struct nvmap_device *dev);
#endif /* NVMAP_CONFIG_PAGE_POOLS */
/* helper functions for nvmap_heap struct */
size_t nvmap_get_heap_free_size(struct nvmap_heap *heap);
int nvmap_get_heap_nid(struct nvmap_heap *heap);
/* helper functions for nvmap_heap_block struct */
phys_addr_t nvmap_get_heap_block_base(struct nvmap_heap_block *block);
void nvmap_set_heap_block_handle(struct nvmap_heap_block *block, struct nvmap_handle *handle);
/* helper functions for debugfs_info struct */
unsigned int nvmap_get_debug_info_heap(struct debugfs_info *info);
int nvmap_get_debug_info_nid(struct debugfs_info *info);
struct debugfs_info *nvmap_create_debugfs_info(void);
void nvmap_set_debugfs_heap(struct debugfs_info *info, unsigned int heap_bit);
void nvmap_set_debugfs_numa(struct debugfs_info *info, int nid);
#endif /* __NVMAP_ALLOC_H */