1
2 #ifndef _G_THIRD_PARTY_P2P_NVOC_H_
3 #define _G_THIRD_PARTY_P2P_NVOC_H_
4 #include "nvoc/runtime.h"
5
6 // Version of generated metadata structures
7 #ifdef NVOC_METADATA_VERSION
8 #undef NVOC_METADATA_VERSION
9 #endif
10 #define NVOC_METADATA_VERSION 0
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 /*
17 * SPDX-FileCopyrightText: Copyright (c) 2009-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
18 * SPDX-License-Identifier: MIT
19 *
20 * Permission is hereby granted, free of charge, to any person obtaining a
21 * copy of this software and associated documentation files (the "Software"),
22 * to deal in the Software without restriction, including without limitation
23 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
24 * and/or sell copies of the Software, and to permit persons to whom the
25 * Software is furnished to do so, subject to the following conditions:
26 *
27 * The above copyright notice and this permission notice shall be included in
28 * all copies or substantial portions of the Software.
29 *
30 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
33 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
35 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
36 * DEALINGS IN THE SOFTWARE.
37 */
38
39 #pragma once
40 #include "g_third_party_p2p_nvoc.h"
41
42 #ifndef _THIRD_PARTY_P2P_H_
43 #define _THIRD_PARTY_P2P_H_
44
45 #include "rmapi/client.h"
46 #include "gpu/mem_mgr/mem_desc.h"
47 #include "gpu/gpu_resource.h"
48
49 #include <ctrl/ctrl503c.h>
50
51
52 struct Subdevice;
53
54 #ifndef __NVOC_CLASS_Subdevice_TYPEDEF__
55 #define __NVOC_CLASS_Subdevice_TYPEDEF__
56 typedef struct Subdevice Subdevice;
57 #endif /* __NVOC_CLASS_Subdevice_TYPEDEF__ */
58
59 #ifndef __nvoc_class_id_Subdevice
60 #define __nvoc_class_id_Subdevice 0x4b01b3
61 #endif /* __nvoc_class_id_Subdevice */
62
63
64
65 struct Memory;
66
67 #ifndef __NVOC_CLASS_Memory_TYPEDEF__
68 #define __NVOC_CLASS_Memory_TYPEDEF__
69 typedef struct Memory Memory;
70 #endif /* __NVOC_CLASS_Memory_TYPEDEF__ */
71
72 #ifndef __nvoc_class_id_Memory
73 #define __nvoc_class_id_Memory 0x4789f2
74 #endif /* __nvoc_class_id_Memory */
75
76
77
78 #define CLI_THIRD_PARTY_P2P_FLAGS_INITIALIZED NVBIT(0)
79
80 #define CLI_THIRD_PARTY_P2P_MAX_CLIENT 256
81
82 //
83 // CUDA tools has requested that the third-party P2P code reserve at least
84 // 32MB of BAR1 address space for RM clients. Pad this reservation by
85 // 4MB to account for miscellaneous RM mappings.
86 //
87 #define CLI_THIRD_PARTY_P2P_BAR1_RESERVE (36 << 20)
88
89 // ****************************************************************************
90 // Type definitions
91 // ****************************************************************************
92
93 //
94 // third-party p2p support types
95 //
96 struct _def_client_third_party_p2p_vaspace_info
97 {
98 NvHandle hClient;
99 NvHandle hThirdPartyP2P;
100 NvHandle hVASpace;
101 NvU32 vaSpaceToken;
102 };
103 typedef struct _def_client_third_party_p2p_vaspace_info CLI_THIRD_PARTY_P2P_VASPACE_INFO, *PCLI_THIRD_PARTY_P2P_VASPACE_INFO;
104
105 MAKE_MAP(CLI_THIRD_PARTY_P2P_VASPACE_INFO_MAP, CLI_THIRD_PARTY_P2P_VASPACE_INFO);
106
107 typedef void (THIRD_PARTY_P2P_VIDMEM_FREE_CALLBACK)(void *);
108
109 struct _def_client_third_party_p2p_mapping_info
110 {
111 NODE Node;
112 THIRD_PARTY_P2P_VIDMEM_FREE_CALLBACK *pFreeCallback;
113 void *pData;
114
115 // Address and length describe a subrange of the parent vidmem info address range
116 NvU64 address;
117 NvU64 length;
118
119 struct _def_client_third_party_p2p_mapping_extent_info *pStart;
120 };
121 typedef struct _def_client_third_party_p2p_mapping_info CLI_THIRD_PARTY_P2P_MAPPING_INFO, *PCLI_THIRD_PARTY_P2P_MAPPING_INFO;
122
123 struct _def_client_third_party_p2p_mapping_extent_info
124 {
125 // Address and length describe a subrange of the parent vidmem info address range
126 NvU64 address;
127 NvU64 length;
128
129 NvU64 fbApertureOffset;
130 PMEMORY_DESCRIPTOR pMemDesc;
131 NvU32 refCount;
132 ListNode listNode; // Node in the list.
133 };
134 typedef struct _def_client_third_party_p2p_mapping_extent_info CLI_THIRD_PARTY_P2P_MAPPING_EXTENT_INFO, *PCLI_THIRD_PARTY_P2P_MAPPING_EXTENT_INFO;
135
136 MAKE_INTRUSIVE_LIST(CLI_THIRD_PARTY_P2P_MAPPING_EXTENT_INFO_LIST, CLI_THIRD_PARTY_P2P_MAPPING_EXTENT_INFO, listNode);
137
138 struct _def_client_third_party_p2p_vidmem_info
139 {
140 NvHandle hClient;
141 NvHandle hThirdPartyP2P;
142 NvHandle hMemory;
143
144 //
145 // A node in the PCLI_THIRD_PARTY_P2P_INFO::pAddressRangeTree btree tracking
146 // the address range registered for this vidmem allocation.
147 //
148 // Notably the address ranges come from the user and are not enforced to
149 // be mapped in any GPU VA space. It's up to the user to pick them and they
150 // are used purely for exposing the registered vidmem allocations through
151 // the third-party P2P APIs at the specified ranges. See documentation of
152 // NV503C_CTRL_CMD_REGISTER_VIDMEM for more details.
153 //
154 // Commonly clients will map the allocation at the same address as it's
155 // registered with for third-party P2P and the third-party P2P APIs still
156 // call the address parameter a virtual address, but the implementation
157 // refers to them just as addresses to make it clear they are not enforced
158 // to be actually mapped.
159 //
160 // Notably in the past the addresses have been indeed looked up in the GPU
161 // VA spaces directly, but that became challenging with the introduction of
162 // externally managed VA spaces and now it's up to the clients to register
163 // them explicitly.
164 //
165 NODE addressRangeNode;
166 MapNode mapNode;
167 // Offset at which the address range starts in the vidmem allocation.
168 NvU64 offset;
169
170 // VidmemInfo ID used for persistent mappings
171 NvU64 id;
172
173 PMEMORY_DESCRIPTOR pMemDesc;
174 PNODE pMappingInfoList;
175 CLI_THIRD_PARTY_P2P_MAPPING_EXTENT_INFO_LIST mappingExtentList;
176 };
177 typedef struct _def_client_third_party_p2p_vidmem_info CLI_THIRD_PARTY_P2P_VIDMEM_INFO, *PCLI_THIRD_PARTY_P2P_VIDMEM_INFO;
178
179 MAKE_INTRUSIVE_MAP(CLI_THIRD_PARTY_P2P_VIDMEM_INFO_MAP, CLI_THIRD_PARTY_P2P_VIDMEM_INFO, mapNode);
180
181 typedef void (THIRD_PARTY_P2P_DESTROY_CALLBACK)(void *);
182
183 enum _def_client_third_party_p2p_type
184 {
185 CLI_THIRD_PARTY_P2P_TYPE_PROPRIETARY,
186 CLI_THIRD_PARTY_P2P_TYPE_BAR1,
187 CLI_THIRD_PARTY_P2P_TYPE_NVLINK
188 };
189 typedef enum _def_client_third_party_p2p_type CLI_THIRD_PARTY_P2P_TYPE;
190
191 struct _def_client_third_party_p2p_pid_client_mapping_info
192 {
193 NvU32 pid;
194 NvHandle hClient;
195 };
196 typedef struct _def_client_third_party_p2p_pid_client_mapping_info CLI_THIRD_PARTY_P2P_PID_CLIENT_INFO, *PCLI_THIRD_PARTY_P2P_PID_CLIENT_INFO;
197
198
199 struct ThirdPartyP2P;
200
201 #ifndef __NVOC_CLASS_ThirdPartyP2P_TYPEDEF__
202 #define __NVOC_CLASS_ThirdPartyP2P_TYPEDEF__
203 typedef struct ThirdPartyP2P ThirdPartyP2P;
204 #endif /* __NVOC_CLASS_ThirdPartyP2P_TYPEDEF__ */
205
206 #ifndef __nvoc_class_id_ThirdPartyP2P
207 #define __nvoc_class_id_ThirdPartyP2P 0x34d08b
208 #endif /* __nvoc_class_id_ThirdPartyP2P */
209
210
211
212 // Private field names are wrapped in PRIVATE_FIELD, which does nothing for
213 // the matching C source file, but causes diagnostics to be issued if another
214 // source file references the field.
215 #ifdef NVOC_THIRD_PARTY_P2P_H_PRIVATE_ACCESS_ALLOWED
216 #define PRIVATE_FIELD(x) x
217 #else
218 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
219 #endif
220
221
222 struct P2PTokenShare {
223
224 // Metadata
225 const struct NVOC_RTTI *__nvoc_rtti;
226
227 // Parent (i.e. superclass or base class) object pointers
228 struct RsShared __nvoc_base_RsShared;
229
230 // Ancestor object pointers for `staticCast` feature
231 struct Object *__nvoc_pbase_Object; // obj super^2
232 struct RsShared *__nvoc_pbase_RsShared; // shr super
233 struct P2PTokenShare *__nvoc_pbase_P2PTokenShare; // shrp2p
234
235 // Data members
236 struct ThirdPartyP2P *pThirdPartyP2P;
237 };
238
239 #ifndef __NVOC_CLASS_P2PTokenShare_TYPEDEF__
240 #define __NVOC_CLASS_P2PTokenShare_TYPEDEF__
241 typedef struct P2PTokenShare P2PTokenShare;
242 #endif /* __NVOC_CLASS_P2PTokenShare_TYPEDEF__ */
243
244 #ifndef __nvoc_class_id_P2PTokenShare
245 #define __nvoc_class_id_P2PTokenShare 0x3e3a6a
246 #endif /* __nvoc_class_id_P2PTokenShare */
247
248 // Casting support
249 extern const struct NVOC_CLASS_DEF __nvoc_class_def_P2PTokenShare;
250
251 #define __staticCast_P2PTokenShare(pThis) \
252 ((pThis)->__nvoc_pbase_P2PTokenShare)
253
254 #ifdef __nvoc_third_party_p2p_h_disabled
255 #define __dynamicCast_P2PTokenShare(pThis) ((P2PTokenShare*)NULL)
256 #else //__nvoc_third_party_p2p_h_disabled
257 #define __dynamicCast_P2PTokenShare(pThis) \
258 ((P2PTokenShare*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(P2PTokenShare)))
259 #endif //__nvoc_third_party_p2p_h_disabled
260
261 NV_STATUS __nvoc_objCreateDynamic_P2PTokenShare(P2PTokenShare**, Dynamic*, NvU32, va_list);
262
263 NV_STATUS __nvoc_objCreate_P2PTokenShare(P2PTokenShare**, Dynamic*, NvU32);
264 #define __objCreate_P2PTokenShare(ppNewObj, pParent, createFlags) \
265 __nvoc_objCreate_P2PTokenShare((ppNewObj), staticCast((pParent), Dynamic), (createFlags))
266
267
268 // Wrapper macros
269
270 // Dispatch functions
271 NV_STATUS shrp2pConstruct_IMPL(struct P2PTokenShare *arg_pP2PTokenShare);
272
273 #define __nvoc_shrp2pConstruct(arg_pP2PTokenShare) shrp2pConstruct_IMPL(arg_pP2PTokenShare)
274 void shrp2pDestruct_IMPL(struct P2PTokenShare *pP2PTokenShare);
275
276 #define __nvoc_shrp2pDestruct(pP2PTokenShare) shrp2pDestruct_IMPL(pP2PTokenShare)
277 #undef PRIVATE_FIELD
278
279
280
281 // Private field names are wrapped in PRIVATE_FIELD, which does nothing for
282 // the matching C source file, but causes diagnostics to be issued if another
283 // source file references the field.
284 #ifdef NVOC_THIRD_PARTY_P2P_H_PRIVATE_ACCESS_ALLOWED
285 #define PRIVATE_FIELD(x) x
286 #else
287 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
288 #endif
289
290
291 struct ThirdPartyP2P {
292
293 // Metadata
294 const struct NVOC_RTTI *__nvoc_rtti;
295
296 // Parent (i.e. superclass or base class) object pointers
297 struct GpuResource __nvoc_base_GpuResource;
298
299 // Ancestor object pointers for `staticCast` feature
300 struct Object *__nvoc_pbase_Object; // obj super^4
301 struct RsResource *__nvoc_pbase_RsResource; // res super^3
302 struct RmResourceCommon *__nvoc_pbase_RmResourceCommon; // rmrescmn super^3
303 struct RmResource *__nvoc_pbase_RmResource; // rmres super^2
304 struct GpuResource *__nvoc_pbase_GpuResource; // gpures super
305 struct ThirdPartyP2P *__nvoc_pbase_ThirdPartyP2P; // thirdpartyp2p
306
307 // Vtable with 30 per-object function pointers
308 NV_STATUS (*__thirdpartyp2pCtrlCmdRegisterVaSpace__)(struct ThirdPartyP2P * /*this*/, NV503C_CTRL_REGISTER_VA_SPACE_PARAMS *); // exported (id=0x503c0102)
309 NV_STATUS (*__thirdpartyp2pCtrlCmdUnregisterVaSpace__)(struct ThirdPartyP2P * /*this*/, NV503C_CTRL_UNREGISTER_VA_SPACE_PARAMS *); // exported (id=0x503c0103)
310 NV_STATUS (*__thirdpartyp2pCtrlCmdRegisterVidmem__)(struct ThirdPartyP2P * /*this*/, NV503C_CTRL_REGISTER_VIDMEM_PARAMS *); // exported (id=0x503c0104)
311 NV_STATUS (*__thirdpartyp2pCtrlCmdUnregisterVidmem__)(struct ThirdPartyP2P * /*this*/, NV503C_CTRL_UNREGISTER_VIDMEM_PARAMS *); // exported (id=0x503c0105)
312 NV_STATUS (*__thirdpartyp2pCtrlCmdRegisterPid__)(struct ThirdPartyP2P * /*this*/, NV503C_CTRL_REGISTER_PID_PARAMS *); // exported (id=0x503c0106)
313 NV_STATUS (*__thirdpartyp2pControl__)(struct ThirdPartyP2P * /*this*/, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *); // virtual inherited (gpures) base (gpures)
314 NV_STATUS (*__thirdpartyp2pMap__)(struct ThirdPartyP2P * /*this*/, struct CALL_CONTEXT *, struct RS_CPU_MAP_PARAMS *, struct RsCpuMapping *); // virtual inherited (gpures) base (gpures)
315 NV_STATUS (*__thirdpartyp2pUnmap__)(struct ThirdPartyP2P * /*this*/, struct CALL_CONTEXT *, struct RsCpuMapping *); // virtual inherited (gpures) base (gpures)
316 NvBool (*__thirdpartyp2pShareCallback__)(struct ThirdPartyP2P * /*this*/, struct RsClient *, struct RsResourceRef *, RS_SHARE_POLICY *); // virtual inherited (gpures) base (gpures)
317 NV_STATUS (*__thirdpartyp2pGetRegBaseOffsetAndSize__)(struct ThirdPartyP2P * /*this*/, struct OBJGPU *, NvU32 *, NvU32 *); // virtual inherited (gpures) base (gpures)
318 NV_STATUS (*__thirdpartyp2pGetMapAddrSpace__)(struct ThirdPartyP2P * /*this*/, struct CALL_CONTEXT *, NvU32, NV_ADDRESS_SPACE *); // virtual inherited (gpures) base (gpures)
319 NV_STATUS (*__thirdpartyp2pInternalControlForward__)(struct ThirdPartyP2P * /*this*/, NvU32, void *, NvU32); // virtual inherited (gpures) base (gpures)
320 NvHandle (*__thirdpartyp2pGetInternalObjectHandle__)(struct ThirdPartyP2P * /*this*/); // virtual inherited (gpures) base (gpures)
321 NvBool (*__thirdpartyp2pAccessCallback__)(struct ThirdPartyP2P * /*this*/, struct RsClient *, void *, RsAccessRight); // virtual inherited (rmres) base (gpures)
322 NV_STATUS (*__thirdpartyp2pGetMemInterMapParams__)(struct ThirdPartyP2P * /*this*/, RMRES_MEM_INTER_MAP_PARAMS *); // virtual inherited (rmres) base (gpures)
323 NV_STATUS (*__thirdpartyp2pCheckMemInterUnmap__)(struct ThirdPartyP2P * /*this*/, NvBool); // virtual inherited (rmres) base (gpures)
324 NV_STATUS (*__thirdpartyp2pGetMemoryMappingDescriptor__)(struct ThirdPartyP2P * /*this*/, struct MEMORY_DESCRIPTOR **); // virtual inherited (rmres) base (gpures)
325 NV_STATUS (*__thirdpartyp2pControlSerialization_Prologue__)(struct ThirdPartyP2P * /*this*/, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *); // virtual inherited (rmres) base (gpures)
326 void (*__thirdpartyp2pControlSerialization_Epilogue__)(struct ThirdPartyP2P * /*this*/, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *); // virtual inherited (rmres) base (gpures)
327 NV_STATUS (*__thirdpartyp2pControl_Prologue__)(struct ThirdPartyP2P * /*this*/, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *); // virtual inherited (rmres) base (gpures)
328 void (*__thirdpartyp2pControl_Epilogue__)(struct ThirdPartyP2P * /*this*/, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *); // virtual inherited (rmres) base (gpures)
329 NvBool (*__thirdpartyp2pCanCopy__)(struct ThirdPartyP2P * /*this*/); // virtual inherited (res) base (gpures)
330 NV_STATUS (*__thirdpartyp2pIsDuplicate__)(struct ThirdPartyP2P * /*this*/, NvHandle, NvBool *); // virtual inherited (res) base (gpures)
331 void (*__thirdpartyp2pPreDestruct__)(struct ThirdPartyP2P * /*this*/); // virtual inherited (res) base (gpures)
332 NV_STATUS (*__thirdpartyp2pControlFilter__)(struct ThirdPartyP2P * /*this*/, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *); // virtual inherited (res) base (gpures)
333 NvBool (*__thirdpartyp2pIsPartialUnmapSupported__)(struct ThirdPartyP2P * /*this*/); // inline virtual inherited (res) base (gpures) body
334 NV_STATUS (*__thirdpartyp2pMapTo__)(struct ThirdPartyP2P * /*this*/, RS_RES_MAP_TO_PARAMS *); // virtual inherited (res) base (gpures)
335 NV_STATUS (*__thirdpartyp2pUnmapFrom__)(struct ThirdPartyP2P * /*this*/, RS_RES_UNMAP_FROM_PARAMS *); // virtual inherited (res) base (gpures)
336 NvU32 (*__thirdpartyp2pGetRefCount__)(struct ThirdPartyP2P * /*this*/); // virtual inherited (res) base (gpures)
337 void (*__thirdpartyp2pAddAdditionalDependants__)(struct RsClient *, struct ThirdPartyP2P * /*this*/, RsResourceRef *); // virtual inherited (res) base (gpures)
338
339 // Data members
340 NODE Node;
341 NvHandle hClient;
342 NvHandle hThirdPartyP2P;
343 CLI_THIRD_PARTY_P2P_TYPE type;
344 struct Subdevice *pSubdevice;
345 NvU32 peerIndex;
346 NvU32 flags;
347 NvU64 p2pToken;
348 CLI_THIRD_PARTY_P2P_PID_CLIENT_INFO pidClientList[256];
349 CLI_THIRD_PARTY_P2P_VASPACE_INFO_MAP vaSpaceInfoMap;
350 THIRD_PARTY_P2P_DESTROY_CALLBACK *pDestroyCallback;
351 void *pData;
352 CLI_THIRD_PARTY_P2P_VIDMEM_INFO_MAP vidmemInfoMap;
353 struct P2PTokenShare *pTokenShare;
354 PNODE pAddressRangeTree;
355 };
356
357 #ifndef __NVOC_CLASS_ThirdPartyP2P_TYPEDEF__
358 #define __NVOC_CLASS_ThirdPartyP2P_TYPEDEF__
359 typedef struct ThirdPartyP2P ThirdPartyP2P;
360 #endif /* __NVOC_CLASS_ThirdPartyP2P_TYPEDEF__ */
361
362 #ifndef __nvoc_class_id_ThirdPartyP2P
363 #define __nvoc_class_id_ThirdPartyP2P 0x34d08b
364 #endif /* __nvoc_class_id_ThirdPartyP2P */
365
366 // Casting support
367 extern const struct NVOC_CLASS_DEF __nvoc_class_def_ThirdPartyP2P;
368
369 #define __staticCast_ThirdPartyP2P(pThis) \
370 ((pThis)->__nvoc_pbase_ThirdPartyP2P)
371
372 #ifdef __nvoc_third_party_p2p_h_disabled
373 #define __dynamicCast_ThirdPartyP2P(pThis) ((ThirdPartyP2P*)NULL)
374 #else //__nvoc_third_party_p2p_h_disabled
375 #define __dynamicCast_ThirdPartyP2P(pThis) \
376 ((ThirdPartyP2P*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(ThirdPartyP2P)))
377 #endif //__nvoc_third_party_p2p_h_disabled
378
379 NV_STATUS __nvoc_objCreateDynamic_ThirdPartyP2P(ThirdPartyP2P**, Dynamic*, NvU32, va_list);
380
381 NV_STATUS __nvoc_objCreate_ThirdPartyP2P(ThirdPartyP2P**, Dynamic*, NvU32, struct CALL_CONTEXT * arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL * arg_pParams);
382 #define __objCreate_ThirdPartyP2P(ppNewObj, pParent, createFlags, arg_pCallContext, arg_pParams) \
383 __nvoc_objCreate_ThirdPartyP2P((ppNewObj), staticCast((pParent), Dynamic), (createFlags), arg_pCallContext, arg_pParams)
384
385
386 // Wrapper macros
387 #define thirdpartyp2pCtrlCmdRegisterVaSpace_FNPTR(pThirdPartyP2P) pThirdPartyP2P->__thirdpartyp2pCtrlCmdRegisterVaSpace__
388 #define thirdpartyp2pCtrlCmdRegisterVaSpace(pThirdPartyP2P, pRegisterVaSpaceParams) thirdpartyp2pCtrlCmdRegisterVaSpace_DISPATCH(pThirdPartyP2P, pRegisterVaSpaceParams)
389 #define thirdpartyp2pCtrlCmdUnregisterVaSpace_FNPTR(pThirdPartyP2P) pThirdPartyP2P->__thirdpartyp2pCtrlCmdUnregisterVaSpace__
390 #define thirdpartyp2pCtrlCmdUnregisterVaSpace(pThirdPartyP2P, pUnregisterVaSpaceParams) thirdpartyp2pCtrlCmdUnregisterVaSpace_DISPATCH(pThirdPartyP2P, pUnregisterVaSpaceParams)
391 #define thirdpartyp2pCtrlCmdRegisterVidmem_FNPTR(pThirdPartyP2P) pThirdPartyP2P->__thirdpartyp2pCtrlCmdRegisterVidmem__
392 #define thirdpartyp2pCtrlCmdRegisterVidmem(pThirdPartyP2P, pRegisterVidmemParams) thirdpartyp2pCtrlCmdRegisterVidmem_DISPATCH(pThirdPartyP2P, pRegisterVidmemParams)
393 #define thirdpartyp2pCtrlCmdUnregisterVidmem_FNPTR(pThirdPartyP2P) pThirdPartyP2P->__thirdpartyp2pCtrlCmdUnregisterVidmem__
394 #define thirdpartyp2pCtrlCmdUnregisterVidmem(pThirdPartyP2P, pUnregisterVidmemParams) thirdpartyp2pCtrlCmdUnregisterVidmem_DISPATCH(pThirdPartyP2P, pUnregisterVidmemParams)
395 #define thirdpartyp2pCtrlCmdRegisterPid_FNPTR(pThirdPartyP2P) pThirdPartyP2P->__thirdpartyp2pCtrlCmdRegisterPid__
396 #define thirdpartyp2pCtrlCmdRegisterPid(pThirdPartyP2P, pParams) thirdpartyp2pCtrlCmdRegisterPid_DISPATCH(pThirdPartyP2P, pParams)
397 #define thirdpartyp2pControl_FNPTR(pGpuResource) pGpuResource->__nvoc_base_GpuResource.__gpuresControl__
398 #define thirdpartyp2pControl(pGpuResource, pCallContext, pParams) thirdpartyp2pControl_DISPATCH(pGpuResource, pCallContext, pParams)
399 #define thirdpartyp2pMap_FNPTR(pGpuResource) pGpuResource->__nvoc_base_GpuResource.__gpuresMap__
400 #define thirdpartyp2pMap(pGpuResource, pCallContext, pParams, pCpuMapping) thirdpartyp2pMap_DISPATCH(pGpuResource, pCallContext, pParams, pCpuMapping)
401 #define thirdpartyp2pUnmap_FNPTR(pGpuResource) pGpuResource->__nvoc_base_GpuResource.__gpuresUnmap__
402 #define thirdpartyp2pUnmap(pGpuResource, pCallContext, pCpuMapping) thirdpartyp2pUnmap_DISPATCH(pGpuResource, pCallContext, pCpuMapping)
403 #define thirdpartyp2pShareCallback_FNPTR(pGpuResource) pGpuResource->__nvoc_base_GpuResource.__gpuresShareCallback__
404 #define thirdpartyp2pShareCallback(pGpuResource, pInvokingClient, pParentRef, pSharePolicy) thirdpartyp2pShareCallback_DISPATCH(pGpuResource, pInvokingClient, pParentRef, pSharePolicy)
405 #define thirdpartyp2pGetRegBaseOffsetAndSize_FNPTR(pGpuResource) pGpuResource->__nvoc_base_GpuResource.__gpuresGetRegBaseOffsetAndSize__
406 #define thirdpartyp2pGetRegBaseOffsetAndSize(pGpuResource, pGpu, pOffset, pSize) thirdpartyp2pGetRegBaseOffsetAndSize_DISPATCH(pGpuResource, pGpu, pOffset, pSize)
407 #define thirdpartyp2pGetMapAddrSpace_FNPTR(pGpuResource) pGpuResource->__nvoc_base_GpuResource.__gpuresGetMapAddrSpace__
408 #define thirdpartyp2pGetMapAddrSpace(pGpuResource, pCallContext, mapFlags, pAddrSpace) thirdpartyp2pGetMapAddrSpace_DISPATCH(pGpuResource, pCallContext, mapFlags, pAddrSpace)
409 #define thirdpartyp2pInternalControlForward_FNPTR(pGpuResource) pGpuResource->__nvoc_base_GpuResource.__gpuresInternalControlForward__
410 #define thirdpartyp2pInternalControlForward(pGpuResource, command, pParams, size) thirdpartyp2pInternalControlForward_DISPATCH(pGpuResource, command, pParams, size)
411 #define thirdpartyp2pGetInternalObjectHandle_FNPTR(pGpuResource) pGpuResource->__nvoc_base_GpuResource.__gpuresGetInternalObjectHandle__
412 #define thirdpartyp2pGetInternalObjectHandle(pGpuResource) thirdpartyp2pGetInternalObjectHandle_DISPATCH(pGpuResource)
413 #define thirdpartyp2pAccessCallback_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__rmresAccessCallback__
414 #define thirdpartyp2pAccessCallback(pResource, pInvokingClient, pAllocParams, accessRight) thirdpartyp2pAccessCallback_DISPATCH(pResource, pInvokingClient, pAllocParams, accessRight)
415 #define thirdpartyp2pGetMemInterMapParams_FNPTR(pRmResource) pRmResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__rmresGetMemInterMapParams__
416 #define thirdpartyp2pGetMemInterMapParams(pRmResource, pParams) thirdpartyp2pGetMemInterMapParams_DISPATCH(pRmResource, pParams)
417 #define thirdpartyp2pCheckMemInterUnmap_FNPTR(pRmResource) pRmResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__rmresCheckMemInterUnmap__
418 #define thirdpartyp2pCheckMemInterUnmap(pRmResource, bSubdeviceHandleProvided) thirdpartyp2pCheckMemInterUnmap_DISPATCH(pRmResource, bSubdeviceHandleProvided)
419 #define thirdpartyp2pGetMemoryMappingDescriptor_FNPTR(pRmResource) pRmResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__rmresGetMemoryMappingDescriptor__
420 #define thirdpartyp2pGetMemoryMappingDescriptor(pRmResource, ppMemDesc) thirdpartyp2pGetMemoryMappingDescriptor_DISPATCH(pRmResource, ppMemDesc)
421 #define thirdpartyp2pControlSerialization_Prologue_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__rmresControlSerialization_Prologue__
422 #define thirdpartyp2pControlSerialization_Prologue(pResource, pCallContext, pParams) thirdpartyp2pControlSerialization_Prologue_DISPATCH(pResource, pCallContext, pParams)
423 #define thirdpartyp2pControlSerialization_Epilogue_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__rmresControlSerialization_Epilogue__
424 #define thirdpartyp2pControlSerialization_Epilogue(pResource, pCallContext, pParams) thirdpartyp2pControlSerialization_Epilogue_DISPATCH(pResource, pCallContext, pParams)
425 #define thirdpartyp2pControl_Prologue_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__rmresControl_Prologue__
426 #define thirdpartyp2pControl_Prologue(pResource, pCallContext, pParams) thirdpartyp2pControl_Prologue_DISPATCH(pResource, pCallContext, pParams)
427 #define thirdpartyp2pControl_Epilogue_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__rmresControl_Epilogue__
428 #define thirdpartyp2pControl_Epilogue(pResource, pCallContext, pParams) thirdpartyp2pControl_Epilogue_DISPATCH(pResource, pCallContext, pParams)
429 #define thirdpartyp2pCanCopy_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__nvoc_base_RsResource.__resCanCopy__
430 #define thirdpartyp2pCanCopy(pResource) thirdpartyp2pCanCopy_DISPATCH(pResource)
431 #define thirdpartyp2pIsDuplicate_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__nvoc_base_RsResource.__resIsDuplicate__
432 #define thirdpartyp2pIsDuplicate(pResource, hMemory, pDuplicate) thirdpartyp2pIsDuplicate_DISPATCH(pResource, hMemory, pDuplicate)
433 #define thirdpartyp2pPreDestruct_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__nvoc_base_RsResource.__resPreDestruct__
434 #define thirdpartyp2pPreDestruct(pResource) thirdpartyp2pPreDestruct_DISPATCH(pResource)
435 #define thirdpartyp2pControlFilter_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__nvoc_base_RsResource.__resControlFilter__
436 #define thirdpartyp2pControlFilter(pResource, pCallContext, pParams) thirdpartyp2pControlFilter_DISPATCH(pResource, pCallContext, pParams)
437 #define thirdpartyp2pIsPartialUnmapSupported_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__nvoc_base_RsResource.__resIsPartialUnmapSupported__
438 #define thirdpartyp2pIsPartialUnmapSupported(pResource) thirdpartyp2pIsPartialUnmapSupported_DISPATCH(pResource)
439 #define thirdpartyp2pMapTo_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__nvoc_base_RsResource.__resMapTo__
440 #define thirdpartyp2pMapTo(pResource, pParams) thirdpartyp2pMapTo_DISPATCH(pResource, pParams)
441 #define thirdpartyp2pUnmapFrom_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__nvoc_base_RsResource.__resUnmapFrom__
442 #define thirdpartyp2pUnmapFrom(pResource, pParams) thirdpartyp2pUnmapFrom_DISPATCH(pResource, pParams)
443 #define thirdpartyp2pGetRefCount_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__nvoc_base_RsResource.__resGetRefCount__
444 #define thirdpartyp2pGetRefCount(pResource) thirdpartyp2pGetRefCount_DISPATCH(pResource)
445 #define thirdpartyp2pAddAdditionalDependants_FNPTR(pResource) pResource->__nvoc_base_GpuResource.__nvoc_base_RmResource.__nvoc_base_RsResource.__resAddAdditionalDependants__
446 #define thirdpartyp2pAddAdditionalDependants(pClient, pResource, pReference) thirdpartyp2pAddAdditionalDependants_DISPATCH(pClient, pResource, pReference)
447
448 // Dispatch functions
thirdpartyp2pCtrlCmdRegisterVaSpace_DISPATCH(struct ThirdPartyP2P * pThirdPartyP2P,NV503C_CTRL_REGISTER_VA_SPACE_PARAMS * pRegisterVaSpaceParams)449 static inline NV_STATUS thirdpartyp2pCtrlCmdRegisterVaSpace_DISPATCH(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_REGISTER_VA_SPACE_PARAMS *pRegisterVaSpaceParams) {
450 return pThirdPartyP2P->__thirdpartyp2pCtrlCmdRegisterVaSpace__(pThirdPartyP2P, pRegisterVaSpaceParams);
451 }
452
thirdpartyp2pCtrlCmdUnregisterVaSpace_DISPATCH(struct ThirdPartyP2P * pThirdPartyP2P,NV503C_CTRL_UNREGISTER_VA_SPACE_PARAMS * pUnregisterVaSpaceParams)453 static inline NV_STATUS thirdpartyp2pCtrlCmdUnregisterVaSpace_DISPATCH(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_UNREGISTER_VA_SPACE_PARAMS *pUnregisterVaSpaceParams) {
454 return pThirdPartyP2P->__thirdpartyp2pCtrlCmdUnregisterVaSpace__(pThirdPartyP2P, pUnregisterVaSpaceParams);
455 }
456
thirdpartyp2pCtrlCmdRegisterVidmem_DISPATCH(struct ThirdPartyP2P * pThirdPartyP2P,NV503C_CTRL_REGISTER_VIDMEM_PARAMS * pRegisterVidmemParams)457 static inline NV_STATUS thirdpartyp2pCtrlCmdRegisterVidmem_DISPATCH(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_REGISTER_VIDMEM_PARAMS *pRegisterVidmemParams) {
458 return pThirdPartyP2P->__thirdpartyp2pCtrlCmdRegisterVidmem__(pThirdPartyP2P, pRegisterVidmemParams);
459 }
460
thirdpartyp2pCtrlCmdUnregisterVidmem_DISPATCH(struct ThirdPartyP2P * pThirdPartyP2P,NV503C_CTRL_UNREGISTER_VIDMEM_PARAMS * pUnregisterVidmemParams)461 static inline NV_STATUS thirdpartyp2pCtrlCmdUnregisterVidmem_DISPATCH(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_UNREGISTER_VIDMEM_PARAMS *pUnregisterVidmemParams) {
462 return pThirdPartyP2P->__thirdpartyp2pCtrlCmdUnregisterVidmem__(pThirdPartyP2P, pUnregisterVidmemParams);
463 }
464
thirdpartyp2pCtrlCmdRegisterPid_DISPATCH(struct ThirdPartyP2P * pThirdPartyP2P,NV503C_CTRL_REGISTER_PID_PARAMS * pParams)465 static inline NV_STATUS thirdpartyp2pCtrlCmdRegisterPid_DISPATCH(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_REGISTER_PID_PARAMS *pParams) {
466 return pThirdPartyP2P->__thirdpartyp2pCtrlCmdRegisterPid__(pThirdPartyP2P, pParams);
467 }
468
thirdpartyp2pControl_DISPATCH(struct ThirdPartyP2P * pGpuResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)469 static inline NV_STATUS thirdpartyp2pControl_DISPATCH(struct ThirdPartyP2P *pGpuResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
470 return pGpuResource->__thirdpartyp2pControl__(pGpuResource, pCallContext, pParams);
471 }
472
thirdpartyp2pMap_DISPATCH(struct ThirdPartyP2P * pGpuResource,struct CALL_CONTEXT * pCallContext,struct RS_CPU_MAP_PARAMS * pParams,struct RsCpuMapping * pCpuMapping)473 static inline NV_STATUS thirdpartyp2pMap_DISPATCH(struct ThirdPartyP2P *pGpuResource, struct CALL_CONTEXT *pCallContext, struct RS_CPU_MAP_PARAMS *pParams, struct RsCpuMapping *pCpuMapping) {
474 return pGpuResource->__thirdpartyp2pMap__(pGpuResource, pCallContext, pParams, pCpuMapping);
475 }
476
thirdpartyp2pUnmap_DISPATCH(struct ThirdPartyP2P * pGpuResource,struct CALL_CONTEXT * pCallContext,struct RsCpuMapping * pCpuMapping)477 static inline NV_STATUS thirdpartyp2pUnmap_DISPATCH(struct ThirdPartyP2P *pGpuResource, struct CALL_CONTEXT *pCallContext, struct RsCpuMapping *pCpuMapping) {
478 return pGpuResource->__thirdpartyp2pUnmap__(pGpuResource, pCallContext, pCpuMapping);
479 }
480
thirdpartyp2pShareCallback_DISPATCH(struct ThirdPartyP2P * pGpuResource,struct RsClient * pInvokingClient,struct RsResourceRef * pParentRef,RS_SHARE_POLICY * pSharePolicy)481 static inline NvBool thirdpartyp2pShareCallback_DISPATCH(struct ThirdPartyP2P *pGpuResource, struct RsClient *pInvokingClient, struct RsResourceRef *pParentRef, RS_SHARE_POLICY *pSharePolicy) {
482 return pGpuResource->__thirdpartyp2pShareCallback__(pGpuResource, pInvokingClient, pParentRef, pSharePolicy);
483 }
484
thirdpartyp2pGetRegBaseOffsetAndSize_DISPATCH(struct ThirdPartyP2P * pGpuResource,struct OBJGPU * pGpu,NvU32 * pOffset,NvU32 * pSize)485 static inline NV_STATUS thirdpartyp2pGetRegBaseOffsetAndSize_DISPATCH(struct ThirdPartyP2P *pGpuResource, struct OBJGPU *pGpu, NvU32 *pOffset, NvU32 *pSize) {
486 return pGpuResource->__thirdpartyp2pGetRegBaseOffsetAndSize__(pGpuResource, pGpu, pOffset, pSize);
487 }
488
thirdpartyp2pGetMapAddrSpace_DISPATCH(struct ThirdPartyP2P * pGpuResource,struct CALL_CONTEXT * pCallContext,NvU32 mapFlags,NV_ADDRESS_SPACE * pAddrSpace)489 static inline NV_STATUS thirdpartyp2pGetMapAddrSpace_DISPATCH(struct ThirdPartyP2P *pGpuResource, struct CALL_CONTEXT *pCallContext, NvU32 mapFlags, NV_ADDRESS_SPACE *pAddrSpace) {
490 return pGpuResource->__thirdpartyp2pGetMapAddrSpace__(pGpuResource, pCallContext, mapFlags, pAddrSpace);
491 }
492
thirdpartyp2pInternalControlForward_DISPATCH(struct ThirdPartyP2P * pGpuResource,NvU32 command,void * pParams,NvU32 size)493 static inline NV_STATUS thirdpartyp2pInternalControlForward_DISPATCH(struct ThirdPartyP2P *pGpuResource, NvU32 command, void *pParams, NvU32 size) {
494 return pGpuResource->__thirdpartyp2pInternalControlForward__(pGpuResource, command, pParams, size);
495 }
496
thirdpartyp2pGetInternalObjectHandle_DISPATCH(struct ThirdPartyP2P * pGpuResource)497 static inline NvHandle thirdpartyp2pGetInternalObjectHandle_DISPATCH(struct ThirdPartyP2P *pGpuResource) {
498 return pGpuResource->__thirdpartyp2pGetInternalObjectHandle__(pGpuResource);
499 }
500
thirdpartyp2pAccessCallback_DISPATCH(struct ThirdPartyP2P * pResource,struct RsClient * pInvokingClient,void * pAllocParams,RsAccessRight accessRight)501 static inline NvBool thirdpartyp2pAccessCallback_DISPATCH(struct ThirdPartyP2P *pResource, struct RsClient *pInvokingClient, void *pAllocParams, RsAccessRight accessRight) {
502 return pResource->__thirdpartyp2pAccessCallback__(pResource, pInvokingClient, pAllocParams, accessRight);
503 }
504
thirdpartyp2pGetMemInterMapParams_DISPATCH(struct ThirdPartyP2P * pRmResource,RMRES_MEM_INTER_MAP_PARAMS * pParams)505 static inline NV_STATUS thirdpartyp2pGetMemInterMapParams_DISPATCH(struct ThirdPartyP2P *pRmResource, RMRES_MEM_INTER_MAP_PARAMS *pParams) {
506 return pRmResource->__thirdpartyp2pGetMemInterMapParams__(pRmResource, pParams);
507 }
508
thirdpartyp2pCheckMemInterUnmap_DISPATCH(struct ThirdPartyP2P * pRmResource,NvBool bSubdeviceHandleProvided)509 static inline NV_STATUS thirdpartyp2pCheckMemInterUnmap_DISPATCH(struct ThirdPartyP2P *pRmResource, NvBool bSubdeviceHandleProvided) {
510 return pRmResource->__thirdpartyp2pCheckMemInterUnmap__(pRmResource, bSubdeviceHandleProvided);
511 }
512
thirdpartyp2pGetMemoryMappingDescriptor_DISPATCH(struct ThirdPartyP2P * pRmResource,struct MEMORY_DESCRIPTOR ** ppMemDesc)513 static inline NV_STATUS thirdpartyp2pGetMemoryMappingDescriptor_DISPATCH(struct ThirdPartyP2P *pRmResource, struct MEMORY_DESCRIPTOR **ppMemDesc) {
514 return pRmResource->__thirdpartyp2pGetMemoryMappingDescriptor__(pRmResource, ppMemDesc);
515 }
516
thirdpartyp2pControlSerialization_Prologue_DISPATCH(struct ThirdPartyP2P * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)517 static inline NV_STATUS thirdpartyp2pControlSerialization_Prologue_DISPATCH(struct ThirdPartyP2P *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
518 return pResource->__thirdpartyp2pControlSerialization_Prologue__(pResource, pCallContext, pParams);
519 }
520
thirdpartyp2pControlSerialization_Epilogue_DISPATCH(struct ThirdPartyP2P * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)521 static inline void thirdpartyp2pControlSerialization_Epilogue_DISPATCH(struct ThirdPartyP2P *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
522 pResource->__thirdpartyp2pControlSerialization_Epilogue__(pResource, pCallContext, pParams);
523 }
524
thirdpartyp2pControl_Prologue_DISPATCH(struct ThirdPartyP2P * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)525 static inline NV_STATUS thirdpartyp2pControl_Prologue_DISPATCH(struct ThirdPartyP2P *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
526 return pResource->__thirdpartyp2pControl_Prologue__(pResource, pCallContext, pParams);
527 }
528
thirdpartyp2pControl_Epilogue_DISPATCH(struct ThirdPartyP2P * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)529 static inline void thirdpartyp2pControl_Epilogue_DISPATCH(struct ThirdPartyP2P *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
530 pResource->__thirdpartyp2pControl_Epilogue__(pResource, pCallContext, pParams);
531 }
532
thirdpartyp2pCanCopy_DISPATCH(struct ThirdPartyP2P * pResource)533 static inline NvBool thirdpartyp2pCanCopy_DISPATCH(struct ThirdPartyP2P *pResource) {
534 return pResource->__thirdpartyp2pCanCopy__(pResource);
535 }
536
thirdpartyp2pIsDuplicate_DISPATCH(struct ThirdPartyP2P * pResource,NvHandle hMemory,NvBool * pDuplicate)537 static inline NV_STATUS thirdpartyp2pIsDuplicate_DISPATCH(struct ThirdPartyP2P *pResource, NvHandle hMemory, NvBool *pDuplicate) {
538 return pResource->__thirdpartyp2pIsDuplicate__(pResource, hMemory, pDuplicate);
539 }
540
thirdpartyp2pPreDestruct_DISPATCH(struct ThirdPartyP2P * pResource)541 static inline void thirdpartyp2pPreDestruct_DISPATCH(struct ThirdPartyP2P *pResource) {
542 pResource->__thirdpartyp2pPreDestruct__(pResource);
543 }
544
thirdpartyp2pControlFilter_DISPATCH(struct ThirdPartyP2P * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)545 static inline NV_STATUS thirdpartyp2pControlFilter_DISPATCH(struct ThirdPartyP2P *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
546 return pResource->__thirdpartyp2pControlFilter__(pResource, pCallContext, pParams);
547 }
548
thirdpartyp2pIsPartialUnmapSupported_DISPATCH(struct ThirdPartyP2P * pResource)549 static inline NvBool thirdpartyp2pIsPartialUnmapSupported_DISPATCH(struct ThirdPartyP2P *pResource) {
550 return pResource->__thirdpartyp2pIsPartialUnmapSupported__(pResource);
551 }
552
thirdpartyp2pMapTo_DISPATCH(struct ThirdPartyP2P * pResource,RS_RES_MAP_TO_PARAMS * pParams)553 static inline NV_STATUS thirdpartyp2pMapTo_DISPATCH(struct ThirdPartyP2P *pResource, RS_RES_MAP_TO_PARAMS *pParams) {
554 return pResource->__thirdpartyp2pMapTo__(pResource, pParams);
555 }
556
thirdpartyp2pUnmapFrom_DISPATCH(struct ThirdPartyP2P * pResource,RS_RES_UNMAP_FROM_PARAMS * pParams)557 static inline NV_STATUS thirdpartyp2pUnmapFrom_DISPATCH(struct ThirdPartyP2P *pResource, RS_RES_UNMAP_FROM_PARAMS *pParams) {
558 return pResource->__thirdpartyp2pUnmapFrom__(pResource, pParams);
559 }
560
thirdpartyp2pGetRefCount_DISPATCH(struct ThirdPartyP2P * pResource)561 static inline NvU32 thirdpartyp2pGetRefCount_DISPATCH(struct ThirdPartyP2P *pResource) {
562 return pResource->__thirdpartyp2pGetRefCount__(pResource);
563 }
564
thirdpartyp2pAddAdditionalDependants_DISPATCH(struct RsClient * pClient,struct ThirdPartyP2P * pResource,RsResourceRef * pReference)565 static inline void thirdpartyp2pAddAdditionalDependants_DISPATCH(struct RsClient *pClient, struct ThirdPartyP2P *pResource, RsResourceRef *pReference) {
566 pResource->__thirdpartyp2pAddAdditionalDependants__(pClient, pResource, pReference);
567 }
568
569 NV_STATUS thirdpartyp2pCtrlCmdRegisterVaSpace_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_REGISTER_VA_SPACE_PARAMS *pRegisterVaSpaceParams);
570
571 NV_STATUS thirdpartyp2pCtrlCmdUnregisterVaSpace_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_UNREGISTER_VA_SPACE_PARAMS *pUnregisterVaSpaceParams);
572
573 NV_STATUS thirdpartyp2pCtrlCmdRegisterVidmem_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_REGISTER_VIDMEM_PARAMS *pRegisterVidmemParams);
574
575 NV_STATUS thirdpartyp2pCtrlCmdUnregisterVidmem_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_UNREGISTER_VIDMEM_PARAMS *pUnregisterVidmemParams);
576
577 NV_STATUS thirdpartyp2pCtrlCmdRegisterPid_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_REGISTER_PID_PARAMS *pParams);
578
579 NV_STATUS thirdpartyp2pConstruct_IMPL(struct ThirdPartyP2P *arg_pResource, struct CALL_CONTEXT *arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL *arg_pParams);
580
581 #define __nvoc_thirdpartyp2pConstruct(arg_pResource, arg_pCallContext, arg_pParams) thirdpartyp2pConstruct_IMPL(arg_pResource, arg_pCallContext, arg_pParams)
582 void thirdpartyp2pDestruct_IMPL(struct ThirdPartyP2P *pResource);
583
584 #define __nvoc_thirdpartyp2pDestruct(pResource) thirdpartyp2pDestruct_IMPL(pResource)
585 NvBool thirdpartyp2pIsValidClientPid_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NvU32 pid, NvHandle hClient);
586
587 #ifdef __nvoc_third_party_p2p_h_disabled
thirdpartyp2pIsValidClientPid(struct ThirdPartyP2P * pThirdPartyP2P,NvU32 pid,NvHandle hClient)588 static inline NvBool thirdpartyp2pIsValidClientPid(struct ThirdPartyP2P *pThirdPartyP2P, NvU32 pid, NvHandle hClient) {
589 NV_ASSERT_FAILED_PRECOMP("ThirdPartyP2P was disabled!");
590 return NV_FALSE;
591 }
592 #else //__nvoc_third_party_p2p_h_disabled
593 #define thirdpartyp2pIsValidClientPid(pThirdPartyP2P, pid, hClient) thirdpartyp2pIsValidClientPid_IMPL(pThirdPartyP2P, pid, hClient)
594 #endif //__nvoc_third_party_p2p_h_disabled
595
596 NV_STATUS thirdpartyp2pDelMappingInfoByKey_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, void *pKey, NvBool bIsRsyncNeeded);
597
598 #ifdef __nvoc_third_party_p2p_h_disabled
thirdpartyp2pDelMappingInfoByKey(struct ThirdPartyP2P * pThirdPartyP2P,void * pKey,NvBool bIsRsyncNeeded)599 static inline NV_STATUS thirdpartyp2pDelMappingInfoByKey(struct ThirdPartyP2P *pThirdPartyP2P, void *pKey, NvBool bIsRsyncNeeded) {
600 NV_ASSERT_FAILED_PRECOMP("ThirdPartyP2P was disabled!");
601 return NV_ERR_NOT_SUPPORTED;
602 }
603 #else //__nvoc_third_party_p2p_h_disabled
604 #define thirdpartyp2pDelMappingInfoByKey(pThirdPartyP2P, pKey, bIsRsyncNeeded) thirdpartyp2pDelMappingInfoByKey_IMPL(pThirdPartyP2P, pKey, bIsRsyncNeeded)
605 #endif //__nvoc_third_party_p2p_h_disabled
606
607 NV_STATUS thirdpartyp2pDelPersistentMappingInfoByKey_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, void *pKey, NvBool bIsRsyncNeeded);
608
609 #ifdef __nvoc_third_party_p2p_h_disabled
thirdpartyp2pDelPersistentMappingInfoByKey(struct ThirdPartyP2P * pThirdPartyP2P,void * pKey,NvBool bIsRsyncNeeded)610 static inline NV_STATUS thirdpartyp2pDelPersistentMappingInfoByKey(struct ThirdPartyP2P *pThirdPartyP2P, void *pKey, NvBool bIsRsyncNeeded) {
611 NV_ASSERT_FAILED_PRECOMP("ThirdPartyP2P was disabled!");
612 return NV_ERR_NOT_SUPPORTED;
613 }
614 #else //__nvoc_third_party_p2p_h_disabled
615 #define thirdpartyp2pDelPersistentMappingInfoByKey(pThirdPartyP2P, pKey, bIsRsyncNeeded) thirdpartyp2pDelPersistentMappingInfoByKey_IMPL(pThirdPartyP2P, pKey, bIsRsyncNeeded)
616 #endif //__nvoc_third_party_p2p_h_disabled
617
618 NV_STATUS thirdpartyp2pGetVASpaceInfoFromToken_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NvU32 vaSpaceToken, PCLI_THIRD_PARTY_P2P_VASPACE_INFO *ppVASpaceInfo);
619
620 #ifdef __nvoc_third_party_p2p_h_disabled
thirdpartyp2pGetVASpaceInfoFromToken(struct ThirdPartyP2P * pThirdPartyP2P,NvU32 vaSpaceToken,PCLI_THIRD_PARTY_P2P_VASPACE_INFO * ppVASpaceInfo)621 static inline NV_STATUS thirdpartyp2pGetVASpaceInfoFromToken(struct ThirdPartyP2P *pThirdPartyP2P, NvU32 vaSpaceToken, PCLI_THIRD_PARTY_P2P_VASPACE_INFO *ppVASpaceInfo) {
622 NV_ASSERT_FAILED_PRECOMP("ThirdPartyP2P was disabled!");
623 return NV_ERR_NOT_SUPPORTED;
624 }
625 #else //__nvoc_third_party_p2p_h_disabled
626 #define thirdpartyp2pGetVASpaceInfoFromToken(pThirdPartyP2P, vaSpaceToken, ppVASpaceInfo) thirdpartyp2pGetVASpaceInfoFromToken_IMPL(pThirdPartyP2P, vaSpaceToken, ppVASpaceInfo)
627 #endif //__nvoc_third_party_p2p_h_disabled
628
629 NV_STATUS thirdpartyp2pGetNextVASpaceInfo_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, PCLI_THIRD_PARTY_P2P_VASPACE_INFO *arg2);
630
631 #ifdef __nvoc_third_party_p2p_h_disabled
thirdpartyp2pGetNextVASpaceInfo(struct ThirdPartyP2P * pThirdPartyP2P,PCLI_THIRD_PARTY_P2P_VASPACE_INFO * arg2)632 static inline NV_STATUS thirdpartyp2pGetNextVASpaceInfo(struct ThirdPartyP2P *pThirdPartyP2P, PCLI_THIRD_PARTY_P2P_VASPACE_INFO *arg2) {
633 NV_ASSERT_FAILED_PRECOMP("ThirdPartyP2P was disabled!");
634 return NV_ERR_NOT_SUPPORTED;
635 }
636 #else //__nvoc_third_party_p2p_h_disabled
637 #define thirdpartyp2pGetNextVASpaceInfo(pThirdPartyP2P, arg2) thirdpartyp2pGetNextVASpaceInfo_IMPL(pThirdPartyP2P, arg2)
638 #endif //__nvoc_third_party_p2p_h_disabled
639
640 #undef PRIVATE_FIELD
641
642
643 typedef struct ThirdPartyP2P *PCLI_THIRD_PARTY_P2P_INFO; // RS-TODO: Remove
644
645 // ****************************************************************************
646 // Functions prototypes
647 // ****************************************************************************
648
649 // Get registered third-party P2P info from pid. Also match the provided client handle if provided.
650 NV_STATUS CliNextThirdPartyP2PInfoWithPid (struct OBJGPU *, NvU32, NvHandle, struct RmClient**, PCLI_THIRD_PARTY_P2P_INFO *);
651
652 // Get third-party P2P info given a P2P token
653 NV_STATUS CliGetThirdPartyP2PInfoFromToken (NvU64, PCLI_THIRD_PARTY_P2P_INFO *);
654
655 // Register an address space with a third-party P2P object
656 NV_STATUS CliAddThirdPartyP2PVASpace (struct ThirdPartyP2P*, NvHandle, NvU32 *);
657
658 // Unregister an address space from a third-party P2P object
659 NV_STATUS CliDelThirdPartyP2PVASpace (struct ThirdPartyP2P*, NvHandle);
660
661 // Register video memory with a third-party P2P object
662 NV_STATUS CliAddThirdPartyP2PVidmemInfo (struct ThirdPartyP2P*, NvHandle, NvU64, NvU64, NvU64, struct Memory *);
663
664 // Unregister video memory from a third-party P2P object
665 NV_STATUS CliDelThirdPartyP2PVidmemInfo (struct ThirdPartyP2P*, NvHandle);
666
667 // Unregister video memory from a third-party P2P object only if the VidmemInfo is not used
668 void CliDelThirdPartyP2PVidmemInfoPersistent (struct ThirdPartyP2P*, CLI_THIRD_PARTY_P2P_VIDMEM_INFO*);
669
670 // Find registered video memory given an address
671 NV_STATUS CliGetThirdPartyP2PVidmemInfoFromAddress (struct ThirdPartyP2P*, NvU64, NvU64, NvU64 *, PCLI_THIRD_PARTY_P2P_VIDMEM_INFO *);
672
673 // Find registered video memory given a VidmemInfo ID
674 NV_STATUS CliGetThirdPartyP2PVidmemInfoFromId(struct ThirdPartyP2P*, NvU64, CLI_THIRD_PARTY_P2P_VIDMEM_INFO **);
675
676 // Find platformData given a P2PInfo object
677 NV_STATUS CliGetThirdPartyP2PPlatformData (PCLI_THIRD_PARTY_P2P_INFO, void *);
678
679 // Associate a P2P mapping with registered video memory
680 NV_STATUS CliAddThirdPartyP2PMappingInfo (struct ThirdPartyP2P*, NvHandle, void *, THIRD_PARTY_P2P_VIDMEM_FREE_CALLBACK *, void *, PCLI_THIRD_PARTY_P2P_MAPPING_INFO *);
681
682 // Find a P2P mapping given its platform specific data
683 NV_STATUS CliGetThirdPartyP2PMappingInfoFromKey (struct ThirdPartyP2P*, NvHandle, void *, PCLI_THIRD_PARTY_P2P_MAPPING_INFO *);
684
685 // Register pid & client with a third-party P2P Info object
686 NV_STATUS CliAddThirdPartyP2PClientPid (NvHandle, NvHandle, NvU32, NvU32);
687
688 // Unregister pid & client from a third-party P2P Info object
689 NV_STATUS CliDelThirdPartyP2PClientPid (struct RmClient*, NvHandle, NvU32, NvU32);
690
691 // Remove association of a client from any existing third-Party P2P Info object
692 NV_STATUS CliUnregisterFromThirdPartyP2P (struct RmClient*);
693
694 // Register a free callback
695 NV_STATUS CliRegisterThirdPartyP2PMappingCallback (struct ThirdPartyP2P*, NvHandle, void *, THIRD_PARTY_P2P_VIDMEM_FREE_CALLBACK *, void *);
696
697 // Unregister memory from a third-party P2P Info object
698 void CliUnregisterMemoryFromThirdPartyP2P(struct Memory *pMemory);
699
700 #endif // _THIRD_PARTY_P2P_H_
701
702 #ifdef __cplusplus
703 } // extern "C"
704 #endif
705
706 #endif // _G_THIRD_PARTY_P2P_NVOC_H_
707