mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-25 10:42:21 +03:00
- Add nvmap_dev.h file which include declaration for functions and data structs which are exposed by nvmap_dev unit to other units. - Also, add nvmap_dev_int.h file which include declaration for functions which are internal to nvmap_dev unit that can be called by files within nvmap_dev unit. - Move definition of nvmap_handle_get_from_id, nvmap_install_fd, find_range_of_handles to nvmap_handle.c as they belong to nvmap_handle unit. - Cleanup nvmap_priv.h by moving all relevant items for nvmap_dev unit to nvmap_dev unit. - Remove nvmap_mm.c file as nvmap_zap_handle is the only function present; move it to nvmap_cache.c where it's being called. - Remove function declarations whose definition are not present. JIRA TMM-5694 JIRA TMM-5730 Change-Id: Ifd45235076da2ef0c628f3179d828c0ccadf6df2 Signed-off-by: Ketan Patil <ketanp@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3223994 Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
82 lines
2.6 KiB
C
82 lines
2.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/* SPDX-FileCopyrightText: Copyright (c) 2009-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
|
|
|
|
#ifndef __NVMAP_DEV_H
|
|
#define __NVMAP_DEV_H
|
|
#define NVMAP_HEAP_IOVMM (1ul<<30)
|
|
|
|
/* common carveout heaps */
|
|
#define NVMAP_HEAP_CARVEOUT_VPR (1ul<<28)
|
|
#define NVMAP_HEAP_CARVEOUT_TSEC (1ul<<27)
|
|
#define NVMAP_HEAP_CARVEOUT_VIDMEM (1ul<<26)
|
|
#define NVMAP_HEAP_CARVEOUT_GPU (1ul << 3)
|
|
#define NVMAP_HEAP_CARVEOUT_FSI (1ul<<2)
|
|
#define NVMAP_HEAP_CARVEOUT_IVM (1ul<<1)
|
|
#define NVMAP_HEAP_CARVEOUT_GENERIC (1ul<<0)
|
|
|
|
#define NVMAP_HEAP_CARVEOUT_MASK (NVMAP_HEAP_IOVMM - 1)
|
|
|
|
/* allocation flags */
|
|
#define NVMAP_HANDLE_UNCACHEABLE (0x0ul << 0)
|
|
#define NVMAP_HANDLE_WRITE_COMBINE (0x1ul << 0)
|
|
#define NVMAP_HANDLE_INNER_CACHEABLE (0x2ul << 0)
|
|
#define NVMAP_HANDLE_CACHEABLE (0x3ul << 0)
|
|
#define NVMAP_HANDLE_CACHE_FLAG (0x3ul << 0)
|
|
|
|
#define NVMAP_HANDLE_SECURE (0x1ul << 2)
|
|
#define NVMAP_HANDLE_KIND_SPECIFIED (0x1ul << 3)
|
|
#define NVMAP_HANDLE_COMPR_SPECIFIED (0x1ul << 4)
|
|
#define NVMAP_HANDLE_ZEROED_PAGES (0x1ul << 5)
|
|
#define NVMAP_HANDLE_PHYS_CONTIG (0x1ul << 6)
|
|
#define NVMAP_HANDLE_CACHE_SYNC (0x1ul << 7)
|
|
#define NVMAP_HANDLE_CACHE_SYNC_AT_RESERVE (0x1ul << 8)
|
|
#define NVMAP_HANDLE_RO (0x1ul << 9)
|
|
|
|
/*
|
|
* A heap can be mapped to memory other than DRAM.
|
|
* The HW, controls the memory, can be power gated/ungated
|
|
* based upon the clients using the memory.
|
|
* if no client/alloc happens from the memory, the HW needs
|
|
* to be power gated. Similarly it should power ungated if
|
|
* alloc happens from the memory.
|
|
* int (*busy)(void) - trigger runtime power ungate
|
|
* int (*idle)(void) - trigger runtime power gate
|
|
*/
|
|
struct nvmap_pm_ops {
|
|
int (*busy)(void);
|
|
int (*idle)(void);
|
|
};
|
|
|
|
struct nvmap_platform_carveout {
|
|
const char *name;
|
|
unsigned int usage_mask;
|
|
phys_addr_t base;
|
|
size_t size;
|
|
struct device *cma_dev;
|
|
bool resize;
|
|
struct device *dma_dev;
|
|
struct device dev;
|
|
bool is_ivm;
|
|
unsigned int peer;
|
|
unsigned int vmid;
|
|
int can_alloc;
|
|
bool enable_static_dma_map;
|
|
bool disable_dynamic_dma_map;
|
|
bool no_cpu_access; /* carveout can't be accessed from cpu at all */
|
|
bool init_done; /* FIXME: remove once all caveouts use reserved-memory */
|
|
struct nvmap_pm_ops pm_ops;
|
|
int numa_node_id; /* NUMA node id from which the carveout is allocated from */
|
|
};
|
|
|
|
struct nvmap_platform_data {
|
|
const struct nvmap_platform_carveout *carveouts;
|
|
unsigned int nr_carveouts;
|
|
};
|
|
|
|
bool is_nvmap_memory_available(size_t size, uint32_t heap, int numa_nid);
|
|
|
|
void kasan_memcpy_toio(void __iomem *to, const void *from,
|
|
size_t count);
|
|
|
|
#endif /* __NVMAP_DEV_H */
|