1 /* 2 * SPDX-FileCopyrightText: Copyright (c) 2006-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 * SPDX-License-Identifier: MIT 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be included in 13 * all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 * DEALINGS IN THE SOFTWARE. 22 */ 23 24 #pragma once 25 26 #include <nvtypes.h> 27 28 // 29 // This file was generated with FINN, an NVIDIA coding tool. 30 // Source file: ctrl/ctrl2080/ctrl2080event.finn 31 // 32 33 #include "ctrl/ctrl2080/ctrl2080base.h" 34 35 #include "nv_vgpu_types.h" 36 /* NV20_SUBDEVICE_XX event-related control commands and parameters */ 37 38 /* 39 * NV2080_CTRL_CMD_EVENT_SET_NOTIFICATION 40 * 41 * This command sets event notification state for the associated subdevice. 42 * This command requires that an instance of NV01_EVENT has been previously 43 * bound to the associated subdevice object. 44 * 45 * event 46 * This parameter specifies the type of event to which the specified 47 * action is to be applied. This parameter must specify a valid 48 * NV2080_NOTIFIERS value (see cl2080.h for more details) and should 49 * not exceed one less NV2080_NOTIFIERS_MAXCOUNT. 50 * action 51 * This parameter specifies the desired event notification action. 52 * Valid notification actions include: 53 * NV2080_CTRL_SET_EVENT_NOTIFICATION_DISABLE 54 * This action disables event notification for the specified 55 * event for the associated subdevice object. 56 * NV2080_CTRL_SET_EVENT_NOTIFICATION_SINGLE 57 * This action enables single-shot event notification for the 58 * specified event for the associated subdevice object. 59 * NV2080_CTRL_SET_EVENT_NOTIFICATION_REPEAT 60 * This action enables repeated event notification for the specified 61 * event for the associated system controller object. 62 * bNotifyState 63 * This boolean is used to indicate the current state of the notifier 64 * at the time of event registration. This is optional and its semantics 65 * needs to be agreed upon by the notifier and client using the notifier 66 * info32 67 * This is used to send 32-bit initial state info with the notifier at 68 * time of event registration 69 * info16 70 * This is used to send 16-bit initial state info with the notifier at 71 * time of event registration 72 * 73 * Possible status values returned are: 74 * NV_OK 75 * NV_ERR_INVALID_PARAM_STRUCT 76 * NV_ERR_INVALID_ARGUMENT 77 * NV_ERR_INVALID_STATE 78 */ 79 #define NV2080_CTRL_CMD_EVENT_SET_NOTIFICATION (0x20800301) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_EVENT_INTERFACE_ID << 8) | NV2080_CTRL_EVENT_SET_NOTIFICATION_PARAMS_MESSAGE_ID" */ 80 81 #define NV2080_CTRL_EVENT_SET_NOTIFICATION_PARAMS_MESSAGE_ID (0x1U) 82 83 typedef struct NV2080_CTRL_EVENT_SET_NOTIFICATION_PARAMS { 84 NvU32 event; 85 NvU32 action; 86 NvBool bNotifyState; 87 NvU32 info32; 88 NvU16 info16; 89 } NV2080_CTRL_EVENT_SET_NOTIFICATION_PARAMS; 90 91 /* valid action values */ 92 #define NV2080_CTRL_EVENT_SET_NOTIFICATION_ACTION_DISABLE (0x00000000) 93 #define NV2080_CTRL_EVENT_SET_NOTIFICATION_ACTION_SINGLE (0x00000001) 94 #define NV2080_CTRL_EVENT_SET_NOTIFICATION_ACTION_REPEAT (0x00000002) 95 96 /* XUSB/PPC D-state defines */ 97 #define NV2080_EVENT_DSTATE_XUSB_D0 (0x00000000) 98 #define NV2080_EVENT_DSTATE_XUSB_D3 (0x00000003) 99 #define NV2080_EVENT_DSTATE_XUSB_INVALID (0xFFFFFFFF) 100 #define NV2080_EVENT_DSTATE_PPC_D0 (0x00000000) 101 #define NV2080_EVENT_DSTATE_PPC_D3 (0x00000003) 102 #define NV2080_EVENT_DSTATE_PPC_INVALID (0xFFFFFFFF) 103 104 // HDACODEC Decice DState, D3_COLD is only for verbose mapping, it cannot be logged 105 typedef enum NV2080_EVENT_HDACODEC_DSTATE { 106 NV2080_EVENT_HDACODEC_DEVICE_DSTATE_D0 = 0, 107 NV2080_EVENT_HDACODEC_DEVICE_DSTATE_D1 = 1, 108 NV2080_EVENT_HDACODEC_DEVICE_DSTATE_D2 = 2, 109 NV2080_EVENT_HDACODEC_DEVICE_DSTATE_D3_HOT = 3, 110 NV2080_EVENT_HDACODEC_DEVICE_DSTATE_D3_COLD = 4, 111 NV2080_EVENT_HDACODEC_DEVICE_DSTATE_DSTATE_MAX = 5, 112 } NV2080_EVENT_HDACODEC_DSTATE; 113 114 /* 115 * NV2080_CTRL_CMD_EVENT_SET_TRIGGER 116 * 117 * This command triggers a software event for the associated subdevice. 118 * This command accepts no parameters. 119 * 120 * Possible status values returned are: 121 * NV_OK 122 */ 123 #define NV2080_CTRL_CMD_EVENT_SET_TRIGGER (0x20800302) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_EVENT_INTERFACE_ID << 8) | 0x2" */ 124 125 /* 126 * NV2080_CTRL_CMD_EVENT_SET_NOTIFIER_MEMORY 127 * 128 * hMemory 129 * This parameter specifies the handle of the memory object 130 * that identifies the memory address translation for this 131 * subdevice instance's notification(s). The beginning of the 132 * translation points to an array of notification data structures. 133 * The size of the translation must be at least large enough to hold the 134 * maximum number of notification data structures identified by 135 * the NV2080_MAX_NOTIFIERS value. 136 * Legal argument values must be instances of the following classes: 137 * NV01_NULL 138 * NV04_MEMORY 139 * When hMemory specifies the NV01_NULL_OBJECT value then any existing 140 * memory translation connection is cleared. There must not be any 141 * pending notifications when this command is issued. 142 * 143 * Possible status values returned are: 144 * NV_OK 145 * NV_ERR_INVALID_PARAM_STRUCT 146 * NV_ERR_INVALID_ARGUMENT 147 * NV_ERR_INVALID_STATE 148 */ 149 #define NV2080_CTRL_CMD_EVENT_SET_MEMORY_NOTIFIES (0x20800303) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_EVENT_INTERFACE_ID << 8) | NV2080_CTRL_EVENT_SET_MEMORY_NOTIFIES_PARAMS_MESSAGE_ID" */ 150 151 #define NV2080_CTRL_EVENT_SET_MEMORY_NOTIFIES_PARAMS_MESSAGE_ID (0x3U) 152 153 typedef struct NV2080_CTRL_EVENT_SET_MEMORY_NOTIFIES_PARAMS { 154 NvHandle hMemory; 155 } NV2080_CTRL_EVENT_SET_MEMORY_NOTIFIES_PARAMS; 156 157 #define NV2080_EVENT_MEMORY_NOTIFIES_STATUS_NOTIFIED 0 158 #define NV2080_EVENT_MEMORY_NOTIFIES_STATUS_PENDING 1 159 #define NV2080_EVENT_MEMORY_NOTIFIES_STATUS_ERROR 2 160 161 /* 162 * NV2080_CTRL_CMD_EVENT_SET_SEMAPHORE_MEMORY 163 * 164 * hSemMemory 165 * This parameter specifies the handle of the memory object that 166 * identifies the semaphore memory associated with this subdevice 167 * event notification. Once this is set RM will generate an event 168 * only when there is a change in the semaphore value. It is 169 * expected that the semaphore memory value will be updated by 170 * the GPU indicating that there is an event pending. This 171 * command is used by VGX plugin to determine which virtual 172 * machine has generated a particular event. 173 * 174 * semOffset 175 * This parameter indicates the memory offset of the semaphore. 176 * 177 * 178 * Possible status values returned are: 179 * NV_OK 180 * NV_ERR_INVALID_PARAM_STRUCT 181 * NV_ERR_INVALID_ARGUMENT 182 */ 183 #define NV2080_CTRL_CMD_EVENT_SET_SEMAPHORE_MEMORY (0x20800304) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_EVENT_INTERFACE_ID << 8) | NV2080_CTRL_EVENT_SET_SEMAPHORE_MEMORY_PARAMS_MESSAGE_ID" */ 184 185 #define NV2080_CTRL_EVENT_SET_SEMAPHORE_MEMORY_PARAMS_MESSAGE_ID (0x4U) 186 187 typedef struct NV2080_CTRL_EVENT_SET_SEMAPHORE_MEMORY_PARAMS { 188 NvHandle hSemMemory; 189 NvU32 semOffset; 190 } NV2080_CTRL_EVENT_SET_SEMAPHORE_MEMORY_PARAMS; 191 192 /* 193 * NV2080_CTRL_CMD_EVENT_SET_GUEST_MSI 194 * 195 * hSemMemory 196 * This parameter specifies the handle of the memory object that 197 * identifies the semaphore memory associated with this subdevice 198 * event notification. Once this is set RM will generate an event 199 * only when there is a change in the semaphore value. It is 200 * expected that the semaphore memory value will be updated by 201 * the GPU indicating that there is an event pending. This 202 * command is used by VGX plugin to determine which virtual 203 * machine has generated a particular event. 204 * 205 * guestMSIAddr 206 * This parameter indicates the guest allocated MSI address. 207 * 208 * guestMSIData 209 * This parameter indicates the MSI data set by the guest OS. 210 * 211 * vgpuUuid 212 * This parameter specifies the uuid of vGPU assigned to VM. 213 * 214 * domainId 215 * This parameter specifies the unique guest virtual machine identifier 216 * 217 * Possible status values returned are: 218 * NV_OK 219 * NV_ERR_INVALID_PARAM_STRUCT 220 * NV_ERR_INVALID_ARGUMENT 221 */ 222 #define NV2080_CTRL_CMD_EVENT_SET_GUEST_MSI (0x20800305) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_EVENT_INTERFACE_ID << 8) | NV2080_CTRL_EVENT_SET_GUEST_MSI_PARAMS_MESSAGE_ID" */ 223 224 #define NV2080_CTRL_EVENT_SET_GUEST_MSI_PARAMS_MESSAGE_ID (0x5U) 225 226 typedef struct NV2080_CTRL_EVENT_SET_GUEST_MSI_PARAMS { 227 NV_DECLARE_ALIGNED(NvU64 guestMSIAddr, 8); 228 NvU32 guestMSIData; 229 NvHandle hSemMemory; 230 NvBool isReset; 231 NvU8 vgpuUuid[VM_UUID_SIZE]; 232 NV_DECLARE_ALIGNED(NvU64 domainId, 8); 233 } NV2080_CTRL_EVENT_SET_GUEST_MSI_PARAMS; 234 235 236 /* 237 * NV2080_CTRL_CMD_EVENT_SET_SEMA_MEM_VALIDATION 238 * 239 * hSemMemory 240 * This parameter specifies the handle of the memory object that 241 * identifies the semaphore memory associated with this subdevice 242 * event notification. Once this is set RM will generate an event 243 * only when there is a change in the semaphore value. It is 244 * expected that the semaphore memory value will be updated by 245 * the GPU indicating that there is an event pending. This 246 * command is used by VGX plugin to determine which virtual 247 * machine has generated a particular event. 248 * 249 * isSemaMemValidationEnabled 250 * This parameter used to enable/disable change in sema value check 251 * while generating an event. 252 * 253 * Possible status values returned are: 254 * NVOS_STATUS_SUCCESS 255 * NVOS_STATUS_ERROR_INVALID_OBJECT_HANDLE 256 * NVOS_STATUS_ERROR_INVALID_ARGUMENT 257 */ 258 259 260 #define NV2080_CTRL_CMD_EVENT_SET_SEMA_MEM_VALIDATION (0x20800306) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_EVENT_INTERFACE_ID << 8) | NV2080_CTRL_EVENT_SET_SEMA_MEM_VALIDATION_PARAMS_MESSAGE_ID" */ 261 262 #define NV2080_CTRL_EVENT_SET_SEMA_MEM_VALIDATION_PARAMS_MESSAGE_ID (0x6U) 263 264 typedef struct NV2080_CTRL_EVENT_SET_SEMA_MEM_VALIDATION_PARAMS { 265 NvHandle hSemMemory; 266 NvBool isSemaMemValidationEnabled; 267 } NV2080_CTRL_EVENT_SET_SEMA_MEM_VALIDATION_PARAMS; 268 269 270 /* 271 * NV2080_CTRL_CMD_EVENT_SET_TRIGGER_FIFO 272 * 273 * This command triggers a FIFO event for the associated subdevice. 274 * 275 * hEvent 276 * Handle of the event that should be notified. If zero, all 277 * non-stall interrupt events for this subdevice will be notified. 278 * 279 * Possible status values returned are: 280 * NV_OK 281 */ 282 #define NV2080_CTRL_CMD_EVENT_SET_TRIGGER_FIFO (0x20800308) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_EVENT_INTERFACE_ID << 8) | NV2080_CTRL_EVENT_SET_TRIGGER_FIFO_PARAMS_MESSAGE_ID" */ 283 284 #define NV2080_CTRL_EVENT_SET_TRIGGER_FIFO_PARAMS_MESSAGE_ID (0x8U) 285 286 typedef struct NV2080_CTRL_EVENT_SET_TRIGGER_FIFO_PARAMS { 287 NvHandle hEvent; 288 } NV2080_CTRL_EVENT_SET_TRIGGER_FIFO_PARAMS; 289 290 /* 291 * NV2080_CTRL_CMD_EVENT_VIDEO_BIND_EVTBUF_FOR_UID 292 * 293 * This command is used to create a video bind-point to an event buffer that 294 * is filtered by UID. 295 * 296 * hEventBuffer[IN] 297 * The event buffer to bind to 298 * 299 * recordSize[IN] 300 * The size of the FECS record in bytes 301 * 302 * levelOfDetail[IN] 303 * One of NV2080_CTRL_EVENT_VIDEO_BIND_EVTBUF_LOD_: 304 * FULL: Report all CtxSw events 305 * SIMPLE: Report engine start and engine end events only 306 * CUSTOM: Report events in the eventFilter field 307 * NOTE: RM may override the level-of-detail depending on the caller 308 * 309 * eventFilter[IN] 310 * Bitmask of events to report if levelOfDetail is CUSTOM 311 * 312 * bAllUsers[IN] 313 * Only report video data for the current user if false, for all users if true 314 * 315 * Possible status values returned are: 316 * NV_OK 317 * NV_ERR_INVALID_ARGUMENT 318 * NV_ERR_NOT_SUPPORTED 319 */ 320 #define NV2080_CTRL_CMD_EVENT_VIDEO_BIND_EVTBUF (0x20800309) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_EVENT_INTERFACE_ID << 8) | NV2080_CTRL_EVENT_VIDEO_BIND_EVTBUF_PARAMS_MESSAGE_ID" */ 321 322 typedef enum NV2080_CTRL_EVENT_VIDEO_BIND_EVTBUF_LOD { 323 NV2080_CTRL_EVENT_VIDEO_BIND_EVTBUF_LOD_FULL = 0, 324 NV2080_CTRL_EVENT_VIDEO_BIND_EVTBUF_LOD_SIMPLE = 1, 325 NV2080_CTRL_EVENT_VIDEO_BIND_EVTBUF_LOD_CUSTOM = 2, 326 } NV2080_CTRL_EVENT_VIDEO_BIND_EVTBUF_LOD; 327 328 #define NV2080_CTRL_EVENT_VIDEO_BIND_EVTBUF_PARAMS_MESSAGE_ID (0x9U) 329 330 typedef struct NV2080_CTRL_EVENT_VIDEO_BIND_EVTBUF_PARAMS { 331 NvHandle hEventBuffer; 332 NvU32 recordSize; 333 NV2080_CTRL_EVENT_VIDEO_BIND_EVTBUF_LOD levelOfDetail; 334 NvU32 eventFilter; 335 NvBool bAllUsers; 336 } NV2080_CTRL_EVENT_VIDEO_BIND_EVTBUF_PARAMS; 337 338 /* _ctrl2080event_h_ */ 339