1 #ifndef _G_VIRTUAL_MEM_NVOC_H_
2 #define _G_VIRTUAL_MEM_NVOC_H_
3 #include "nvoc/runtime.h"
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 /*
10  * SPDX-FileCopyrightText: Copyright (c) 2020-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
11  * SPDX-License-Identifier: MIT
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included in
21  * all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  */
31 
32 #include "g_virtual_mem_nvoc.h"
33 
34 #ifndef _VIRTUAL_MEMORY_H_
35 #define _VIRTUAL_MEMORY_H_
36 
37 #include "mem_mgr/standard_mem.h"
38 #include "gpu/mem_mgr/heap_base.h"
39 
40 /*!
41  * Allocator for NV50_MEMORY_VIRTUAL class.
42  *
43  * Describes a range of typed virtual memory.  Used as
44  * a target space for RmMapMemoryDma.
45  *
46  * The NV01_MEMORY_VIRTUAL subclass class is typeless.
47  */
48 
49 // Private field names are wrapped in PRIVATE_FIELD, which does nothing for
50 // the matching C source file, but causes diagnostics to be issued if another
51 // source file references the field.
52 #ifdef NVOC_VIRTUAL_MEM_H_PRIVATE_ACCESS_ALLOWED
53 #define PRIVATE_FIELD(x) x
54 #else
55 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
56 #endif
57 
58 struct VirtualMemory {
59     const struct NVOC_RTTI *__nvoc_rtti;
60     struct StandardMemory __nvoc_base_StandardMemory;
61     struct Object *__nvoc_pbase_Object;
62     struct RsResource *__nvoc_pbase_RsResource;
63     struct RmResourceCommon *__nvoc_pbase_RmResourceCommon;
64     struct RmResource *__nvoc_pbase_RmResource;
65     struct Memory *__nvoc_pbase_Memory;
66     struct StandardMemory *__nvoc_pbase_StandardMemory;
67     struct VirtualMemory *__nvoc_pbase_VirtualMemory;
68     NV_STATUS (*__virtmemMapTo__)(struct VirtualMemory *, struct RS_RES_MAP_TO_PARAMS *);
69     NV_STATUS (*__virtmemUnmapFrom__)(struct VirtualMemory *, struct RS_RES_UNMAP_FROM_PARAMS *);
70     NvBool (*__virtmemIsPartialUnmapSupported__)(struct VirtualMemory *);
71     NV_STATUS (*__virtmemCheckMemInterUnmap__)(struct VirtualMemory *, NvBool);
72     NvBool (*__virtmemShareCallback__)(struct VirtualMemory *, struct RsClient *, struct RsResourceRef *, RS_SHARE_POLICY *);
73     NV_STATUS (*__virtmemGetMapAddrSpace__)(struct VirtualMemory *, CALL_CONTEXT *, NvU32, NV_ADDRESS_SPACE *);
74     NvBool (*__virtmemIsExportAllowed__)(struct VirtualMemory *);
75     NvU32 (*__virtmemGetRefCount__)(struct VirtualMemory *);
76     void (*__virtmemAddAdditionalDependants__)(struct RsClient *, struct VirtualMemory *, RsResourceRef *);
77     NV_STATUS (*__virtmemControl_Prologue__)(struct VirtualMemory *, CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
78     NvBool (*__virtmemIsGpuMapAllowed__)(struct VirtualMemory *, struct OBJGPU *);
79     void (*__virtmemControl_Epilogue__)(struct VirtualMemory *, CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
80     NV_STATUS (*__virtmemControl__)(struct VirtualMemory *, CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
81     NV_STATUS (*__virtmemUnmap__)(struct VirtualMemory *, CALL_CONTEXT *, RsCpuMapping *);
82     NV_STATUS (*__virtmemGetMemInterMapParams__)(struct VirtualMemory *, RMRES_MEM_INTER_MAP_PARAMS *);
83     NV_STATUS (*__virtmemGetMemoryMappingDescriptor__)(struct VirtualMemory *, MEMORY_DESCRIPTOR **);
84     NV_STATUS (*__virtmemControlFilter__)(struct VirtualMemory *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
85     NV_STATUS (*__virtmemControlSerialization_Prologue__)(struct VirtualMemory *, CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
86     NvBool (*__virtmemCanCopy__)(struct VirtualMemory *);
87     NV_STATUS (*__virtmemIsReady__)(struct VirtualMemory *, NvBool);
88     NV_STATUS (*__virtmemCheckCopyPermissions__)(struct VirtualMemory *, struct OBJGPU *, struct Device *);
89     void (*__virtmemPreDestruct__)(struct VirtualMemory *);
90     NV_STATUS (*__virtmemIsDuplicate__)(struct VirtualMemory *, NvHandle, NvBool *);
91     void (*__virtmemControlSerialization_Epilogue__)(struct VirtualMemory *, CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
92     NV_STATUS (*__virtmemMap__)(struct VirtualMemory *, CALL_CONTEXT *, struct RS_CPU_MAP_PARAMS *, RsCpuMapping *);
93     NvBool (*__virtmemAccessCallback__)(struct VirtualMemory *, struct RsClient *, void *, RsAccessRight);
94     NvHandle hVASpace;
95     NvBool bAllowUnicastMapping;
96     NvBool bReserveVaOnAlloc;
97     NvBool bFlaVAS;
98     NvBool bRpcAlloc;
99     NODE *pDmaMappingList;
100     NvBool bOptimizePageTableMempoolUsage;
101 };
102 
103 #ifndef __NVOC_CLASS_VirtualMemory_TYPEDEF__
104 #define __NVOC_CLASS_VirtualMemory_TYPEDEF__
105 typedef struct VirtualMemory VirtualMemory;
106 #endif /* __NVOC_CLASS_VirtualMemory_TYPEDEF__ */
107 
108 #ifndef __nvoc_class_id_VirtualMemory
109 #define __nvoc_class_id_VirtualMemory 0x2aea5c
110 #endif /* __nvoc_class_id_VirtualMemory */
111 
112 extern const struct NVOC_CLASS_DEF __nvoc_class_def_VirtualMemory;
113 
114 #define __staticCast_VirtualMemory(pThis) \
115     ((pThis)->__nvoc_pbase_VirtualMemory)
116 
117 #ifdef __nvoc_virtual_mem_h_disabled
118 #define __dynamicCast_VirtualMemory(pThis) ((VirtualMemory*)NULL)
119 #else //__nvoc_virtual_mem_h_disabled
120 #define __dynamicCast_VirtualMemory(pThis) \
121     ((VirtualMemory*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(VirtualMemory)))
122 #endif //__nvoc_virtual_mem_h_disabled
123 
124 
125 NV_STATUS __nvoc_objCreateDynamic_VirtualMemory(VirtualMemory**, Dynamic*, NvU32, va_list);
126 
127 NV_STATUS __nvoc_objCreate_VirtualMemory(VirtualMemory**, Dynamic*, NvU32, CALL_CONTEXT * arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL * arg_pParams);
128 #define __objCreate_VirtualMemory(ppNewObj, pParent, createFlags, arg_pCallContext, arg_pParams) \
129     __nvoc_objCreate_VirtualMemory((ppNewObj), staticCast((pParent), Dynamic), (createFlags), arg_pCallContext, arg_pParams)
130 
131 #define virtmemMapTo(pVirtualMemory, pParams) virtmemMapTo_DISPATCH(pVirtualMemory, pParams)
132 #define virtmemUnmapFrom(pVirtualMemory, pParams) virtmemUnmapFrom_DISPATCH(pVirtualMemory, pParams)
133 #define virtmemIsPartialUnmapSupported(pVirtualMemory) virtmemIsPartialUnmapSupported_DISPATCH(pVirtualMemory)
134 #define virtmemCheckMemInterUnmap(pMemory, bSubdeviceHandleProvided) virtmemCheckMemInterUnmap_DISPATCH(pMemory, bSubdeviceHandleProvided)
135 #define virtmemShareCallback(pResource, pInvokingClient, pParentRef, pSharePolicy) virtmemShareCallback_DISPATCH(pResource, pInvokingClient, pParentRef, pSharePolicy)
136 #define virtmemGetMapAddrSpace(pMemory, pCallContext, mapFlags, pAddrSpace) virtmemGetMapAddrSpace_DISPATCH(pMemory, pCallContext, mapFlags, pAddrSpace)
137 #define virtmemIsExportAllowed(pMemory) virtmemIsExportAllowed_DISPATCH(pMemory)
138 #define virtmemGetRefCount(pResource) virtmemGetRefCount_DISPATCH(pResource)
139 #define virtmemAddAdditionalDependants(pClient, pResource, pReference) virtmemAddAdditionalDependants_DISPATCH(pClient, pResource, pReference)
140 #define virtmemControl_Prologue(pResource, pCallContext, pParams) virtmemControl_Prologue_DISPATCH(pResource, pCallContext, pParams)
141 #define virtmemIsGpuMapAllowed(pMemory, pGpu) virtmemIsGpuMapAllowed_DISPATCH(pMemory, pGpu)
142 #define virtmemControl_Epilogue(pResource, pCallContext, pParams) virtmemControl_Epilogue_DISPATCH(pResource, pCallContext, pParams)
143 #define virtmemControl(pMemory, pCallContext, pParams) virtmemControl_DISPATCH(pMemory, pCallContext, pParams)
144 #define virtmemUnmap(pMemory, pCallContext, pCpuMapping) virtmemUnmap_DISPATCH(pMemory, pCallContext, pCpuMapping)
145 #define virtmemGetMemInterMapParams(pMemory, pParams) virtmemGetMemInterMapParams_DISPATCH(pMemory, pParams)
146 #define virtmemGetMemoryMappingDescriptor(pMemory, ppMemDesc) virtmemGetMemoryMappingDescriptor_DISPATCH(pMemory, ppMemDesc)
147 #define virtmemControlFilter(pResource, pCallContext, pParams) virtmemControlFilter_DISPATCH(pResource, pCallContext, pParams)
148 #define virtmemControlSerialization_Prologue(pResource, pCallContext, pParams) virtmemControlSerialization_Prologue_DISPATCH(pResource, pCallContext, pParams)
149 #define virtmemCanCopy(pStandardMemory) virtmemCanCopy_DISPATCH(pStandardMemory)
150 #define virtmemIsReady(pMemory, bCopyConstructorContext) virtmemIsReady_DISPATCH(pMemory, bCopyConstructorContext)
151 #define virtmemCheckCopyPermissions(pMemory, pDstGpu, pDstDevice) virtmemCheckCopyPermissions_DISPATCH(pMemory, pDstGpu, pDstDevice)
152 #define virtmemPreDestruct(pResource) virtmemPreDestruct_DISPATCH(pResource)
153 #define virtmemIsDuplicate(pMemory, hMemory, pDuplicate) virtmemIsDuplicate_DISPATCH(pMemory, hMemory, pDuplicate)
154 #define virtmemControlSerialization_Epilogue(pResource, pCallContext, pParams) virtmemControlSerialization_Epilogue_DISPATCH(pResource, pCallContext, pParams)
155 #define virtmemMap(pMemory, pCallContext, pParams, pCpuMapping) virtmemMap_DISPATCH(pMemory, pCallContext, pParams, pCpuMapping)
156 #define virtmemAccessCallback(pResource, pInvokingClient, pAllocParams, accessRight) virtmemAccessCallback_DISPATCH(pResource, pInvokingClient, pAllocParams, accessRight)
157 NV_STATUS virtmemMapTo_IMPL(struct VirtualMemory *pVirtualMemory, struct RS_RES_MAP_TO_PARAMS *pParams);
158 
virtmemMapTo_DISPATCH(struct VirtualMemory * pVirtualMemory,struct RS_RES_MAP_TO_PARAMS * pParams)159 static inline NV_STATUS virtmemMapTo_DISPATCH(struct VirtualMemory *pVirtualMemory, struct RS_RES_MAP_TO_PARAMS *pParams) {
160     return pVirtualMemory->__virtmemMapTo__(pVirtualMemory, pParams);
161 }
162 
163 NV_STATUS virtmemUnmapFrom_IMPL(struct VirtualMemory *pVirtualMemory, struct RS_RES_UNMAP_FROM_PARAMS *pParams);
164 
virtmemUnmapFrom_DISPATCH(struct VirtualMemory * pVirtualMemory,struct RS_RES_UNMAP_FROM_PARAMS * pParams)165 static inline NV_STATUS virtmemUnmapFrom_DISPATCH(struct VirtualMemory *pVirtualMemory, struct RS_RES_UNMAP_FROM_PARAMS *pParams) {
166     return pVirtualMemory->__virtmemUnmapFrom__(pVirtualMemory, pParams);
167 }
168 
virtmemIsPartialUnmapSupported_0c883b(struct VirtualMemory * pVirtualMemory)169 static inline NvBool virtmemIsPartialUnmapSupported_0c883b(struct VirtualMemory *pVirtualMemory) {
170     return ((NvBool)(0 == 0));
171 }
172 
virtmemIsPartialUnmapSupported_DISPATCH(struct VirtualMemory * pVirtualMemory)173 static inline NvBool virtmemIsPartialUnmapSupported_DISPATCH(struct VirtualMemory *pVirtualMemory) {
174     return pVirtualMemory->__virtmemIsPartialUnmapSupported__(pVirtualMemory);
175 }
176 
virtmemCheckMemInterUnmap_DISPATCH(struct VirtualMemory * pMemory,NvBool bSubdeviceHandleProvided)177 static inline NV_STATUS virtmemCheckMemInterUnmap_DISPATCH(struct VirtualMemory *pMemory, NvBool bSubdeviceHandleProvided) {
178     return pMemory->__virtmemCheckMemInterUnmap__(pMemory, bSubdeviceHandleProvided);
179 }
180 
virtmemShareCallback_DISPATCH(struct VirtualMemory * pResource,struct RsClient * pInvokingClient,struct RsResourceRef * pParentRef,RS_SHARE_POLICY * pSharePolicy)181 static inline NvBool virtmemShareCallback_DISPATCH(struct VirtualMemory *pResource, struct RsClient *pInvokingClient, struct RsResourceRef *pParentRef, RS_SHARE_POLICY *pSharePolicy) {
182     return pResource->__virtmemShareCallback__(pResource, pInvokingClient, pParentRef, pSharePolicy);
183 }
184 
virtmemGetMapAddrSpace_DISPATCH(struct VirtualMemory * pMemory,CALL_CONTEXT * pCallContext,NvU32 mapFlags,NV_ADDRESS_SPACE * pAddrSpace)185 static inline NV_STATUS virtmemGetMapAddrSpace_DISPATCH(struct VirtualMemory *pMemory, CALL_CONTEXT *pCallContext, NvU32 mapFlags, NV_ADDRESS_SPACE *pAddrSpace) {
186     return pMemory->__virtmemGetMapAddrSpace__(pMemory, pCallContext, mapFlags, pAddrSpace);
187 }
188 
virtmemIsExportAllowed_DISPATCH(struct VirtualMemory * pMemory)189 static inline NvBool virtmemIsExportAllowed_DISPATCH(struct VirtualMemory *pMemory) {
190     return pMemory->__virtmemIsExportAllowed__(pMemory);
191 }
192 
virtmemGetRefCount_DISPATCH(struct VirtualMemory * pResource)193 static inline NvU32 virtmemGetRefCount_DISPATCH(struct VirtualMemory *pResource) {
194     return pResource->__virtmemGetRefCount__(pResource);
195 }
196 
virtmemAddAdditionalDependants_DISPATCH(struct RsClient * pClient,struct VirtualMemory * pResource,RsResourceRef * pReference)197 static inline void virtmemAddAdditionalDependants_DISPATCH(struct RsClient *pClient, struct VirtualMemory *pResource, RsResourceRef *pReference) {
198     pResource->__virtmemAddAdditionalDependants__(pClient, pResource, pReference);
199 }
200 
virtmemControl_Prologue_DISPATCH(struct VirtualMemory * pResource,CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)201 static inline NV_STATUS virtmemControl_Prologue_DISPATCH(struct VirtualMemory *pResource, CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
202     return pResource->__virtmemControl_Prologue__(pResource, pCallContext, pParams);
203 }
204 
virtmemIsGpuMapAllowed_DISPATCH(struct VirtualMemory * pMemory,struct OBJGPU * pGpu)205 static inline NvBool virtmemIsGpuMapAllowed_DISPATCH(struct VirtualMemory *pMemory, struct OBJGPU *pGpu) {
206     return pMemory->__virtmemIsGpuMapAllowed__(pMemory, pGpu);
207 }
208 
virtmemControl_Epilogue_DISPATCH(struct VirtualMemory * pResource,CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)209 static inline void virtmemControl_Epilogue_DISPATCH(struct VirtualMemory *pResource, CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
210     pResource->__virtmemControl_Epilogue__(pResource, pCallContext, pParams);
211 }
212 
virtmemControl_DISPATCH(struct VirtualMemory * pMemory,CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)213 static inline NV_STATUS virtmemControl_DISPATCH(struct VirtualMemory *pMemory, CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
214     return pMemory->__virtmemControl__(pMemory, pCallContext, pParams);
215 }
216 
virtmemUnmap_DISPATCH(struct VirtualMemory * pMemory,CALL_CONTEXT * pCallContext,RsCpuMapping * pCpuMapping)217 static inline NV_STATUS virtmemUnmap_DISPATCH(struct VirtualMemory *pMemory, CALL_CONTEXT *pCallContext, RsCpuMapping *pCpuMapping) {
218     return pMemory->__virtmemUnmap__(pMemory, pCallContext, pCpuMapping);
219 }
220 
virtmemGetMemInterMapParams_DISPATCH(struct VirtualMemory * pMemory,RMRES_MEM_INTER_MAP_PARAMS * pParams)221 static inline NV_STATUS virtmemGetMemInterMapParams_DISPATCH(struct VirtualMemory *pMemory, RMRES_MEM_INTER_MAP_PARAMS *pParams) {
222     return pMemory->__virtmemGetMemInterMapParams__(pMemory, pParams);
223 }
224 
virtmemGetMemoryMappingDescriptor_DISPATCH(struct VirtualMemory * pMemory,MEMORY_DESCRIPTOR ** ppMemDesc)225 static inline NV_STATUS virtmemGetMemoryMappingDescriptor_DISPATCH(struct VirtualMemory *pMemory, MEMORY_DESCRIPTOR **ppMemDesc) {
226     return pMemory->__virtmemGetMemoryMappingDescriptor__(pMemory, ppMemDesc);
227 }
228 
virtmemControlFilter_DISPATCH(struct VirtualMemory * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)229 static inline NV_STATUS virtmemControlFilter_DISPATCH(struct VirtualMemory *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
230     return pResource->__virtmemControlFilter__(pResource, pCallContext, pParams);
231 }
232 
virtmemControlSerialization_Prologue_DISPATCH(struct VirtualMemory * pResource,CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)233 static inline NV_STATUS virtmemControlSerialization_Prologue_DISPATCH(struct VirtualMemory *pResource, CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
234     return pResource->__virtmemControlSerialization_Prologue__(pResource, pCallContext, pParams);
235 }
236 
virtmemCanCopy_DISPATCH(struct VirtualMemory * pStandardMemory)237 static inline NvBool virtmemCanCopy_DISPATCH(struct VirtualMemory *pStandardMemory) {
238     return pStandardMemory->__virtmemCanCopy__(pStandardMemory);
239 }
240 
virtmemIsReady_DISPATCH(struct VirtualMemory * pMemory,NvBool bCopyConstructorContext)241 static inline NV_STATUS virtmemIsReady_DISPATCH(struct VirtualMemory *pMemory, NvBool bCopyConstructorContext) {
242     return pMemory->__virtmemIsReady__(pMemory, bCopyConstructorContext);
243 }
244 
virtmemCheckCopyPermissions_DISPATCH(struct VirtualMemory * pMemory,struct OBJGPU * pDstGpu,struct Device * pDstDevice)245 static inline NV_STATUS virtmemCheckCopyPermissions_DISPATCH(struct VirtualMemory *pMemory, struct OBJGPU *pDstGpu, struct Device *pDstDevice) {
246     return pMemory->__virtmemCheckCopyPermissions__(pMemory, pDstGpu, pDstDevice);
247 }
248 
virtmemPreDestruct_DISPATCH(struct VirtualMemory * pResource)249 static inline void virtmemPreDestruct_DISPATCH(struct VirtualMemory *pResource) {
250     pResource->__virtmemPreDestruct__(pResource);
251 }
252 
virtmemIsDuplicate_DISPATCH(struct VirtualMemory * pMemory,NvHandle hMemory,NvBool * pDuplicate)253 static inline NV_STATUS virtmemIsDuplicate_DISPATCH(struct VirtualMemory *pMemory, NvHandle hMemory, NvBool *pDuplicate) {
254     return pMemory->__virtmemIsDuplicate__(pMemory, hMemory, pDuplicate);
255 }
256 
virtmemControlSerialization_Epilogue_DISPATCH(struct VirtualMemory * pResource,CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)257 static inline void virtmemControlSerialization_Epilogue_DISPATCH(struct VirtualMemory *pResource, CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
258     pResource->__virtmemControlSerialization_Epilogue__(pResource, pCallContext, pParams);
259 }
260 
virtmemMap_DISPATCH(struct VirtualMemory * pMemory,CALL_CONTEXT * pCallContext,struct RS_CPU_MAP_PARAMS * pParams,RsCpuMapping * pCpuMapping)261 static inline NV_STATUS virtmemMap_DISPATCH(struct VirtualMemory *pMemory, CALL_CONTEXT *pCallContext, struct RS_CPU_MAP_PARAMS *pParams, RsCpuMapping *pCpuMapping) {
262     return pMemory->__virtmemMap__(pMemory, pCallContext, pParams, pCpuMapping);
263 }
264 
virtmemAccessCallback_DISPATCH(struct VirtualMemory * pResource,struct RsClient * pInvokingClient,void * pAllocParams,RsAccessRight accessRight)265 static inline NvBool virtmemAccessCallback_DISPATCH(struct VirtualMemory *pResource, struct RsClient *pInvokingClient, void *pAllocParams, RsAccessRight accessRight) {
266     return pResource->__virtmemAccessCallback__(pResource, pInvokingClient, pAllocParams, accessRight);
267 }
268 
269 NV_STATUS virtmemConstruct_IMPL(struct VirtualMemory *arg_pVirtualMemory, CALL_CONTEXT *arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL *arg_pParams);
270 
271 #define __nvoc_virtmemConstruct(arg_pVirtualMemory, arg_pCallContext, arg_pParams) virtmemConstruct_IMPL(arg_pVirtualMemory, arg_pCallContext, arg_pParams)
272 void virtmemDestruct_IMPL(struct VirtualMemory *pVirtualMemory);
273 
274 #define __nvoc_virtmemDestruct(pVirtualMemory) virtmemDestruct_IMPL(pVirtualMemory)
275 NV_STATUS virtmemReserveMempool_IMPL(struct VirtualMemory *pVirtualMemory, struct OBJGPU *arg0, struct Device *pDevice, NvU64 size, NvU64 pageSizeMask);
276 
277 #ifdef __nvoc_virtual_mem_h_disabled
virtmemReserveMempool(struct VirtualMemory * pVirtualMemory,struct OBJGPU * arg0,struct Device * pDevice,NvU64 size,NvU64 pageSizeMask)278 static inline NV_STATUS virtmemReserveMempool(struct VirtualMemory *pVirtualMemory, struct OBJGPU *arg0, struct Device *pDevice, NvU64 size, NvU64 pageSizeMask) {
279     NV_ASSERT_FAILED_PRECOMP("VirtualMemory was disabled!");
280     return NV_ERR_NOT_SUPPORTED;
281 }
282 #else //__nvoc_virtual_mem_h_disabled
283 #define virtmemReserveMempool(pVirtualMemory, arg0, pDevice, size, pageSizeMask) virtmemReserveMempool_IMPL(pVirtualMemory, arg0, pDevice, size, pageSizeMask)
284 #endif //__nvoc_virtual_mem_h_disabled
285 
286 NvBool virtmemMatchesVASpace_IMPL(struct VirtualMemory *pVirtualMemory, NvHandle hClient, NvHandle hVASpace);
287 
288 #ifdef __nvoc_virtual_mem_h_disabled
virtmemMatchesVASpace(struct VirtualMemory * pVirtualMemory,NvHandle hClient,NvHandle hVASpace)289 static inline NvBool virtmemMatchesVASpace(struct VirtualMemory *pVirtualMemory, NvHandle hClient, NvHandle hVASpace) {
290     NV_ASSERT_FAILED_PRECOMP("VirtualMemory was disabled!");
291     return NV_FALSE;
292 }
293 #else //__nvoc_virtual_mem_h_disabled
294 #define virtmemMatchesVASpace(pVirtualMemory, hClient, hVASpace) virtmemMatchesVASpace_IMPL(pVirtualMemory, hClient, hVASpace)
295 #endif //__nvoc_virtual_mem_h_disabled
296 
297 NV_STATUS virtmemGetByHandleAndDevice_IMPL(struct RsClient *pClient, NvHandle hMemory, NvHandle hDevice, struct VirtualMemory **ppVirtualMemory);
298 
299 #define virtmemGetByHandleAndDevice(pClient, hMemory, hDevice, ppVirtualMemory) virtmemGetByHandleAndDevice_IMPL(pClient, hMemory, hDevice, ppVirtualMemory)
300 void virtmemGetAddressAndSize_IMPL(struct VirtualMemory *arg0, NvU64 *pVAddr, NvU64 *pSize);
301 
302 #define virtmemGetAddressAndSize(arg0, pVAddr, pSize) virtmemGetAddressAndSize_IMPL(arg0, pVAddr, pSize)
303 #undef PRIVATE_FIELD
304 
305 
306 NV_STATUS virtmemAllocResources(OBJGPU *pGpu, struct MemoryManager *pMemoryManager, MEMORY_ALLOCATION_REQUEST *pAllocRequest,
307                                 FB_ALLOC_INFO *pFbAllocInfo);
308 
309 #endif
310 
311 #ifdef __cplusplus
312 } // extern "C"
313 #endif
314 
315 #endif // _G_VIRTUAL_MEM_NVOC_H_
316