mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-25 02:32:08 +03:00
Move the data-structures and functions/declarations belonging to nvmap_handle into it's header file. JIRA TMM-5693 Change-Id: I8a19a22512ae7932d645bd306b663fcd437d74d0 Signed-off-by: Ashish Mhetre <amhetre@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3226562 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
119 lines
3.7 KiB
C
119 lines
3.7 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;
|
|
struct nvmap_carveout_node;
|
|
|
|
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);
|
|
|
|
int nvmap_get_user_pages(ulong vaddr,
|
|
size_t nr_page, struct page **pages,
|
|
bool is_user_flags, u32 user_foll_flags);
|
|
|
|
phys_addr_t nvmap_alloc_get_co_base(struct nvmap_handle *h);
|
|
|
|
void nvmap_alloc_free(struct page **pages, unsigned int nr_page, bool from_va,
|
|
bool is_subhandle);
|
|
|
|
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_carveout_node *co_heap, unsigned int *peer);
|
|
|
|
size_t nvmap_query_heap_size(struct nvmap_heap *heap);
|
|
|
|
int nvmap_query_heap(struct nvmap_query_heap_params *op, bool is_numa_aware);
|
|
|
|
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 system_heap_free_mem(unsigned long *mem_val);
|
|
|
|
int __init nvmap_heap_init(void);
|
|
|
|
void nvmap_heap_deinit(void);
|
|
|
|
int nvmap_dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
|
|
dma_addr_t device_addr, size_t size, int flags);
|
|
|
|
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);
|
|
|
|
#ifdef NVMAP_CONFIG_DEBUG_MAPS
|
|
struct rb_root *nvmap_heap_get_device_ptr(struct nvmap_heap *heap);
|
|
#endif /* NVMAP_CONFIG_DEBUG_MAPS */
|
|
|
|
/* 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_free_debugfs_info(struct debugfs_info *info);
|
|
|
|
void nvmap_set_debugfs_heap(struct debugfs_info *info, unsigned int heap_bit);
|
|
|
|
void nvmap_set_debugfs_numa(struct debugfs_info *info, int nid);
|
|
|
|
/* helper functions for nvmap_carveout_node struct */
|
|
unsigned int nvmap_get_heap_bit(struct nvmap_carveout_node *co_heap);
|
|
|
|
struct nvmap_heap *nvmap_get_heap_ptr(struct nvmap_carveout_node *co_heap);
|
|
|
|
#endif /* __NVMAP_ALLOC_H */
|