1 #ifndef _G_THIRD_PARTY_P2P_NVOC_H_
2 #define _G_THIRD_PARTY_P2P_NVOC_H_
3 #include "nvoc/runtime.h"
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 /*
10  * SPDX-FileCopyrightText: Copyright (c) 2009-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_third_party_p2p_nvoc.h"
33 
34 #ifndef _THIRD_PARTY_P2P_H_
35 #define _THIRD_PARTY_P2P_H_
36 
37 #include "rmapi/client.h"
38 #include "gpu/mem_mgr/mem_desc.h"
39 #include "gpu/gpu_resource.h"
40 
41 #include <ctrl/ctrl503c.h>
42 
43 struct Subdevice;
44 
45 #ifndef __NVOC_CLASS_Subdevice_TYPEDEF__
46 #define __NVOC_CLASS_Subdevice_TYPEDEF__
47 typedef struct Subdevice Subdevice;
48 #endif /* __NVOC_CLASS_Subdevice_TYPEDEF__ */
49 
50 #ifndef __nvoc_class_id_Subdevice
51 #define __nvoc_class_id_Subdevice 0x4b01b3
52 #endif /* __nvoc_class_id_Subdevice */
53 
54 
55 struct Memory;
56 
57 #ifndef __NVOC_CLASS_Memory_TYPEDEF__
58 #define __NVOC_CLASS_Memory_TYPEDEF__
59 typedef struct Memory Memory;
60 #endif /* __NVOC_CLASS_Memory_TYPEDEF__ */
61 
62 #ifndef __nvoc_class_id_Memory
63 #define __nvoc_class_id_Memory 0x4789f2
64 #endif /* __nvoc_class_id_Memory */
65 
66 
67 
68 #define CLI_THIRD_PARTY_P2P_FLAGS_INITIALIZED   NVBIT(0)
69 
70 #define CLI_THIRD_PARTY_P2P_MAX_CLIENT 256
71 
72 //
73 // CUDA tools has requested that the third-party P2P code reserve at least
74 // 32MB of BAR1 address space for RM clients. Pad this reservation by
75 // 4MB to account for miscellaneous RM mappings.
76 //
77 #define CLI_THIRD_PARTY_P2P_BAR1_RESERVE (36 << 20)
78 
79 // ****************************************************************************
80 //                          Type definitions
81 // ****************************************************************************
82 
83 //
84 // third-party p2p support types
85 //
86 struct _def_client_third_party_p2p_vaspace_info
87 {
88     NvHandle                 hClient;
89     NvHandle                 hThirdPartyP2P;
90     NvHandle                 hVASpace;
91     NvU32                    vaSpaceToken;
92 };
93 typedef struct _def_client_third_party_p2p_vaspace_info CLI_THIRD_PARTY_P2P_VASPACE_INFO, *PCLI_THIRD_PARTY_P2P_VASPACE_INFO;
94 
95 MAKE_MAP(CLI_THIRD_PARTY_P2P_VASPACE_INFO_MAP, CLI_THIRD_PARTY_P2P_VASPACE_INFO);
96 
97 typedef void (THIRD_PARTY_P2P_VIDMEM_FREE_CALLBACK)(void *);
98 
99 struct _def_client_third_party_p2p_mapping_info
100 {
101     NODE                                                     Node;
102     THIRD_PARTY_P2P_VIDMEM_FREE_CALLBACK                    *pFreeCallback;
103     void                                                    *pData;
104 
105     // Address and length describe a subrange of the parent vidmem info address range
106     NvU64                                                    address;
107     NvU64                                                    length;
108 
109     struct _def_client_third_party_p2p_mapping_extent_info  *pStart;
110 };
111 typedef struct _def_client_third_party_p2p_mapping_info CLI_THIRD_PARTY_P2P_MAPPING_INFO, *PCLI_THIRD_PARTY_P2P_MAPPING_INFO;
112 
113 struct _def_client_third_party_p2p_mapping_extent_info
114 {
115     // Address and length describe a subrange of the parent vidmem info address range
116     NvU64                    address;
117     NvU64                    length;
118 
119     NvU64                    fbApertureOffset;
120     PMEMORY_DESCRIPTOR       pMemDesc;
121     NvU32                    refCount;
122     ListNode                 listNode;  // Node in the list.
123 };
124 typedef struct _def_client_third_party_p2p_mapping_extent_info CLI_THIRD_PARTY_P2P_MAPPING_EXTENT_INFO, *PCLI_THIRD_PARTY_P2P_MAPPING_EXTENT_INFO;
125 
126 MAKE_INTRUSIVE_LIST(CLI_THIRD_PARTY_P2P_MAPPING_EXTENT_INFO_LIST, CLI_THIRD_PARTY_P2P_MAPPING_EXTENT_INFO, listNode);
127 
128 struct _def_client_third_party_p2p_vidmem_info
129 {
130     NvHandle                   hClient;
131     NvHandle                   hThirdPartyP2P;
132     NvHandle                   hMemory;
133 
134     //
135     // A node in the PCLI_THIRD_PARTY_P2P_INFO::pAddressRangeTree btree tracking
136     // the address range registered for this vidmem allocation.
137     //
138     // Notably the address ranges come from the user and are not enforced to
139     // be mapped in any GPU VA space. It's up to the user to pick them and they
140     // are used purely for exposing the registered vidmem allocations through
141     // the third-party P2P APIs at the specified ranges. See documentation of
142     // NV503C_CTRL_CMD_REGISTER_VIDMEM for more details.
143     //
144     // Commonly clients will map the allocation at the same address as it's
145     // registered with for third-party P2P and the third-party P2P APIs still
146     // call the address parameter a virtual address, but the implementation
147     // refers to them just as addresses to make it clear they are not enforced
148     // to be actually mapped.
149     //
150     // Notably in the past the addresses have been indeed looked up in the GPU
151     // VA spaces directly, but that became challenging with the introduction of
152     // externally managed VA spaces and now it's up to the clients to register
153     // them explicitly.
154     //
155     NODE                                         addressRangeNode;
156     MapNode                                      mapNode;
157     // Offset at which the address range starts in the vidmem allocation.
158     NvU64                                        offset;
159 
160     // VidmemInfo ID used for persistent mappings
161     NvU64                                        id;
162 
163     PMEMORY_DESCRIPTOR                           pMemDesc;
164     PNODE                                        pMappingInfoList;
165     CLI_THIRD_PARTY_P2P_MAPPING_EXTENT_INFO_LIST mappingExtentList;
166 };
167 typedef struct _def_client_third_party_p2p_vidmem_info  CLI_THIRD_PARTY_P2P_VIDMEM_INFO, *PCLI_THIRD_PARTY_P2P_VIDMEM_INFO;
168 
169 MAKE_INTRUSIVE_MAP(CLI_THIRD_PARTY_P2P_VIDMEM_INFO_MAP, CLI_THIRD_PARTY_P2P_VIDMEM_INFO, mapNode);
170 
171 typedef void (THIRD_PARTY_P2P_DESTROY_CALLBACK)(void *);
172 
173 enum _def_client_third_party_p2p_type
174 {
175     CLI_THIRD_PARTY_P2P_TYPE_PROPRIETARY,
176     CLI_THIRD_PARTY_P2P_TYPE_BAR1,
177     CLI_THIRD_PARTY_P2P_TYPE_NVLINK
178 };
179 typedef enum   _def_client_third_party_p2p_type     CLI_THIRD_PARTY_P2P_TYPE;
180 
181 struct _def_client_third_party_p2p_pid_client_mapping_info
182 {
183     NvU32       pid;
184     NvHandle    hClient;
185 };
186 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;
187 
188 struct ThirdPartyP2P;
189 
190 #ifndef __NVOC_CLASS_ThirdPartyP2P_TYPEDEF__
191 #define __NVOC_CLASS_ThirdPartyP2P_TYPEDEF__
192 typedef struct ThirdPartyP2P ThirdPartyP2P;
193 #endif /* __NVOC_CLASS_ThirdPartyP2P_TYPEDEF__ */
194 
195 #ifndef __nvoc_class_id_ThirdPartyP2P
196 #define __nvoc_class_id_ThirdPartyP2P 0x34d08b
197 #endif /* __nvoc_class_id_ThirdPartyP2P */
198 
199 
200 
201 // Private field names are wrapped in PRIVATE_FIELD, which does nothing for
202 // the matching C source file, but causes diagnostics to be issued if another
203 // source file references the field.
204 #ifdef NVOC_THIRD_PARTY_P2P_H_PRIVATE_ACCESS_ALLOWED
205 #define PRIVATE_FIELD(x) x
206 #else
207 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
208 #endif
209 
210 struct P2PTokenShare {
211     const struct NVOC_RTTI *__nvoc_rtti;
212     struct RsShared __nvoc_base_RsShared;
213     struct Object *__nvoc_pbase_Object;
214     struct RsShared *__nvoc_pbase_RsShared;
215     struct P2PTokenShare *__nvoc_pbase_P2PTokenShare;
216     struct ThirdPartyP2P *pThirdPartyP2P;
217 };
218 
219 #ifndef __NVOC_CLASS_P2PTokenShare_TYPEDEF__
220 #define __NVOC_CLASS_P2PTokenShare_TYPEDEF__
221 typedef struct P2PTokenShare P2PTokenShare;
222 #endif /* __NVOC_CLASS_P2PTokenShare_TYPEDEF__ */
223 
224 #ifndef __nvoc_class_id_P2PTokenShare
225 #define __nvoc_class_id_P2PTokenShare 0x3e3a6a
226 #endif /* __nvoc_class_id_P2PTokenShare */
227 
228 extern const struct NVOC_CLASS_DEF __nvoc_class_def_P2PTokenShare;
229 
230 #define __staticCast_P2PTokenShare(pThis) \
231     ((pThis)->__nvoc_pbase_P2PTokenShare)
232 
233 #ifdef __nvoc_third_party_p2p_h_disabled
234 #define __dynamicCast_P2PTokenShare(pThis) ((P2PTokenShare*)NULL)
235 #else //__nvoc_third_party_p2p_h_disabled
236 #define __dynamicCast_P2PTokenShare(pThis) \
237     ((P2PTokenShare*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(P2PTokenShare)))
238 #endif //__nvoc_third_party_p2p_h_disabled
239 
240 
241 NV_STATUS __nvoc_objCreateDynamic_P2PTokenShare(P2PTokenShare**, Dynamic*, NvU32, va_list);
242 
243 NV_STATUS __nvoc_objCreate_P2PTokenShare(P2PTokenShare**, Dynamic*, NvU32);
244 #define __objCreate_P2PTokenShare(ppNewObj, pParent, createFlags) \
245     __nvoc_objCreate_P2PTokenShare((ppNewObj), staticCast((pParent), Dynamic), (createFlags))
246 
247 NV_STATUS shrp2pConstruct_IMPL(struct P2PTokenShare *arg_pP2PTokenShare);
248 
249 #define __nvoc_shrp2pConstruct(arg_pP2PTokenShare) shrp2pConstruct_IMPL(arg_pP2PTokenShare)
250 void shrp2pDestruct_IMPL(struct P2PTokenShare *pP2PTokenShare);
251 
252 #define __nvoc_shrp2pDestruct(pP2PTokenShare) shrp2pDestruct_IMPL(pP2PTokenShare)
253 #undef PRIVATE_FIELD
254 
255 
256 
257 // Private field names are wrapped in PRIVATE_FIELD, which does nothing for
258 // the matching C source file, but causes diagnostics to be issued if another
259 // source file references the field.
260 #ifdef NVOC_THIRD_PARTY_P2P_H_PRIVATE_ACCESS_ALLOWED
261 #define PRIVATE_FIELD(x) x
262 #else
263 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
264 #endif
265 
266 struct ThirdPartyP2P {
267     const struct NVOC_RTTI *__nvoc_rtti;
268     struct GpuResource __nvoc_base_GpuResource;
269     struct Object *__nvoc_pbase_Object;
270     struct RsResource *__nvoc_pbase_RsResource;
271     struct RmResourceCommon *__nvoc_pbase_RmResourceCommon;
272     struct RmResource *__nvoc_pbase_RmResource;
273     struct GpuResource *__nvoc_pbase_GpuResource;
274     struct ThirdPartyP2P *__nvoc_pbase_ThirdPartyP2P;
275     NV_STATUS (*__thirdpartyp2pCtrlCmdRegisterVaSpace__)(struct ThirdPartyP2P *, NV503C_CTRL_REGISTER_VA_SPACE_PARAMS *);
276     NV_STATUS (*__thirdpartyp2pCtrlCmdUnregisterVaSpace__)(struct ThirdPartyP2P *, NV503C_CTRL_UNREGISTER_VA_SPACE_PARAMS *);
277     NV_STATUS (*__thirdpartyp2pCtrlCmdRegisterVidmem__)(struct ThirdPartyP2P *, NV503C_CTRL_REGISTER_VIDMEM_PARAMS *);
278     NV_STATUS (*__thirdpartyp2pCtrlCmdUnregisterVidmem__)(struct ThirdPartyP2P *, NV503C_CTRL_UNREGISTER_VIDMEM_PARAMS *);
279     NV_STATUS (*__thirdpartyp2pCtrlCmdRegisterPid__)(struct ThirdPartyP2P *, NV503C_CTRL_REGISTER_PID_PARAMS *);
280     NvBool (*__thirdpartyp2pShareCallback__)(struct ThirdPartyP2P *, struct RsClient *, struct RsResourceRef *, RS_SHARE_POLICY *);
281     NV_STATUS (*__thirdpartyp2pCheckMemInterUnmap__)(struct ThirdPartyP2P *, NvBool);
282     NV_STATUS (*__thirdpartyp2pMapTo__)(struct ThirdPartyP2P *, RS_RES_MAP_TO_PARAMS *);
283     NV_STATUS (*__thirdpartyp2pGetMapAddrSpace__)(struct ThirdPartyP2P *, struct CALL_CONTEXT *, NvU32, NV_ADDRESS_SPACE *);
284     NvU32 (*__thirdpartyp2pGetRefCount__)(struct ThirdPartyP2P *);
285     void (*__thirdpartyp2pAddAdditionalDependants__)(struct RsClient *, struct ThirdPartyP2P *, RsResourceRef *);
286     NV_STATUS (*__thirdpartyp2pControl_Prologue__)(struct ThirdPartyP2P *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
287     NV_STATUS (*__thirdpartyp2pGetRegBaseOffsetAndSize__)(struct ThirdPartyP2P *, struct OBJGPU *, NvU32 *, NvU32 *);
288     NV_STATUS (*__thirdpartyp2pInternalControlForward__)(struct ThirdPartyP2P *, NvU32, void *, NvU32);
289     NV_STATUS (*__thirdpartyp2pUnmapFrom__)(struct ThirdPartyP2P *, RS_RES_UNMAP_FROM_PARAMS *);
290     void (*__thirdpartyp2pControl_Epilogue__)(struct ThirdPartyP2P *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
291     NvHandle (*__thirdpartyp2pGetInternalObjectHandle__)(struct ThirdPartyP2P *);
292     NV_STATUS (*__thirdpartyp2pControl__)(struct ThirdPartyP2P *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
293     NV_STATUS (*__thirdpartyp2pUnmap__)(struct ThirdPartyP2P *, struct CALL_CONTEXT *, struct RsCpuMapping *);
294     NV_STATUS (*__thirdpartyp2pGetMemInterMapParams__)(struct ThirdPartyP2P *, RMRES_MEM_INTER_MAP_PARAMS *);
295     NV_STATUS (*__thirdpartyp2pGetMemoryMappingDescriptor__)(struct ThirdPartyP2P *, struct MEMORY_DESCRIPTOR **);
296     NV_STATUS (*__thirdpartyp2pControlFilter__)(struct ThirdPartyP2P *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
297     NV_STATUS (*__thirdpartyp2pControlSerialization_Prologue__)(struct ThirdPartyP2P *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
298     NvBool (*__thirdpartyp2pCanCopy__)(struct ThirdPartyP2P *);
299     NvBool (*__thirdpartyp2pIsPartialUnmapSupported__)(struct ThirdPartyP2P *);
300     void (*__thirdpartyp2pPreDestruct__)(struct ThirdPartyP2P *);
301     NV_STATUS (*__thirdpartyp2pIsDuplicate__)(struct ThirdPartyP2P *, NvHandle, NvBool *);
302     void (*__thirdpartyp2pControlSerialization_Epilogue__)(struct ThirdPartyP2P *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
303     NV_STATUS (*__thirdpartyp2pMap__)(struct ThirdPartyP2P *, struct CALL_CONTEXT *, struct RS_CPU_MAP_PARAMS *, struct RsCpuMapping *);
304     NvBool (*__thirdpartyp2pAccessCallback__)(struct ThirdPartyP2P *, struct RsClient *, void *, RsAccessRight);
305     NODE Node;
306     NvHandle hClient;
307     NvHandle hThirdPartyP2P;
308     CLI_THIRD_PARTY_P2P_TYPE type;
309     struct Subdevice *pSubdevice;
310     NvU32 peerIndex;
311     NvU32 flags;
312     NvU64 p2pToken;
313     CLI_THIRD_PARTY_P2P_PID_CLIENT_INFO pidClientList[256];
314     CLI_THIRD_PARTY_P2P_VASPACE_INFO_MAP vaSpaceInfoMap;
315     THIRD_PARTY_P2P_DESTROY_CALLBACK *pDestroyCallback;
316     void *pData;
317     CLI_THIRD_PARTY_P2P_VIDMEM_INFO_MAP vidmemInfoMap;
318     struct P2PTokenShare *pTokenShare;
319     PNODE pAddressRangeTree;
320 };
321 
322 #ifndef __NVOC_CLASS_ThirdPartyP2P_TYPEDEF__
323 #define __NVOC_CLASS_ThirdPartyP2P_TYPEDEF__
324 typedef struct ThirdPartyP2P ThirdPartyP2P;
325 #endif /* __NVOC_CLASS_ThirdPartyP2P_TYPEDEF__ */
326 
327 #ifndef __nvoc_class_id_ThirdPartyP2P
328 #define __nvoc_class_id_ThirdPartyP2P 0x34d08b
329 #endif /* __nvoc_class_id_ThirdPartyP2P */
330 
331 extern const struct NVOC_CLASS_DEF __nvoc_class_def_ThirdPartyP2P;
332 
333 #define __staticCast_ThirdPartyP2P(pThis) \
334     ((pThis)->__nvoc_pbase_ThirdPartyP2P)
335 
336 #ifdef __nvoc_third_party_p2p_h_disabled
337 #define __dynamicCast_ThirdPartyP2P(pThis) ((ThirdPartyP2P*)NULL)
338 #else //__nvoc_third_party_p2p_h_disabled
339 #define __dynamicCast_ThirdPartyP2P(pThis) \
340     ((ThirdPartyP2P*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(ThirdPartyP2P)))
341 #endif //__nvoc_third_party_p2p_h_disabled
342 
343 
344 NV_STATUS __nvoc_objCreateDynamic_ThirdPartyP2P(ThirdPartyP2P**, Dynamic*, NvU32, va_list);
345 
346 NV_STATUS __nvoc_objCreate_ThirdPartyP2P(ThirdPartyP2P**, Dynamic*, NvU32, struct CALL_CONTEXT * arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL * arg_pParams);
347 #define __objCreate_ThirdPartyP2P(ppNewObj, pParent, createFlags, arg_pCallContext, arg_pParams) \
348     __nvoc_objCreate_ThirdPartyP2P((ppNewObj), staticCast((pParent), Dynamic), (createFlags), arg_pCallContext, arg_pParams)
349 
350 #define thirdpartyp2pCtrlCmdRegisterVaSpace(pThirdPartyP2P, pRegisterVaSpaceParams) thirdpartyp2pCtrlCmdRegisterVaSpace_DISPATCH(pThirdPartyP2P, pRegisterVaSpaceParams)
351 #define thirdpartyp2pCtrlCmdUnregisterVaSpace(pThirdPartyP2P, pUnregisterVaSpaceParams) thirdpartyp2pCtrlCmdUnregisterVaSpace_DISPATCH(pThirdPartyP2P, pUnregisterVaSpaceParams)
352 #define thirdpartyp2pCtrlCmdRegisterVidmem(pThirdPartyP2P, pRegisterVidmemParams) thirdpartyp2pCtrlCmdRegisterVidmem_DISPATCH(pThirdPartyP2P, pRegisterVidmemParams)
353 #define thirdpartyp2pCtrlCmdUnregisterVidmem(pThirdPartyP2P, pUnregisterVidmemParams) thirdpartyp2pCtrlCmdUnregisterVidmem_DISPATCH(pThirdPartyP2P, pUnregisterVidmemParams)
354 #define thirdpartyp2pCtrlCmdRegisterPid(pThirdPartyP2P, pParams) thirdpartyp2pCtrlCmdRegisterPid_DISPATCH(pThirdPartyP2P, pParams)
355 #define thirdpartyp2pShareCallback(pGpuResource, pInvokingClient, pParentRef, pSharePolicy) thirdpartyp2pShareCallback_DISPATCH(pGpuResource, pInvokingClient, pParentRef, pSharePolicy)
356 #define thirdpartyp2pCheckMemInterUnmap(pRmResource, bSubdeviceHandleProvided) thirdpartyp2pCheckMemInterUnmap_DISPATCH(pRmResource, bSubdeviceHandleProvided)
357 #define thirdpartyp2pMapTo(pResource, pParams) thirdpartyp2pMapTo_DISPATCH(pResource, pParams)
358 #define thirdpartyp2pGetMapAddrSpace(pGpuResource, pCallContext, mapFlags, pAddrSpace) thirdpartyp2pGetMapAddrSpace_DISPATCH(pGpuResource, pCallContext, mapFlags, pAddrSpace)
359 #define thirdpartyp2pGetRefCount(pResource) thirdpartyp2pGetRefCount_DISPATCH(pResource)
360 #define thirdpartyp2pAddAdditionalDependants(pClient, pResource, pReference) thirdpartyp2pAddAdditionalDependants_DISPATCH(pClient, pResource, pReference)
361 #define thirdpartyp2pControl_Prologue(pResource, pCallContext, pParams) thirdpartyp2pControl_Prologue_DISPATCH(pResource, pCallContext, pParams)
362 #define thirdpartyp2pGetRegBaseOffsetAndSize(pGpuResource, pGpu, pOffset, pSize) thirdpartyp2pGetRegBaseOffsetAndSize_DISPATCH(pGpuResource, pGpu, pOffset, pSize)
363 #define thirdpartyp2pInternalControlForward(pGpuResource, command, pParams, size) thirdpartyp2pInternalControlForward_DISPATCH(pGpuResource, command, pParams, size)
364 #define thirdpartyp2pUnmapFrom(pResource, pParams) thirdpartyp2pUnmapFrom_DISPATCH(pResource, pParams)
365 #define thirdpartyp2pControl_Epilogue(pResource, pCallContext, pParams) thirdpartyp2pControl_Epilogue_DISPATCH(pResource, pCallContext, pParams)
366 #define thirdpartyp2pGetInternalObjectHandle(pGpuResource) thirdpartyp2pGetInternalObjectHandle_DISPATCH(pGpuResource)
367 #define thirdpartyp2pControl(pGpuResource, pCallContext, pParams) thirdpartyp2pControl_DISPATCH(pGpuResource, pCallContext, pParams)
368 #define thirdpartyp2pUnmap(pGpuResource, pCallContext, pCpuMapping) thirdpartyp2pUnmap_DISPATCH(pGpuResource, pCallContext, pCpuMapping)
369 #define thirdpartyp2pGetMemInterMapParams(pRmResource, pParams) thirdpartyp2pGetMemInterMapParams_DISPATCH(pRmResource, pParams)
370 #define thirdpartyp2pGetMemoryMappingDescriptor(pRmResource, ppMemDesc) thirdpartyp2pGetMemoryMappingDescriptor_DISPATCH(pRmResource, ppMemDesc)
371 #define thirdpartyp2pControlFilter(pResource, pCallContext, pParams) thirdpartyp2pControlFilter_DISPATCH(pResource, pCallContext, pParams)
372 #define thirdpartyp2pControlSerialization_Prologue(pResource, pCallContext, pParams) thirdpartyp2pControlSerialization_Prologue_DISPATCH(pResource, pCallContext, pParams)
373 #define thirdpartyp2pCanCopy(pResource) thirdpartyp2pCanCopy_DISPATCH(pResource)
374 #define thirdpartyp2pIsPartialUnmapSupported(pResource) thirdpartyp2pIsPartialUnmapSupported_DISPATCH(pResource)
375 #define thirdpartyp2pPreDestruct(pResource) thirdpartyp2pPreDestruct_DISPATCH(pResource)
376 #define thirdpartyp2pIsDuplicate(pResource, hMemory, pDuplicate) thirdpartyp2pIsDuplicate_DISPATCH(pResource, hMemory, pDuplicate)
377 #define thirdpartyp2pControlSerialization_Epilogue(pResource, pCallContext, pParams) thirdpartyp2pControlSerialization_Epilogue_DISPATCH(pResource, pCallContext, pParams)
378 #define thirdpartyp2pMap(pGpuResource, pCallContext, pParams, pCpuMapping) thirdpartyp2pMap_DISPATCH(pGpuResource, pCallContext, pParams, pCpuMapping)
379 #define thirdpartyp2pAccessCallback(pResource, pInvokingClient, pAllocParams, accessRight) thirdpartyp2pAccessCallback_DISPATCH(pResource, pInvokingClient, pAllocParams, accessRight)
380 NV_STATUS thirdpartyp2pCtrlCmdRegisterVaSpace_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_REGISTER_VA_SPACE_PARAMS *pRegisterVaSpaceParams);
381 
thirdpartyp2pCtrlCmdRegisterVaSpace_DISPATCH(struct ThirdPartyP2P * pThirdPartyP2P,NV503C_CTRL_REGISTER_VA_SPACE_PARAMS * pRegisterVaSpaceParams)382 static inline NV_STATUS thirdpartyp2pCtrlCmdRegisterVaSpace_DISPATCH(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_REGISTER_VA_SPACE_PARAMS *pRegisterVaSpaceParams) {
383     return pThirdPartyP2P->__thirdpartyp2pCtrlCmdRegisterVaSpace__(pThirdPartyP2P, pRegisterVaSpaceParams);
384 }
385 
386 NV_STATUS thirdpartyp2pCtrlCmdUnregisterVaSpace_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_UNREGISTER_VA_SPACE_PARAMS *pUnregisterVaSpaceParams);
387 
thirdpartyp2pCtrlCmdUnregisterVaSpace_DISPATCH(struct ThirdPartyP2P * pThirdPartyP2P,NV503C_CTRL_UNREGISTER_VA_SPACE_PARAMS * pUnregisterVaSpaceParams)388 static inline NV_STATUS thirdpartyp2pCtrlCmdUnregisterVaSpace_DISPATCH(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_UNREGISTER_VA_SPACE_PARAMS *pUnregisterVaSpaceParams) {
389     return pThirdPartyP2P->__thirdpartyp2pCtrlCmdUnregisterVaSpace__(pThirdPartyP2P, pUnregisterVaSpaceParams);
390 }
391 
392 NV_STATUS thirdpartyp2pCtrlCmdRegisterVidmem_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_REGISTER_VIDMEM_PARAMS *pRegisterVidmemParams);
393 
thirdpartyp2pCtrlCmdRegisterVidmem_DISPATCH(struct ThirdPartyP2P * pThirdPartyP2P,NV503C_CTRL_REGISTER_VIDMEM_PARAMS * pRegisterVidmemParams)394 static inline NV_STATUS thirdpartyp2pCtrlCmdRegisterVidmem_DISPATCH(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_REGISTER_VIDMEM_PARAMS *pRegisterVidmemParams) {
395     return pThirdPartyP2P->__thirdpartyp2pCtrlCmdRegisterVidmem__(pThirdPartyP2P, pRegisterVidmemParams);
396 }
397 
398 NV_STATUS thirdpartyp2pCtrlCmdUnregisterVidmem_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_UNREGISTER_VIDMEM_PARAMS *pUnregisterVidmemParams);
399 
thirdpartyp2pCtrlCmdUnregisterVidmem_DISPATCH(struct ThirdPartyP2P * pThirdPartyP2P,NV503C_CTRL_UNREGISTER_VIDMEM_PARAMS * pUnregisterVidmemParams)400 static inline NV_STATUS thirdpartyp2pCtrlCmdUnregisterVidmem_DISPATCH(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_UNREGISTER_VIDMEM_PARAMS *pUnregisterVidmemParams) {
401     return pThirdPartyP2P->__thirdpartyp2pCtrlCmdUnregisterVidmem__(pThirdPartyP2P, pUnregisterVidmemParams);
402 }
403 
404 NV_STATUS thirdpartyp2pCtrlCmdRegisterPid_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_REGISTER_PID_PARAMS *pParams);
405 
thirdpartyp2pCtrlCmdRegisterPid_DISPATCH(struct ThirdPartyP2P * pThirdPartyP2P,NV503C_CTRL_REGISTER_PID_PARAMS * pParams)406 static inline NV_STATUS thirdpartyp2pCtrlCmdRegisterPid_DISPATCH(struct ThirdPartyP2P *pThirdPartyP2P, NV503C_CTRL_REGISTER_PID_PARAMS *pParams) {
407     return pThirdPartyP2P->__thirdpartyp2pCtrlCmdRegisterPid__(pThirdPartyP2P, pParams);
408 }
409 
thirdpartyp2pShareCallback_DISPATCH(struct ThirdPartyP2P * pGpuResource,struct RsClient * pInvokingClient,struct RsResourceRef * pParentRef,RS_SHARE_POLICY * pSharePolicy)410 static inline NvBool thirdpartyp2pShareCallback_DISPATCH(struct ThirdPartyP2P *pGpuResource, struct RsClient *pInvokingClient, struct RsResourceRef *pParentRef, RS_SHARE_POLICY *pSharePolicy) {
411     return pGpuResource->__thirdpartyp2pShareCallback__(pGpuResource, pInvokingClient, pParentRef, pSharePolicy);
412 }
413 
thirdpartyp2pCheckMemInterUnmap_DISPATCH(struct ThirdPartyP2P * pRmResource,NvBool bSubdeviceHandleProvided)414 static inline NV_STATUS thirdpartyp2pCheckMemInterUnmap_DISPATCH(struct ThirdPartyP2P *pRmResource, NvBool bSubdeviceHandleProvided) {
415     return pRmResource->__thirdpartyp2pCheckMemInterUnmap__(pRmResource, bSubdeviceHandleProvided);
416 }
417 
thirdpartyp2pMapTo_DISPATCH(struct ThirdPartyP2P * pResource,RS_RES_MAP_TO_PARAMS * pParams)418 static inline NV_STATUS thirdpartyp2pMapTo_DISPATCH(struct ThirdPartyP2P *pResource, RS_RES_MAP_TO_PARAMS *pParams) {
419     return pResource->__thirdpartyp2pMapTo__(pResource, pParams);
420 }
421 
thirdpartyp2pGetMapAddrSpace_DISPATCH(struct ThirdPartyP2P * pGpuResource,struct CALL_CONTEXT * pCallContext,NvU32 mapFlags,NV_ADDRESS_SPACE * pAddrSpace)422 static inline NV_STATUS thirdpartyp2pGetMapAddrSpace_DISPATCH(struct ThirdPartyP2P *pGpuResource, struct CALL_CONTEXT *pCallContext, NvU32 mapFlags, NV_ADDRESS_SPACE *pAddrSpace) {
423     return pGpuResource->__thirdpartyp2pGetMapAddrSpace__(pGpuResource, pCallContext, mapFlags, pAddrSpace);
424 }
425 
thirdpartyp2pGetRefCount_DISPATCH(struct ThirdPartyP2P * pResource)426 static inline NvU32 thirdpartyp2pGetRefCount_DISPATCH(struct ThirdPartyP2P *pResource) {
427     return pResource->__thirdpartyp2pGetRefCount__(pResource);
428 }
429 
thirdpartyp2pAddAdditionalDependants_DISPATCH(struct RsClient * pClient,struct ThirdPartyP2P * pResource,RsResourceRef * pReference)430 static inline void thirdpartyp2pAddAdditionalDependants_DISPATCH(struct RsClient *pClient, struct ThirdPartyP2P *pResource, RsResourceRef *pReference) {
431     pResource->__thirdpartyp2pAddAdditionalDependants__(pClient, pResource, pReference);
432 }
433 
thirdpartyp2pControl_Prologue_DISPATCH(struct ThirdPartyP2P * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)434 static inline NV_STATUS thirdpartyp2pControl_Prologue_DISPATCH(struct ThirdPartyP2P *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
435     return pResource->__thirdpartyp2pControl_Prologue__(pResource, pCallContext, pParams);
436 }
437 
thirdpartyp2pGetRegBaseOffsetAndSize_DISPATCH(struct ThirdPartyP2P * pGpuResource,struct OBJGPU * pGpu,NvU32 * pOffset,NvU32 * pSize)438 static inline NV_STATUS thirdpartyp2pGetRegBaseOffsetAndSize_DISPATCH(struct ThirdPartyP2P *pGpuResource, struct OBJGPU *pGpu, NvU32 *pOffset, NvU32 *pSize) {
439     return pGpuResource->__thirdpartyp2pGetRegBaseOffsetAndSize__(pGpuResource, pGpu, pOffset, pSize);
440 }
441 
thirdpartyp2pInternalControlForward_DISPATCH(struct ThirdPartyP2P * pGpuResource,NvU32 command,void * pParams,NvU32 size)442 static inline NV_STATUS thirdpartyp2pInternalControlForward_DISPATCH(struct ThirdPartyP2P *pGpuResource, NvU32 command, void *pParams, NvU32 size) {
443     return pGpuResource->__thirdpartyp2pInternalControlForward__(pGpuResource, command, pParams, size);
444 }
445 
thirdpartyp2pUnmapFrom_DISPATCH(struct ThirdPartyP2P * pResource,RS_RES_UNMAP_FROM_PARAMS * pParams)446 static inline NV_STATUS thirdpartyp2pUnmapFrom_DISPATCH(struct ThirdPartyP2P *pResource, RS_RES_UNMAP_FROM_PARAMS *pParams) {
447     return pResource->__thirdpartyp2pUnmapFrom__(pResource, pParams);
448 }
449 
thirdpartyp2pControl_Epilogue_DISPATCH(struct ThirdPartyP2P * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)450 static inline void thirdpartyp2pControl_Epilogue_DISPATCH(struct ThirdPartyP2P *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
451     pResource->__thirdpartyp2pControl_Epilogue__(pResource, pCallContext, pParams);
452 }
453 
thirdpartyp2pGetInternalObjectHandle_DISPATCH(struct ThirdPartyP2P * pGpuResource)454 static inline NvHandle thirdpartyp2pGetInternalObjectHandle_DISPATCH(struct ThirdPartyP2P *pGpuResource) {
455     return pGpuResource->__thirdpartyp2pGetInternalObjectHandle__(pGpuResource);
456 }
457 
thirdpartyp2pControl_DISPATCH(struct ThirdPartyP2P * pGpuResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)458 static inline NV_STATUS thirdpartyp2pControl_DISPATCH(struct ThirdPartyP2P *pGpuResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
459     return pGpuResource->__thirdpartyp2pControl__(pGpuResource, pCallContext, pParams);
460 }
461 
thirdpartyp2pUnmap_DISPATCH(struct ThirdPartyP2P * pGpuResource,struct CALL_CONTEXT * pCallContext,struct RsCpuMapping * pCpuMapping)462 static inline NV_STATUS thirdpartyp2pUnmap_DISPATCH(struct ThirdPartyP2P *pGpuResource, struct CALL_CONTEXT *pCallContext, struct RsCpuMapping *pCpuMapping) {
463     return pGpuResource->__thirdpartyp2pUnmap__(pGpuResource, pCallContext, pCpuMapping);
464 }
465 
thirdpartyp2pGetMemInterMapParams_DISPATCH(struct ThirdPartyP2P * pRmResource,RMRES_MEM_INTER_MAP_PARAMS * pParams)466 static inline NV_STATUS thirdpartyp2pGetMemInterMapParams_DISPATCH(struct ThirdPartyP2P *pRmResource, RMRES_MEM_INTER_MAP_PARAMS *pParams) {
467     return pRmResource->__thirdpartyp2pGetMemInterMapParams__(pRmResource, pParams);
468 }
469 
thirdpartyp2pGetMemoryMappingDescriptor_DISPATCH(struct ThirdPartyP2P * pRmResource,struct MEMORY_DESCRIPTOR ** ppMemDesc)470 static inline NV_STATUS thirdpartyp2pGetMemoryMappingDescriptor_DISPATCH(struct ThirdPartyP2P *pRmResource, struct MEMORY_DESCRIPTOR **ppMemDesc) {
471     return pRmResource->__thirdpartyp2pGetMemoryMappingDescriptor__(pRmResource, ppMemDesc);
472 }
473 
thirdpartyp2pControlFilter_DISPATCH(struct ThirdPartyP2P * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)474 static inline NV_STATUS thirdpartyp2pControlFilter_DISPATCH(struct ThirdPartyP2P *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
475     return pResource->__thirdpartyp2pControlFilter__(pResource, pCallContext, pParams);
476 }
477 
thirdpartyp2pControlSerialization_Prologue_DISPATCH(struct ThirdPartyP2P * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)478 static inline NV_STATUS thirdpartyp2pControlSerialization_Prologue_DISPATCH(struct ThirdPartyP2P *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
479     return pResource->__thirdpartyp2pControlSerialization_Prologue__(pResource, pCallContext, pParams);
480 }
481 
thirdpartyp2pCanCopy_DISPATCH(struct ThirdPartyP2P * pResource)482 static inline NvBool thirdpartyp2pCanCopy_DISPATCH(struct ThirdPartyP2P *pResource) {
483     return pResource->__thirdpartyp2pCanCopy__(pResource);
484 }
485 
thirdpartyp2pIsPartialUnmapSupported_DISPATCH(struct ThirdPartyP2P * pResource)486 static inline NvBool thirdpartyp2pIsPartialUnmapSupported_DISPATCH(struct ThirdPartyP2P *pResource) {
487     return pResource->__thirdpartyp2pIsPartialUnmapSupported__(pResource);
488 }
489 
thirdpartyp2pPreDestruct_DISPATCH(struct ThirdPartyP2P * pResource)490 static inline void thirdpartyp2pPreDestruct_DISPATCH(struct ThirdPartyP2P *pResource) {
491     pResource->__thirdpartyp2pPreDestruct__(pResource);
492 }
493 
thirdpartyp2pIsDuplicate_DISPATCH(struct ThirdPartyP2P * pResource,NvHandle hMemory,NvBool * pDuplicate)494 static inline NV_STATUS thirdpartyp2pIsDuplicate_DISPATCH(struct ThirdPartyP2P *pResource, NvHandle hMemory, NvBool *pDuplicate) {
495     return pResource->__thirdpartyp2pIsDuplicate__(pResource, hMemory, pDuplicate);
496 }
497 
thirdpartyp2pControlSerialization_Epilogue_DISPATCH(struct ThirdPartyP2P * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)498 static inline void thirdpartyp2pControlSerialization_Epilogue_DISPATCH(struct ThirdPartyP2P *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
499     pResource->__thirdpartyp2pControlSerialization_Epilogue__(pResource, pCallContext, pParams);
500 }
501 
thirdpartyp2pMap_DISPATCH(struct ThirdPartyP2P * pGpuResource,struct CALL_CONTEXT * pCallContext,struct RS_CPU_MAP_PARAMS * pParams,struct RsCpuMapping * pCpuMapping)502 static inline NV_STATUS thirdpartyp2pMap_DISPATCH(struct ThirdPartyP2P *pGpuResource, struct CALL_CONTEXT *pCallContext, struct RS_CPU_MAP_PARAMS *pParams, struct RsCpuMapping *pCpuMapping) {
503     return pGpuResource->__thirdpartyp2pMap__(pGpuResource, pCallContext, pParams, pCpuMapping);
504 }
505 
thirdpartyp2pAccessCallback_DISPATCH(struct ThirdPartyP2P * pResource,struct RsClient * pInvokingClient,void * pAllocParams,RsAccessRight accessRight)506 static inline NvBool thirdpartyp2pAccessCallback_DISPATCH(struct ThirdPartyP2P *pResource, struct RsClient *pInvokingClient, void *pAllocParams, RsAccessRight accessRight) {
507     return pResource->__thirdpartyp2pAccessCallback__(pResource, pInvokingClient, pAllocParams, accessRight);
508 }
509 
510 NV_STATUS thirdpartyp2pConstruct_IMPL(struct ThirdPartyP2P *arg_pResource, struct CALL_CONTEXT *arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL *arg_pParams);
511 
512 #define __nvoc_thirdpartyp2pConstruct(arg_pResource, arg_pCallContext, arg_pParams) thirdpartyp2pConstruct_IMPL(arg_pResource, arg_pCallContext, arg_pParams)
513 void thirdpartyp2pDestruct_IMPL(struct ThirdPartyP2P *pResource);
514 
515 #define __nvoc_thirdpartyp2pDestruct(pResource) thirdpartyp2pDestruct_IMPL(pResource)
516 NvBool thirdpartyp2pIsValidClientPid_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NvU32 pid, NvHandle hClient);
517 
518 #ifdef __nvoc_third_party_p2p_h_disabled
thirdpartyp2pIsValidClientPid(struct ThirdPartyP2P * pThirdPartyP2P,NvU32 pid,NvHandle hClient)519 static inline NvBool thirdpartyp2pIsValidClientPid(struct ThirdPartyP2P *pThirdPartyP2P, NvU32 pid, NvHandle hClient) {
520     NV_ASSERT_FAILED_PRECOMP("ThirdPartyP2P was disabled!");
521     return NV_FALSE;
522 }
523 #else //__nvoc_third_party_p2p_h_disabled
524 #define thirdpartyp2pIsValidClientPid(pThirdPartyP2P, pid, hClient) thirdpartyp2pIsValidClientPid_IMPL(pThirdPartyP2P, pid, hClient)
525 #endif //__nvoc_third_party_p2p_h_disabled
526 
527 NV_STATUS thirdpartyp2pDelMappingInfoByKey_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, void *pKey, NvBool bIsRsyncNeeded);
528 
529 #ifdef __nvoc_third_party_p2p_h_disabled
thirdpartyp2pDelMappingInfoByKey(struct ThirdPartyP2P * pThirdPartyP2P,void * pKey,NvBool bIsRsyncNeeded)530 static inline NV_STATUS thirdpartyp2pDelMappingInfoByKey(struct ThirdPartyP2P *pThirdPartyP2P, void *pKey, NvBool bIsRsyncNeeded) {
531     NV_ASSERT_FAILED_PRECOMP("ThirdPartyP2P was disabled!");
532     return NV_ERR_NOT_SUPPORTED;
533 }
534 #else //__nvoc_third_party_p2p_h_disabled
535 #define thirdpartyp2pDelMappingInfoByKey(pThirdPartyP2P, pKey, bIsRsyncNeeded) thirdpartyp2pDelMappingInfoByKey_IMPL(pThirdPartyP2P, pKey, bIsRsyncNeeded)
536 #endif //__nvoc_third_party_p2p_h_disabled
537 
538 NV_STATUS thirdpartyp2pDelPersistentMappingInfoByKey_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, void *pKey, NvBool bIsRsyncNeeded);
539 
540 #ifdef __nvoc_third_party_p2p_h_disabled
thirdpartyp2pDelPersistentMappingInfoByKey(struct ThirdPartyP2P * pThirdPartyP2P,void * pKey,NvBool bIsRsyncNeeded)541 static inline NV_STATUS thirdpartyp2pDelPersistentMappingInfoByKey(struct ThirdPartyP2P *pThirdPartyP2P, void *pKey, NvBool bIsRsyncNeeded) {
542     NV_ASSERT_FAILED_PRECOMP("ThirdPartyP2P was disabled!");
543     return NV_ERR_NOT_SUPPORTED;
544 }
545 #else //__nvoc_third_party_p2p_h_disabled
546 #define thirdpartyp2pDelPersistentMappingInfoByKey(pThirdPartyP2P, pKey, bIsRsyncNeeded) thirdpartyp2pDelPersistentMappingInfoByKey_IMPL(pThirdPartyP2P, pKey, bIsRsyncNeeded)
547 #endif //__nvoc_third_party_p2p_h_disabled
548 
549 NV_STATUS thirdpartyp2pGetVASpaceInfoFromToken_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, NvU32 vaSpaceToken, PCLI_THIRD_PARTY_P2P_VASPACE_INFO *ppVASpaceInfo);
550 
551 #ifdef __nvoc_third_party_p2p_h_disabled
thirdpartyp2pGetVASpaceInfoFromToken(struct ThirdPartyP2P * pThirdPartyP2P,NvU32 vaSpaceToken,PCLI_THIRD_PARTY_P2P_VASPACE_INFO * ppVASpaceInfo)552 static inline NV_STATUS thirdpartyp2pGetVASpaceInfoFromToken(struct ThirdPartyP2P *pThirdPartyP2P, NvU32 vaSpaceToken, PCLI_THIRD_PARTY_P2P_VASPACE_INFO *ppVASpaceInfo) {
553     NV_ASSERT_FAILED_PRECOMP("ThirdPartyP2P was disabled!");
554     return NV_ERR_NOT_SUPPORTED;
555 }
556 #else //__nvoc_third_party_p2p_h_disabled
557 #define thirdpartyp2pGetVASpaceInfoFromToken(pThirdPartyP2P, vaSpaceToken, ppVASpaceInfo) thirdpartyp2pGetVASpaceInfoFromToken_IMPL(pThirdPartyP2P, vaSpaceToken, ppVASpaceInfo)
558 #endif //__nvoc_third_party_p2p_h_disabled
559 
560 NV_STATUS thirdpartyp2pGetNextVASpaceInfo_IMPL(struct ThirdPartyP2P *pThirdPartyP2P, PCLI_THIRD_PARTY_P2P_VASPACE_INFO *arg0);
561 
562 #ifdef __nvoc_third_party_p2p_h_disabled
thirdpartyp2pGetNextVASpaceInfo(struct ThirdPartyP2P * pThirdPartyP2P,PCLI_THIRD_PARTY_P2P_VASPACE_INFO * arg0)563 static inline NV_STATUS thirdpartyp2pGetNextVASpaceInfo(struct ThirdPartyP2P *pThirdPartyP2P, PCLI_THIRD_PARTY_P2P_VASPACE_INFO *arg0) {
564     NV_ASSERT_FAILED_PRECOMP("ThirdPartyP2P was disabled!");
565     return NV_ERR_NOT_SUPPORTED;
566 }
567 #else //__nvoc_third_party_p2p_h_disabled
568 #define thirdpartyp2pGetNextVASpaceInfo(pThirdPartyP2P, arg0) thirdpartyp2pGetNextVASpaceInfo_IMPL(pThirdPartyP2P, arg0)
569 #endif //__nvoc_third_party_p2p_h_disabled
570 
571 #undef PRIVATE_FIELD
572 
573 
574 typedef struct ThirdPartyP2P *PCLI_THIRD_PARTY_P2P_INFO; // RS-TODO: Remove
575 
576 // ****************************************************************************
577 //                          Functions prototypes
578 // ****************************************************************************
579 
580 // Get registered third-party P2P info from pid. Also match the provided client handle if provided.
581 NV_STATUS           CliNextThirdPartyP2PInfoWithPid (struct OBJGPU *, NvU32, NvHandle, struct RmClient**, PCLI_THIRD_PARTY_P2P_INFO *);
582 
583 // Get third-party P2P info given a P2P token
584 NV_STATUS           CliGetThirdPartyP2PInfoFromToken (NvU64, PCLI_THIRD_PARTY_P2P_INFO *);
585 
586 // Register an address space with a third-party P2P object
587 NV_STATUS           CliAddThirdPartyP2PVASpace   (struct ThirdPartyP2P*, NvHandle, NvU32 *);
588 
589 // Unregister an address space from a third-party P2P object
590 NV_STATUS           CliDelThirdPartyP2PVASpace   (struct ThirdPartyP2P*, NvHandle);
591 
592 // Register video memory with a third-party P2P object
593 NV_STATUS           CliAddThirdPartyP2PVidmemInfo (struct ThirdPartyP2P*, NvHandle, NvU64, NvU64, NvU64, struct Memory *);
594 
595 // Unregister video memory from a third-party P2P object
596 NV_STATUS           CliDelThirdPartyP2PVidmemInfo (struct ThirdPartyP2P*, NvHandle);
597 
598 // Unregister video memory from a third-party P2P object only if the VidmemInfo is not used
599 void                CliDelThirdPartyP2PVidmemInfoPersistent (struct ThirdPartyP2P*, CLI_THIRD_PARTY_P2P_VIDMEM_INFO*);
600 
601 // Find registered video memory given an address
602 NV_STATUS           CliGetThirdPartyP2PVidmemInfoFromAddress (struct ThirdPartyP2P*, NvU64, NvU64, NvU64 *, PCLI_THIRD_PARTY_P2P_VIDMEM_INFO *);
603 
604 // Find registered video memory given a VidmemInfo ID
605 NV_STATUS           CliGetThirdPartyP2PVidmemInfoFromId(struct ThirdPartyP2P*, NvU64, CLI_THIRD_PARTY_P2P_VIDMEM_INFO **);
606 
607 // Find platformData given a P2PInfo object
608 NV_STATUS           CliGetThirdPartyP2PPlatformData (PCLI_THIRD_PARTY_P2P_INFO, void *);
609 
610 // Associate a P2P mapping with registered video memory
611 NV_STATUS           CliAddThirdPartyP2PMappingInfo (struct ThirdPartyP2P*, NvHandle, void *, THIRD_PARTY_P2P_VIDMEM_FREE_CALLBACK *, void *, PCLI_THIRD_PARTY_P2P_MAPPING_INFO *);
612 
613 // Find a P2P mapping given its platform specific data
614 NV_STATUS           CliGetThirdPartyP2PMappingInfoFromKey (struct ThirdPartyP2P*, NvHandle, void *, PCLI_THIRD_PARTY_P2P_MAPPING_INFO *);
615 
616 // Register pid & client with a third-party P2P Info object
617 NV_STATUS           CliAddThirdPartyP2PClientPid (NvHandle, NvHandle, NvU32, NvU32);
618 
619 // Unregister pid & client from a third-party P2P Info object
620 NV_STATUS           CliDelThirdPartyP2PClientPid (struct RmClient*, NvHandle, NvU32, NvU32);
621 
622 // Remove association of a client from any existing third-Party P2P Info object
623 NV_STATUS           CliUnregisterFromThirdPartyP2P (struct RmClient*);
624 
625 // Register a free callback
626 NV_STATUS           CliRegisterThirdPartyP2PMappingCallback (struct ThirdPartyP2P*, NvHandle, void *, THIRD_PARTY_P2P_VIDMEM_FREE_CALLBACK *, void *);
627 
628 // Unregister memory from a third-party P2P Info object
629 void                CliUnregisterMemoryFromThirdPartyP2P(struct Memory *pMemory);
630 
631 #endif // _THIRD_PARTY_P2P_H_
632 
633 #ifdef __cplusplus
634 } // extern "C"
635 #endif
636 
637 #endif // _G_THIRD_PARTY_P2P_NVOC_H_
638