1 #ifndef _G_SEM_SURF_NVOC_H_
2 #define _G_SEM_SURF_NVOC_H_
3 #include "nvoc/runtime.h"
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 /*
10  * SPDX-FileCopyrightText: Copyright (c) 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_sem_surf_nvoc.h"
33 
34 #ifndef SEM_SURF_H
35 #define SEM_SURF_H
36 
37 #include "gpu/gpu_resource.h" // GpuResource
38 #include "mem_mgr/mem.h"
39 #include "rmapi/event.h"     // EVENTNOTIFICATION
40 
41 #include "class/cl00da.h"    // NV_SEMAPHORE_SURFACE
42 #include "ctrl/ctrl00da.h"   // NV_SEMAPHORE_SURFACE_CTRL_*
43 #include "ctrl/ctrl2080/ctrl2080fb.h"   // NV2080_CTRL_FB_GET_SEMAPHORE_SURFACE_LAYOUT_PARAMS
44 
45 typedef struct {
46     /* Value being waited for by pListeners list */
47     NvU64 value;
48 
49     /* Value to set the semaphore to after wait value is reached */
50     NvU64 newValue;
51 
52     /* Index of this value listener in the semaphore surface */
53     NvU64 index;
54 
55     /* List of listeners waiting for the value */
56     EVENTNOTIFICATION *pListeners;
57 
58     ListNode valueListEntry;
59     ListNode pendingNotificationsEntry;
60 } SEM_VALUE_LISTENERS_NODE;
61 
62 MAKE_INTRUSIVE_LIST(SEM_VALUE_LISTENERS, SEM_VALUE_LISTENERS_NODE, valueListEntry);
63 MAKE_INTRUSIVE_LIST(SEM_PENDING_NOTIFICATIONS, SEM_VALUE_LISTENERS_NODE, pendingNotificationsEntry);
64 
65 typedef struct {
66     /* List of values being listened for at this index, ordered by value. */
67     SEM_VALUE_LISTENERS listeners;
68 
69     MapNode node;
70 } SEM_INDEX_LISTENERS_NODE;
71 
72 MAKE_INTRUSIVE_MAP(SEM_INDEX_LISTENERS,
73                    SEM_INDEX_LISTENERS_NODE,
74                    node);
75 
76 typedef struct {
77     PORT_SPINLOCK *pSpinlock;
78 
79     /* Internal interrupt handler callback data */
80     NvHandle hClient;
81     NvHandle hDevice;
82     NvHandle hSubDevice;
83     NvHandle hSemaphoreMem;
84     NvHandle hMaxSubmittedMem;
85     NvHandle *phEvents;
86     NVOS10_EVENT_KERNEL_CALLBACK_EX callback;
87     NvU32 numEvents;
88 
89     /* The client-mappable semaphore memory region and associated data */
90     NV2080_CTRL_FB_GET_SEMAPHORE_SURFACE_LAYOUT_PARAMS layout;
91     struct Memory* pSemaphoreMem;
92     struct Memory* pMaxSubmittedMem;
93     NvP64 semKernAddr;
94     NvP64 maxSubmittedKernAddr;
95     NvU8 *pSem;
96     NvU8 *pMaxSubmitted;
97     NvU64 slotCount;
98 
99     /* Client active CPU waiters list XXX Should be per (offset,value) pair */
100     SEM_INDEX_LISTENERS listenerMap;
101 
102     /* Number of semaphore surface objects sharing this data */
103     NvU32 refCount;
104 
105     /* True if this semaphore surface supports 64-bit semaphores */
106     NvBool bIs64Bit;
107 
108     /* True if the GPU supports conditional traps/monitored fence */
109     NvBool bHasMonitoredFence;
110 } SEM_SHARED_DATA;
111 
112 
113 // Private field names are wrapped in PRIVATE_FIELD, which does nothing for
114 // the matching C source file, but causes diagnostics to be issued if another
115 // source file references the field.
116 #ifdef NVOC_SEM_SURF_H_PRIVATE_ACCESS_ALLOWED
117 #define PRIVATE_FIELD(x) x
118 #else
119 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
120 #endif
121 
122 struct SemaphoreSurface {
123     const struct NVOC_RTTI *__nvoc_rtti;
124     struct GpuResource __nvoc_base_GpuResource;
125     struct Object *__nvoc_pbase_Object;
126     struct RsResource *__nvoc_pbase_RsResource;
127     struct RmResourceCommon *__nvoc_pbase_RmResourceCommon;
128     struct RmResource *__nvoc_pbase_RmResource;
129     struct GpuResource *__nvoc_pbase_GpuResource;
130     struct SemaphoreSurface *__nvoc_pbase_SemaphoreSurface;
131     NvBool (*__semsurfCanCopy__)(struct SemaphoreSurface *);
132     NV_STATUS (*__semsurfCtrlCmdRefMemory__)(struct SemaphoreSurface *, NV_SEMAPHORE_SURFACE_CTRL_REF_MEMORY_PARAMS *);
133     NV_STATUS (*__semsurfCtrlCmdBindChannel__)(struct SemaphoreSurface *, NV_SEMAPHORE_SURFACE_CTRL_BIND_CHANNEL_PARAMS *);
134     NV_STATUS (*__semsurfCtrlCmdRegisterWaiter__)(struct SemaphoreSurface *, NV_SEMAPHORE_SURFACE_CTRL_REGISTER_WAITER_PARAMS *);
135     NV_STATUS (*__semsurfCtrlCmdSetValue__)(struct SemaphoreSurface *, NV_SEMAPHORE_SURFACE_CTRL_SET_VALUE_PARAMS *);
136     NV_STATUS (*__semsurfCtrlCmdUnregisterWaiter__)(struct SemaphoreSurface *, NV_SEMAPHORE_SURFACE_CTRL_UNREGISTER_WAITER_PARAMS *);
137     NvBool (*__semsurfShareCallback__)(struct SemaphoreSurface *, struct RsClient *, struct RsResourceRef *, RS_SHARE_POLICY *);
138     NV_STATUS (*__semsurfCheckMemInterUnmap__)(struct SemaphoreSurface *, NvBool);
139     NV_STATUS (*__semsurfMapTo__)(struct SemaphoreSurface *, RS_RES_MAP_TO_PARAMS *);
140     NV_STATUS (*__semsurfGetMapAddrSpace__)(struct SemaphoreSurface *, struct CALL_CONTEXT *, NvU32, NV_ADDRESS_SPACE *);
141     NvU32 (*__semsurfGetRefCount__)(struct SemaphoreSurface *);
142     void (*__semsurfAddAdditionalDependants__)(struct RsClient *, struct SemaphoreSurface *, RsResourceRef *);
143     NV_STATUS (*__semsurfControl_Prologue__)(struct SemaphoreSurface *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
144     NV_STATUS (*__semsurfGetRegBaseOffsetAndSize__)(struct SemaphoreSurface *, struct OBJGPU *, NvU32 *, NvU32 *);
145     NV_STATUS (*__semsurfInternalControlForward__)(struct SemaphoreSurface *, NvU32, void *, NvU32);
146     NV_STATUS (*__semsurfUnmapFrom__)(struct SemaphoreSurface *, RS_RES_UNMAP_FROM_PARAMS *);
147     void (*__semsurfControl_Epilogue__)(struct SemaphoreSurface *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
148     NvHandle (*__semsurfGetInternalObjectHandle__)(struct SemaphoreSurface *);
149     NV_STATUS (*__semsurfControl__)(struct SemaphoreSurface *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
150     NV_STATUS (*__semsurfUnmap__)(struct SemaphoreSurface *, struct CALL_CONTEXT *, struct RsCpuMapping *);
151     NV_STATUS (*__semsurfGetMemInterMapParams__)(struct SemaphoreSurface *, RMRES_MEM_INTER_MAP_PARAMS *);
152     NV_STATUS (*__semsurfGetMemoryMappingDescriptor__)(struct SemaphoreSurface *, struct MEMORY_DESCRIPTOR **);
153     NV_STATUS (*__semsurfControlFilter__)(struct SemaphoreSurface *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
154     NV_STATUS (*__semsurfControlSerialization_Prologue__)(struct SemaphoreSurface *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
155     NvBool (*__semsurfIsPartialUnmapSupported__)(struct SemaphoreSurface *);
156     void (*__semsurfPreDestruct__)(struct SemaphoreSurface *);
157     NV_STATUS (*__semsurfIsDuplicate__)(struct SemaphoreSurface *, NvHandle, NvBool *);
158     void (*__semsurfControlSerialization_Epilogue__)(struct SemaphoreSurface *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
159     NV_STATUS (*__semsurfMap__)(struct SemaphoreSurface *, struct CALL_CONTEXT *, struct RS_CPU_MAP_PARAMS *, struct RsCpuMapping *);
160     NvBool (*__semsurfAccessCallback__)(struct SemaphoreSurface *, struct RsClient *, void *, RsAccessRight);
161     SEM_SHARED_DATA *pShared;
162 };
163 
164 #ifndef __NVOC_CLASS_SemaphoreSurface_TYPEDEF__
165 #define __NVOC_CLASS_SemaphoreSurface_TYPEDEF__
166 typedef struct SemaphoreSurface SemaphoreSurface;
167 #endif /* __NVOC_CLASS_SemaphoreSurface_TYPEDEF__ */
168 
169 #ifndef __nvoc_class_id_SemaphoreSurface
170 #define __nvoc_class_id_SemaphoreSurface 0xeabc69
171 #endif /* __nvoc_class_id_SemaphoreSurface */
172 
173 extern const struct NVOC_CLASS_DEF __nvoc_class_def_SemaphoreSurface;
174 
175 #define __staticCast_SemaphoreSurface(pThis) \
176     ((pThis)->__nvoc_pbase_SemaphoreSurface)
177 
178 #ifdef __nvoc_sem_surf_h_disabled
179 #define __dynamicCast_SemaphoreSurface(pThis) ((SemaphoreSurface*)NULL)
180 #else //__nvoc_sem_surf_h_disabled
181 #define __dynamicCast_SemaphoreSurface(pThis) \
182     ((SemaphoreSurface*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(SemaphoreSurface)))
183 #endif //__nvoc_sem_surf_h_disabled
184 
185 
186 NV_STATUS __nvoc_objCreateDynamic_SemaphoreSurface(SemaphoreSurface**, Dynamic*, NvU32, va_list);
187 
188 NV_STATUS __nvoc_objCreate_SemaphoreSurface(SemaphoreSurface**, Dynamic*, NvU32, CALL_CONTEXT * arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL * arg_pParams);
189 #define __objCreate_SemaphoreSurface(ppNewObj, pParent, createFlags, arg_pCallContext, arg_pParams) \
190     __nvoc_objCreate_SemaphoreSurface((ppNewObj), staticCast((pParent), Dynamic), (createFlags), arg_pCallContext, arg_pParams)
191 
192 #define semsurfCanCopy(pSemSurf) semsurfCanCopy_DISPATCH(pSemSurf)
193 #define semsurfCtrlCmdRefMemory(pSemaphoreSurf, pParams) semsurfCtrlCmdRefMemory_DISPATCH(pSemaphoreSurf, pParams)
194 #define semsurfCtrlCmdBindChannel(pSemaphoreSurf, pParams) semsurfCtrlCmdBindChannel_DISPATCH(pSemaphoreSurf, pParams)
195 #define semsurfCtrlCmdRegisterWaiter(pSemaphoreSurf, pParams) semsurfCtrlCmdRegisterWaiter_DISPATCH(pSemaphoreSurf, pParams)
196 #define semsurfCtrlCmdSetValue(pSemaphoreSurf, pParams) semsurfCtrlCmdSetValue_DISPATCH(pSemaphoreSurf, pParams)
197 #define semsurfCtrlCmdUnregisterWaiter(pSemaphoreSurf, pParams) semsurfCtrlCmdUnregisterWaiter_DISPATCH(pSemaphoreSurf, pParams)
198 #define semsurfShareCallback(pGpuResource, pInvokingClient, pParentRef, pSharePolicy) semsurfShareCallback_DISPATCH(pGpuResource, pInvokingClient, pParentRef, pSharePolicy)
199 #define semsurfCheckMemInterUnmap(pRmResource, bSubdeviceHandleProvided) semsurfCheckMemInterUnmap_DISPATCH(pRmResource, bSubdeviceHandleProvided)
200 #define semsurfMapTo(pResource, pParams) semsurfMapTo_DISPATCH(pResource, pParams)
201 #define semsurfGetMapAddrSpace(pGpuResource, pCallContext, mapFlags, pAddrSpace) semsurfGetMapAddrSpace_DISPATCH(pGpuResource, pCallContext, mapFlags, pAddrSpace)
202 #define semsurfGetRefCount(pResource) semsurfGetRefCount_DISPATCH(pResource)
203 #define semsurfAddAdditionalDependants(pClient, pResource, pReference) semsurfAddAdditionalDependants_DISPATCH(pClient, pResource, pReference)
204 #define semsurfControl_Prologue(pResource, pCallContext, pParams) semsurfControl_Prologue_DISPATCH(pResource, pCallContext, pParams)
205 #define semsurfGetRegBaseOffsetAndSize(pGpuResource, pGpu, pOffset, pSize) semsurfGetRegBaseOffsetAndSize_DISPATCH(pGpuResource, pGpu, pOffset, pSize)
206 #define semsurfInternalControlForward(pGpuResource, command, pParams, size) semsurfInternalControlForward_DISPATCH(pGpuResource, command, pParams, size)
207 #define semsurfUnmapFrom(pResource, pParams) semsurfUnmapFrom_DISPATCH(pResource, pParams)
208 #define semsurfControl_Epilogue(pResource, pCallContext, pParams) semsurfControl_Epilogue_DISPATCH(pResource, pCallContext, pParams)
209 #define semsurfGetInternalObjectHandle(pGpuResource) semsurfGetInternalObjectHandle_DISPATCH(pGpuResource)
210 #define semsurfControl(pGpuResource, pCallContext, pParams) semsurfControl_DISPATCH(pGpuResource, pCallContext, pParams)
211 #define semsurfUnmap(pGpuResource, pCallContext, pCpuMapping) semsurfUnmap_DISPATCH(pGpuResource, pCallContext, pCpuMapping)
212 #define semsurfGetMemInterMapParams(pRmResource, pParams) semsurfGetMemInterMapParams_DISPATCH(pRmResource, pParams)
213 #define semsurfGetMemoryMappingDescriptor(pRmResource, ppMemDesc) semsurfGetMemoryMappingDescriptor_DISPATCH(pRmResource, ppMemDesc)
214 #define semsurfControlFilter(pResource, pCallContext, pParams) semsurfControlFilter_DISPATCH(pResource, pCallContext, pParams)
215 #define semsurfControlSerialization_Prologue(pResource, pCallContext, pParams) semsurfControlSerialization_Prologue_DISPATCH(pResource, pCallContext, pParams)
216 #define semsurfIsPartialUnmapSupported(pResource) semsurfIsPartialUnmapSupported_DISPATCH(pResource)
217 #define semsurfPreDestruct(pResource) semsurfPreDestruct_DISPATCH(pResource)
218 #define semsurfIsDuplicate(pResource, hMemory, pDuplicate) semsurfIsDuplicate_DISPATCH(pResource, hMemory, pDuplicate)
219 #define semsurfControlSerialization_Epilogue(pResource, pCallContext, pParams) semsurfControlSerialization_Epilogue_DISPATCH(pResource, pCallContext, pParams)
220 #define semsurfMap(pGpuResource, pCallContext, pParams, pCpuMapping) semsurfMap_DISPATCH(pGpuResource, pCallContext, pParams, pCpuMapping)
221 #define semsurfAccessCallback(pResource, pInvokingClient, pAllocParams, accessRight) semsurfAccessCallback_DISPATCH(pResource, pInvokingClient, pAllocParams, accessRight)
semsurfCanCopy_0c883b(struct SemaphoreSurface * pSemSurf)222 static inline NvBool semsurfCanCopy_0c883b(struct SemaphoreSurface *pSemSurf) {
223     return ((NvBool)(0 == 0));
224 }
225 
semsurfCanCopy_DISPATCH(struct SemaphoreSurface * pSemSurf)226 static inline NvBool semsurfCanCopy_DISPATCH(struct SemaphoreSurface *pSemSurf) {
227     return pSemSurf->__semsurfCanCopy__(pSemSurf);
228 }
229 
230 NV_STATUS semsurfCtrlCmdRefMemory_IMPL(struct SemaphoreSurface *pSemaphoreSurf, NV_SEMAPHORE_SURFACE_CTRL_REF_MEMORY_PARAMS *pParams);
231 
semsurfCtrlCmdRefMemory_DISPATCH(struct SemaphoreSurface * pSemaphoreSurf,NV_SEMAPHORE_SURFACE_CTRL_REF_MEMORY_PARAMS * pParams)232 static inline NV_STATUS semsurfCtrlCmdRefMemory_DISPATCH(struct SemaphoreSurface *pSemaphoreSurf, NV_SEMAPHORE_SURFACE_CTRL_REF_MEMORY_PARAMS *pParams) {
233     return pSemaphoreSurf->__semsurfCtrlCmdRefMemory__(pSemaphoreSurf, pParams);
234 }
235 
236 NV_STATUS semsurfCtrlCmdBindChannel_IMPL(struct SemaphoreSurface *pSemaphoreSurf, NV_SEMAPHORE_SURFACE_CTRL_BIND_CHANNEL_PARAMS *pParams);
237 
semsurfCtrlCmdBindChannel_DISPATCH(struct SemaphoreSurface * pSemaphoreSurf,NV_SEMAPHORE_SURFACE_CTRL_BIND_CHANNEL_PARAMS * pParams)238 static inline NV_STATUS semsurfCtrlCmdBindChannel_DISPATCH(struct SemaphoreSurface *pSemaphoreSurf, NV_SEMAPHORE_SURFACE_CTRL_BIND_CHANNEL_PARAMS *pParams) {
239     return pSemaphoreSurf->__semsurfCtrlCmdBindChannel__(pSemaphoreSurf, pParams);
240 }
241 
242 NV_STATUS semsurfCtrlCmdRegisterWaiter_IMPL(struct SemaphoreSurface *pSemaphoreSurf, NV_SEMAPHORE_SURFACE_CTRL_REGISTER_WAITER_PARAMS *pParams);
243 
semsurfCtrlCmdRegisterWaiter_DISPATCH(struct SemaphoreSurface * pSemaphoreSurf,NV_SEMAPHORE_SURFACE_CTRL_REGISTER_WAITER_PARAMS * pParams)244 static inline NV_STATUS semsurfCtrlCmdRegisterWaiter_DISPATCH(struct SemaphoreSurface *pSemaphoreSurf, NV_SEMAPHORE_SURFACE_CTRL_REGISTER_WAITER_PARAMS *pParams) {
245     return pSemaphoreSurf->__semsurfCtrlCmdRegisterWaiter__(pSemaphoreSurf, pParams);
246 }
247 
248 NV_STATUS semsurfCtrlCmdSetValue_IMPL(struct SemaphoreSurface *pSemaphoreSurf, NV_SEMAPHORE_SURFACE_CTRL_SET_VALUE_PARAMS *pParams);
249 
semsurfCtrlCmdSetValue_DISPATCH(struct SemaphoreSurface * pSemaphoreSurf,NV_SEMAPHORE_SURFACE_CTRL_SET_VALUE_PARAMS * pParams)250 static inline NV_STATUS semsurfCtrlCmdSetValue_DISPATCH(struct SemaphoreSurface *pSemaphoreSurf, NV_SEMAPHORE_SURFACE_CTRL_SET_VALUE_PARAMS *pParams) {
251     return pSemaphoreSurf->__semsurfCtrlCmdSetValue__(pSemaphoreSurf, pParams);
252 }
253 
254 NV_STATUS semsurfCtrlCmdUnregisterWaiter_IMPL(struct SemaphoreSurface *pSemaphoreSurf, NV_SEMAPHORE_SURFACE_CTRL_UNREGISTER_WAITER_PARAMS *pParams);
255 
semsurfCtrlCmdUnregisterWaiter_DISPATCH(struct SemaphoreSurface * pSemaphoreSurf,NV_SEMAPHORE_SURFACE_CTRL_UNREGISTER_WAITER_PARAMS * pParams)256 static inline NV_STATUS semsurfCtrlCmdUnregisterWaiter_DISPATCH(struct SemaphoreSurface *pSemaphoreSurf, NV_SEMAPHORE_SURFACE_CTRL_UNREGISTER_WAITER_PARAMS *pParams) {
257     return pSemaphoreSurf->__semsurfCtrlCmdUnregisterWaiter__(pSemaphoreSurf, pParams);
258 }
259 
semsurfShareCallback_DISPATCH(struct SemaphoreSurface * pGpuResource,struct RsClient * pInvokingClient,struct RsResourceRef * pParentRef,RS_SHARE_POLICY * pSharePolicy)260 static inline NvBool semsurfShareCallback_DISPATCH(struct SemaphoreSurface *pGpuResource, struct RsClient *pInvokingClient, struct RsResourceRef *pParentRef, RS_SHARE_POLICY *pSharePolicy) {
261     return pGpuResource->__semsurfShareCallback__(pGpuResource, pInvokingClient, pParentRef, pSharePolicy);
262 }
263 
semsurfCheckMemInterUnmap_DISPATCH(struct SemaphoreSurface * pRmResource,NvBool bSubdeviceHandleProvided)264 static inline NV_STATUS semsurfCheckMemInterUnmap_DISPATCH(struct SemaphoreSurface *pRmResource, NvBool bSubdeviceHandleProvided) {
265     return pRmResource->__semsurfCheckMemInterUnmap__(pRmResource, bSubdeviceHandleProvided);
266 }
267 
semsurfMapTo_DISPATCH(struct SemaphoreSurface * pResource,RS_RES_MAP_TO_PARAMS * pParams)268 static inline NV_STATUS semsurfMapTo_DISPATCH(struct SemaphoreSurface *pResource, RS_RES_MAP_TO_PARAMS *pParams) {
269     return pResource->__semsurfMapTo__(pResource, pParams);
270 }
271 
semsurfGetMapAddrSpace_DISPATCH(struct SemaphoreSurface * pGpuResource,struct CALL_CONTEXT * pCallContext,NvU32 mapFlags,NV_ADDRESS_SPACE * pAddrSpace)272 static inline NV_STATUS semsurfGetMapAddrSpace_DISPATCH(struct SemaphoreSurface *pGpuResource, struct CALL_CONTEXT *pCallContext, NvU32 mapFlags, NV_ADDRESS_SPACE *pAddrSpace) {
273     return pGpuResource->__semsurfGetMapAddrSpace__(pGpuResource, pCallContext, mapFlags, pAddrSpace);
274 }
275 
semsurfGetRefCount_DISPATCH(struct SemaphoreSurface * pResource)276 static inline NvU32 semsurfGetRefCount_DISPATCH(struct SemaphoreSurface *pResource) {
277     return pResource->__semsurfGetRefCount__(pResource);
278 }
279 
semsurfAddAdditionalDependants_DISPATCH(struct RsClient * pClient,struct SemaphoreSurface * pResource,RsResourceRef * pReference)280 static inline void semsurfAddAdditionalDependants_DISPATCH(struct RsClient *pClient, struct SemaphoreSurface *pResource, RsResourceRef *pReference) {
281     pResource->__semsurfAddAdditionalDependants__(pClient, pResource, pReference);
282 }
283 
semsurfControl_Prologue_DISPATCH(struct SemaphoreSurface * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)284 static inline NV_STATUS semsurfControl_Prologue_DISPATCH(struct SemaphoreSurface *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
285     return pResource->__semsurfControl_Prologue__(pResource, pCallContext, pParams);
286 }
287 
semsurfGetRegBaseOffsetAndSize_DISPATCH(struct SemaphoreSurface * pGpuResource,struct OBJGPU * pGpu,NvU32 * pOffset,NvU32 * pSize)288 static inline NV_STATUS semsurfGetRegBaseOffsetAndSize_DISPATCH(struct SemaphoreSurface *pGpuResource, struct OBJGPU *pGpu, NvU32 *pOffset, NvU32 *pSize) {
289     return pGpuResource->__semsurfGetRegBaseOffsetAndSize__(pGpuResource, pGpu, pOffset, pSize);
290 }
291 
semsurfInternalControlForward_DISPATCH(struct SemaphoreSurface * pGpuResource,NvU32 command,void * pParams,NvU32 size)292 static inline NV_STATUS semsurfInternalControlForward_DISPATCH(struct SemaphoreSurface *pGpuResource, NvU32 command, void *pParams, NvU32 size) {
293     return pGpuResource->__semsurfInternalControlForward__(pGpuResource, command, pParams, size);
294 }
295 
semsurfUnmapFrom_DISPATCH(struct SemaphoreSurface * pResource,RS_RES_UNMAP_FROM_PARAMS * pParams)296 static inline NV_STATUS semsurfUnmapFrom_DISPATCH(struct SemaphoreSurface *pResource, RS_RES_UNMAP_FROM_PARAMS *pParams) {
297     return pResource->__semsurfUnmapFrom__(pResource, pParams);
298 }
299 
semsurfControl_Epilogue_DISPATCH(struct SemaphoreSurface * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)300 static inline void semsurfControl_Epilogue_DISPATCH(struct SemaphoreSurface *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
301     pResource->__semsurfControl_Epilogue__(pResource, pCallContext, pParams);
302 }
303 
semsurfGetInternalObjectHandle_DISPATCH(struct SemaphoreSurface * pGpuResource)304 static inline NvHandle semsurfGetInternalObjectHandle_DISPATCH(struct SemaphoreSurface *pGpuResource) {
305     return pGpuResource->__semsurfGetInternalObjectHandle__(pGpuResource);
306 }
307 
semsurfControl_DISPATCH(struct SemaphoreSurface * pGpuResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)308 static inline NV_STATUS semsurfControl_DISPATCH(struct SemaphoreSurface *pGpuResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
309     return pGpuResource->__semsurfControl__(pGpuResource, pCallContext, pParams);
310 }
311 
semsurfUnmap_DISPATCH(struct SemaphoreSurface * pGpuResource,struct CALL_CONTEXT * pCallContext,struct RsCpuMapping * pCpuMapping)312 static inline NV_STATUS semsurfUnmap_DISPATCH(struct SemaphoreSurface *pGpuResource, struct CALL_CONTEXT *pCallContext, struct RsCpuMapping *pCpuMapping) {
313     return pGpuResource->__semsurfUnmap__(pGpuResource, pCallContext, pCpuMapping);
314 }
315 
semsurfGetMemInterMapParams_DISPATCH(struct SemaphoreSurface * pRmResource,RMRES_MEM_INTER_MAP_PARAMS * pParams)316 static inline NV_STATUS semsurfGetMemInterMapParams_DISPATCH(struct SemaphoreSurface *pRmResource, RMRES_MEM_INTER_MAP_PARAMS *pParams) {
317     return pRmResource->__semsurfGetMemInterMapParams__(pRmResource, pParams);
318 }
319 
semsurfGetMemoryMappingDescriptor_DISPATCH(struct SemaphoreSurface * pRmResource,struct MEMORY_DESCRIPTOR ** ppMemDesc)320 static inline NV_STATUS semsurfGetMemoryMappingDescriptor_DISPATCH(struct SemaphoreSurface *pRmResource, struct MEMORY_DESCRIPTOR **ppMemDesc) {
321     return pRmResource->__semsurfGetMemoryMappingDescriptor__(pRmResource, ppMemDesc);
322 }
323 
semsurfControlFilter_DISPATCH(struct SemaphoreSurface * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)324 static inline NV_STATUS semsurfControlFilter_DISPATCH(struct SemaphoreSurface *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
325     return pResource->__semsurfControlFilter__(pResource, pCallContext, pParams);
326 }
327 
semsurfControlSerialization_Prologue_DISPATCH(struct SemaphoreSurface * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)328 static inline NV_STATUS semsurfControlSerialization_Prologue_DISPATCH(struct SemaphoreSurface *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
329     return pResource->__semsurfControlSerialization_Prologue__(pResource, pCallContext, pParams);
330 }
331 
semsurfIsPartialUnmapSupported_DISPATCH(struct SemaphoreSurface * pResource)332 static inline NvBool semsurfIsPartialUnmapSupported_DISPATCH(struct SemaphoreSurface *pResource) {
333     return pResource->__semsurfIsPartialUnmapSupported__(pResource);
334 }
335 
semsurfPreDestruct_DISPATCH(struct SemaphoreSurface * pResource)336 static inline void semsurfPreDestruct_DISPATCH(struct SemaphoreSurface *pResource) {
337     pResource->__semsurfPreDestruct__(pResource);
338 }
339 
semsurfIsDuplicate_DISPATCH(struct SemaphoreSurface * pResource,NvHandle hMemory,NvBool * pDuplicate)340 static inline NV_STATUS semsurfIsDuplicate_DISPATCH(struct SemaphoreSurface *pResource, NvHandle hMemory, NvBool *pDuplicate) {
341     return pResource->__semsurfIsDuplicate__(pResource, hMemory, pDuplicate);
342 }
343 
semsurfControlSerialization_Epilogue_DISPATCH(struct SemaphoreSurface * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)344 static inline void semsurfControlSerialization_Epilogue_DISPATCH(struct SemaphoreSurface *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
345     pResource->__semsurfControlSerialization_Epilogue__(pResource, pCallContext, pParams);
346 }
347 
semsurfMap_DISPATCH(struct SemaphoreSurface * pGpuResource,struct CALL_CONTEXT * pCallContext,struct RS_CPU_MAP_PARAMS * pParams,struct RsCpuMapping * pCpuMapping)348 static inline NV_STATUS semsurfMap_DISPATCH(struct SemaphoreSurface *pGpuResource, struct CALL_CONTEXT *pCallContext, struct RS_CPU_MAP_PARAMS *pParams, struct RsCpuMapping *pCpuMapping) {
349     return pGpuResource->__semsurfMap__(pGpuResource, pCallContext, pParams, pCpuMapping);
350 }
351 
semsurfAccessCallback_DISPATCH(struct SemaphoreSurface * pResource,struct RsClient * pInvokingClient,void * pAllocParams,RsAccessRight accessRight)352 static inline NvBool semsurfAccessCallback_DISPATCH(struct SemaphoreSurface *pResource, struct RsClient *pInvokingClient, void *pAllocParams, RsAccessRight accessRight) {
353     return pResource->__semsurfAccessCallback__(pResource, pInvokingClient, pAllocParams, accessRight);
354 }
355 
356 NV_STATUS semsurfConstruct_IMPL(struct SemaphoreSurface *arg_semaphoreSurf, CALL_CONTEXT *arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL *arg_pParams);
357 
358 #define __nvoc_semsurfConstruct(arg_semaphoreSurf, arg_pCallContext, arg_pParams) semsurfConstruct_IMPL(arg_semaphoreSurf, arg_pCallContext, arg_pParams)
359 void semsurfDestruct_IMPL(struct SemaphoreSurface *pSemSurf);
360 
361 #define __nvoc_semsurfDestruct(pSemSurf) semsurfDestruct_IMPL(pSemSurf)
362 NvU64 semsurfGetValue_IMPL(struct SemaphoreSurface *pSemSurf, NvU64 index);
363 
364 #ifdef __nvoc_sem_surf_h_disabled
semsurfGetValue(struct SemaphoreSurface * pSemSurf,NvU64 index)365 static inline NvU64 semsurfGetValue(struct SemaphoreSurface *pSemSurf, NvU64 index) {
366     NV_ASSERT_FAILED_PRECOMP("SemaphoreSurface was disabled!");
367     return 0;
368 }
369 #else //__nvoc_sem_surf_h_disabled
370 #define semsurfGetValue(pSemSurf, index) semsurfGetValue_IMPL(pSemSurf, index)
371 #endif //__nvoc_sem_surf_h_disabled
372 
373 NvBool semsurfValidateIndex_IMPL(struct SemaphoreSurface *pSemSurf, NvU64 index);
374 
375 #ifdef __nvoc_sem_surf_h_disabled
semsurfValidateIndex(struct SemaphoreSurface * pSemSurf,NvU64 index)376 static inline NvBool semsurfValidateIndex(struct SemaphoreSurface *pSemSurf, NvU64 index) {
377     NV_ASSERT_FAILED_PRECOMP("SemaphoreSurface was disabled!");
378     return NV_FALSE;
379 }
380 #else //__nvoc_sem_surf_h_disabled
381 #define semsurfValidateIndex(pSemSurf, index) semsurfValidateIndex_IMPL(pSemSurf, index)
382 #endif //__nvoc_sem_surf_h_disabled
383 
384 #undef PRIVATE_FIELD
385 
386 
387 #endif // SEM_SURF_H
388 
389 #ifdef __cplusplus
390 } // extern "C"
391 #endif
392 
393 #endif // _G_SEM_SURF_NVOC_H_
394