1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
|
/*
* SPDX-FileCopyrightText: Copyright (c) 2009-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#pragma once
#include <nvtypes.h>
//
// This file was generated with FINN, an NVIDIA coding tool.
// Source file: ctrl/ctrl0000/ctrl0000unix.finn
//
#include "ctrl/ctrl0000/ctrl0000base.h"
#include "ctrl/ctrlxxxx.h"
/* NV01_ROOT (client) Linux control commands and parameters */
/*
* NV0000_CTRL_CMD_OS_UNIX_FLUSH_USER_CACHE
*
* This command may be used to force a cache flush for a range of virtual addresses in
* memory. Can be used for either user or kernel addresses.
*
* offset, length
* These parameters specify the offset within the memory block
* and the number of bytes to flush/invalidate
* cacheOps
* This parameter flags whether to flush, invalidate or do both.
* Possible values are:
* NV0000_CTRL_OS_UNIX_FLAGS_USER_CACHE_FLUSH
* NV0000_CTRL_OS_UNIX_FLAGS_USER_CACHE_INVALIDATE
* NV0000_CTRL_OS_UNIX_FLAGS_USER_CACHE_FLUSH_INVALIDATE
* hDevice
* This parameter is the handle to the device
* hObject
* This parameter is the handle to the memory structure being operated on.
* internalOnly
* Intended for internal use unless client is running in MODS UNIX environment,
* in which case this parameter specify the virtual address of the memory block
* to flush.
*
* Possible status values are:
* NV_OK
* NV_ERR_OBJECT_NOT_FOUND
* NV_ERR_INVALID_OBJECT_HANDLE
* NV_ERR_INVALID_COMMAND
* NV_ERR_INVALID_LIMIT
* NV_ERR_NOT_SUPPORTED
*/
#define NV0000_CTRL_CMD_OS_UNIX_FLUSH_USER_CACHE (0x3d02) /* finn: Evaluated from "(FINN_NV01_ROOT_OS_UNIX_INTERFACE_ID << 8) | NV0000_CTRL_OS_UNIX_FLUSH_USER_CACHE_PARAMS_MESSAGE_ID" */
#define NV0000_CTRL_OS_UNIX_FLUSH_USER_CACHE_PARAMS_MESSAGE_ID (0x2U)
typedef struct NV0000_CTRL_OS_UNIX_FLUSH_USER_CACHE_PARAMS {
NV_DECLARE_ALIGNED(NvU64 offset, 8);
NV_DECLARE_ALIGNED(NvU64 length, 8);
NvU32 cacheOps;
NvHandle hDevice;
NvHandle hObject;
NV_DECLARE_ALIGNED(NvU64 internalOnly, 8);
} NV0000_CTRL_OS_UNIX_FLUSH_USER_CACHE_PARAMS;
#define NV0000_CTRL_OS_UNIX_FLAGS_USER_CACHE_FLUSH (0x00000001)
#define NV0000_CTRL_OS_UNIX_FLAGS_USER_CACHE_INVALIDATE (0x00000002)
#define NV0000_CTRL_OS_UNIX_FLAGS_USER_CACHE_FLUSH_INVALIDATE (0x00000003)
/*
* NV0000_CTRL_CMD_OS_UNIX_GET_CONTROL_FILE_DESCRIPTOR
*
* This command is used to get the control file descriptor.
*
* Possible status values returned are:
* NV_OK
*
*/
#define NV0000_CTRL_CMD_OS_UNIX_GET_CONTROL_FILE_DESCRIPTOR (0x3d04) /* finn: Evaluated from "(FINN_NV01_ROOT_OS_UNIX_INTERFACE_ID << 8) | 0x4" */
typedef struct NV0000_CTRL_OS_UNIX_GET_CONTROL_FILE_DESCRIPTOR_PARAMS {
NvS32 fd;
} NV0000_CTRL_OS_UNIX_GET_CONTROL_FILE_DESCRIPTOR_PARAMS;
typedef enum NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TYPE {
NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TYPE_NONE = 0,
NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TYPE_RM = 1,
} NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TYPE;
typedef struct NV0000_CTRL_OS_UNIX_EXPORT_OBJECT {
NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TYPE type;
union {
struct {
NvHandle hDevice;
NvHandle hParent;
NvHandle hObject;
} rmObject;
} data;
} NV0000_CTRL_OS_UNIX_EXPORT_OBJECT;
/*
* NV0000_CTRL_CMD_OS_UNIX_EXPORT_OBJECT_TO_FD
*
* This command may be used to export NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TYPE
* object to file descriptor.
*
* Note that the 'fd' parameter is an input parameter at the kernel level, but
* an output parameter for usermode RMAPI clients -- the RMAPI library will
* open a new FD automatically if a usermode RMAPI client exports an object.
*
* Kernel-mode RM clients can export an object to an FD in two steps:
* 1. User client calls this RMControl with the flag 'EMPTY_FD_TRUE' to create
* an empty FD to receive the object, then passes that FD to the kernel-mode
* RM client.
* 2. Kernel-mode RM client fills in the rest of the
* NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TO_FD_PARAMS as usual and calls RM to
* associate its desired RM object with the empty FD from its usermode
* client.
*
* Possible status values returned are:
* NV_OK
* NV_ERR_NOT_SUPPORTED
* NV_ERR_OBJECT_NOT_FOUND
* NV_ERR_INVALID_OBJECT_HANDLE
* NV_ERR_INVALID_PARAMETER
*/
#define NV0000_CTRL_CMD_OS_UNIX_EXPORT_OBJECT_TO_FD (0x3d05) /* finn: Evaluated from "(FINN_NV01_ROOT_OS_UNIX_INTERFACE_ID << 8) | NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TO_FD_PARAMS_MESSAGE_ID" */
#define NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TO_FD_PARAMS_MESSAGE_ID (0x5U)
typedef struct NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TO_FD_PARAMS {
NV0000_CTRL_OS_UNIX_EXPORT_OBJECT object; /* IN */
NvS32 fd; /* IN/OUT */
NvU32 flags; /* IN */
} NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TO_FD_PARAMS;
/*
* If EMPTY_FD is TRUE, the 'fd' will be created but no object will be
* associated with it. The hDevice parameter is still required, to determine
* the correct device node on which to create the file descriptor.
* (An empty FD can then be passed to a kernel-mode driver to associate it with
* an actual object.)
*/
#define NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TO_FD_FLAGS_EMPTY_FD 0:0
#define NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TO_FD_FLAGS_EMPTY_FD_FALSE (0x00000000)
#define NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TO_FD_FLAGS_EMPTY_FD_TRUE (0x00000001)
/*
* NV0000_CTRL_CMD_OS_UNIX_IMPORT_OBJECT_FROM_FD
*
* This command may be used to import back
* NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TYPE object from file descriptor.
*
* Possible status values returned are:
* NV_OK
* NV_ERR_NOT_SUPPORTED
* NV_ERR_OBJECT_NOT_FOUND
* NV_ERR_INVALID_OBJECT_HANDLE
* NV_ERR_INVALID_PARAMETER
*/
#define NV0000_CTRL_CMD_OS_UNIX_IMPORT_OBJECT_FROM_FD (0x3d06) /* finn: Evaluated from "(FINN_NV01_ROOT_OS_UNIX_INTERFACE_ID << 8) | NV0000_CTRL_OS_UNIX_IMPORT_OBJECT_FROM_FD_PARAMS_MESSAGE_ID" */
#define NV0000_CTRL_OS_UNIX_IMPORT_OBJECT_FROM_FD_PARAMS_MESSAGE_ID (0x6U)
typedef struct NV0000_CTRL_OS_UNIX_IMPORT_OBJECT_FROM_FD_PARAMS {
NvS32 fd; /* IN */
NV0000_CTRL_OS_UNIX_EXPORT_OBJECT object; /* IN */
} NV0000_CTRL_OS_UNIX_IMPORT_OBJECT_FROM_FD_PARAMS;
/*
* NV0000_CTRL_CMD_OS_GET_GPU_INFO
*
* This command will query the OS specific info for the specified GPU.
*
* gpuId
* This parameter should specify a valid GPU ID value. If there
* is no GPU present with the specified ID, a status of
* NV_ERR_INVALID_ARGUMENT is returned.
* minorNum
* This parameter returns minor number of device node.
*
* Possible status values returned are:
* NV_OK
* NV_ERR_INVALID_ARGUMENT
*/
#define NV0000_CTRL_CMD_OS_GET_GPU_INFO (0x3d07) /* finn: Evaluated from "(FINN_NV01_ROOT_OS_UNIX_INTERFACE_ID << 8) | 0x7" */
typedef struct NV0000_CTRL_OS_GET_GPU_INFO_PARAMS {
NvU32 gpuId; /* IN */
NvU32 minorNum; /* OUT */
} NV0000_CTRL_OS_GET_GPU_INFO_PARAMS;
/*
* NV0000_CTRL_CMD_OS_UNIX_GET_EXPORT_OBJECT_INFO
*
* This command will query the deviceInstance for the specified FD
* which is referencing an exported object.
*
* fd
* File descriptor parameter is referencing an exported object on a Unix system.
*
* deviceInstatnce
* This parameter returns a deviceInstance on which the object is located.
*
* maxObjects
* This parameter returns the maximum number of object handles that may be
* contained in the file descriptor.
*
* metadata
* This parameter returns the user metadata passed into the
* _EXPORT_OBJECTS_TO_FD control call.
*
* Possible status values returned are:
* NV_OK
* NV_ERR_INVALID_ARGUMENT
* NV_ERR_OBJECT_NOT_FOUND
*/
#define NV0000_CTRL_CMD_OS_UNIX_GET_EXPORT_OBJECT_INFO (0x3d08) /* finn: Evaluated from "(FINN_NV01_ROOT_OS_UNIX_INTERFACE_ID << 8) | NV0000_CTRL_OS_UNIX_GET_EXPORT_OBJECT_INFO_PARAMS_MESSAGE_ID" */
#define NV0000_OS_UNIX_EXPORT_OBJECT_FD_BUFFER_SIZE 64
#define NV0000_CTRL_OS_UNIX_GET_EXPORT_OBJECT_INFO_PARAMS_MESSAGE_ID (0x8U)
typedef struct NV0000_CTRL_OS_UNIX_GET_EXPORT_OBJECT_INFO_PARAMS {
NvS32 fd; /* IN */
NvU32 deviceInstance; /* OUT */
NvU16 maxObjects; /* OUT */
NvU8 metadata[NV0000_OS_UNIX_EXPORT_OBJECT_FD_BUFFER_SIZE]; /* OUT */
} NV0000_CTRL_OS_UNIX_GET_EXPORT_OBJECT_INFO_PARAMS;
/*
* NV0000_CTRL_CMD_OS_UNIX_REFRESH_RMAPI_DEVICE_LIST
*
* This command will re-fetch probed GPUs information and update RMAPI library's
* internal detected GPU context information accordingly. Without this, GPUs
* attached to RM after RMAPI client initialization will not be accessible and
* all RMAPI library calls will fail on them.
* Currently this is used by NVSwitch Fabric Manager in conjunction with NVSwitch
* Shared Virtualization feature where GPUs are hot-plugged to OS/RM (by Hypervisor)
* and Fabric Manager is signaled externally by the Hypervisor to initialize those GPUs.
*
* Possible status values returned are:
* NV_OK
* NV_ERR_INVALID_STATE
* NV_ERR_OPERATING_SYSTEM
*/
#define NV0000_CTRL_CMD_OS_UNIX_REFRESH_RMAPI_DEVICE_LIST (0x3d09) /* finn: Evaluated from "(FINN_NV01_ROOT_OS_UNIX_INTERFACE_ID << 8) | 0x9" */
/*
* This control call has been deprecated. It will be deleted soon.
* Use NV0000_CTRL_CMD_OS_UNIX_EXPORT_OBJECT_TO_FD (singular) or
* NV0000_CTRL_CMD_OS_UNIX_EXPORT_OBJECTS_TO_FD (plural) instead.
*/
#define NV0000_CTRL_CMD_OS_UNIX_CREATE_EXPORT_OBJECT_FD (0x3d0a) /* finn: Evaluated from "(FINN_NV01_ROOT_OS_UNIX_INTERFACE_ID << 8) | NV0000_CTRL_OS_UNIX_CREATE_EXPORT_OBJECT_FD_PARAMS_MESSAGE_ID" */
#define NV0000_CTRL_OS_UNIX_CREATE_EXPORT_OBJECT_FD_BUFFER_SIZE NV0000_OS_UNIX_EXPORT_OBJECT_FD_BUFFER_SIZE
#define NV0000_CTRL_OS_UNIX_CREATE_EXPORT_OBJECT_FD_PARAMS_MESSAGE_ID (0xAU)
typedef struct NV0000_CTRL_OS_UNIX_CREATE_EXPORT_OBJECT_FD_PARAMS {
NvHandle hDevice; /* IN */
NvU16 maxObjects; /* IN */
NvU8 metadata[NV0000_CTRL_OS_UNIX_CREATE_EXPORT_OBJECT_FD_BUFFER_SIZE]; /* IN */
NvS32 fd; /* IN/OUT */
} NV0000_CTRL_OS_UNIX_CREATE_EXPORT_OBJECT_FD_PARAMS;
/*
* NV0000_CTRL_CMD_OS_UNIX_EXPORT_OBJECTS_TO_FD
*
* Exports RM handles to an fd that was provided, also creates an FD if
* requested.
*
* The objects in the 'handles' array are exported into the fd
* as the range [index, index + numObjects).
*
* If index + numObjects is greater than the maxObjects value used
* to create the file descriptor, NV_ERR_INVALID_PARAMETER is returned.
*
* If 'numObjects and 'index' overlap with a prior call, the newer call's RM object
* handles will overwrite the previously exported handles from the previous call.
* This overlapping behavior can also be used to unexport a handle by setting
* the appropriate object in 'objects' to 0.
*
* fd
* A file descriptor. If -1, a new FD will be created.
*
* hDevice
* The owning device of the objects to be exported (must be the same for
* all objects).
*
* maxObjects
* The total number of objects that the client wishes to export to the FD.
* This parameter will be honored only when the FD is getting created.
*
* metadata
* A buffer for clients to write some metadata to and pass to the importing
* client. This parameter will be honored only when the FD is getting
* created.
*
* objects
* Array of RM object handles to export to the fd.
*
* numObjects
* The number of handles the user wishes to export in this call.
*
* index
* The index into the export fd at which to start exporting the handles in
* 'objects' (for use in iterative calls).
*
* Possible status values returned are:
* NV_OK
* NV_ERR_OUT_OF_RANGE
* NV_ERR_NOT_SUPPORTED
* NV_ERR_OBJECT_NOT_FOUND
* NV_ERR_INVALID_OBJECT_HANDLE
*/
#define NV0000_CTRL_CMD_OS_UNIX_EXPORT_OBJECTS_TO_FD (0x3d0b) /* finn: Evaluated from "(FINN_NV01_ROOT_OS_UNIX_INTERFACE_ID << 8) | NV0000_CTRL_OS_UNIX_EXPORT_OBJECTS_TO_FD_PARAMS_MESSAGE_ID" */
#define NV0000_CTRL_OS_UNIX_EXPORT_OBJECTS_TO_FD_MAX_OBJECTS 512
#define NV0000_CTRL_OS_UNIX_EXPORT_OBJECTS_TO_FD_PARAMS_MESSAGE_ID (0xBU)
typedef struct NV0000_CTRL_OS_UNIX_EXPORT_OBJECTS_TO_FD_PARAMS {
NvS32 fd; /* IN/OUT */
NvHandle hDevice; /* IN */
NvU16 maxObjects; /* IN */
NvU8 metadata[NV0000_OS_UNIX_EXPORT_OBJECT_FD_BUFFER_SIZE]; /* IN */
NvHandle objects[NV0000_CTRL_OS_UNIX_EXPORT_OBJECTS_TO_FD_MAX_OBJECTS]; /* IN */
NvU16 numObjects; /* IN */
NvU16 index; /* IN */
} NV0000_CTRL_OS_UNIX_EXPORT_OBJECTS_TO_FD_PARAMS;
/*
* NV0000_CTRL_CMD_OS_UNIX_IMPORT_OBJECTS_FROM_FD
*
* This command can be used to import back RM handles
* that were exported to an fd using the
* NV0000_CTRL_CMD_OS_UNIX_EXPORT_OBJECTS_TO_FD control call.
*
* If index + numObjects is greater than the maxObjects value used
* to create the file descriptor, NV_ERR_INVALID_PARAMETER is returned
* and no objects are imported.
*
* For each valid handle in the 'objects' array parameter at index 'i',
* the corresponding object handle at index ('i' + 'index') contained by
* the fd will be imported. If the object at index ('i' + 'index') has
* not been exported into the fd, no object will be imported.
*
* If any of handles contained in the 'objects' array parameter are invalid
* and the corresponding export object handle is valid,
* NV_ERR_INVALID_PARAMETER will be returned and no handles will be imported.
*
* fd
* The export fd on which to import handles out of.
*
* hParent
* The parent RM handle of which all of the exported objects will
* be duped under.
*
* objects
* An array of RM handles. The exported objects will be duped under
* these handles during the import process.
*
* objectTypes
* An array of RM handle types. The type _NONE will be returned if
* the object was not imported. Other possible object types are
* mentioned below.
*
* numObjects
* The number of valid object handles in the 'objects' array. This should
* be set to the number of objects that the client wishes to import.
*
* index
* The index into the fd in which to start importing from. For
* use in iterative calls.
*
* Possible status values returned are:
* NV_OK
* NV_ERR_OUT_OF_RANGE
* NV_ERR_NOT_SUPPORTED
* NV_ERR_OBJECT_NOT_FOUND
* NV_ERR_INVALID_OBJECT_HANDLE
* NV_ERR_INVALID_PARAMETER
*/
#define NV0000_CTRL_CMD_OS_UNIX_IMPORT_OBJECTS_FROM_FD (0x3d0c) /* finn: Evaluated from "(FINN_NV01_ROOT_OS_UNIX_INTERFACE_ID << 8) | NV0000_CTRL_OS_UNIX_IMPORT_OBJECTS_FROM_FD_PARAMS_MESSAGE_ID" */
//
// TODO Bump this back up to 512 after the FLA revamp is complete
//
#define NV0000_CTRL_OS_UNIX_IMPORT_OBJECTS_TO_FD_MAX_OBJECTS 128
#define NV0000_CTRL_CMD_OS_UNIX_IMPORT_OBJECT_TYPE_NONE 0
#define NV0000_CTRL_CMD_OS_UNIX_IMPORT_OBJECT_TYPE_VIDMEM 1
#define NV0000_CTRL_CMD_OS_UNIX_IMPORT_OBJECT_TYPE_SYSMEM 2
#define NV0000_CTRL_CMD_OS_UNIX_IMPORT_OBJECT_TYPE_FABRIC 3
#define NV0000_CTRL_OS_UNIX_IMPORT_OBJECTS_FROM_FD_PARAMS_MESSAGE_ID (0xCU)
typedef struct NV0000_CTRL_OS_UNIX_IMPORT_OBJECTS_FROM_FD_PARAMS {
NvS32 fd; /* IN */
NvHandle hParent; /* IN */
NvHandle objects[NV0000_CTRL_OS_UNIX_IMPORT_OBJECTS_TO_FD_MAX_OBJECTS]; /* IN */
NvU8 objectTypes[NV0000_CTRL_OS_UNIX_IMPORT_OBJECTS_TO_FD_MAX_OBJECTS]; /* OUT */
NvU16 numObjects; /* IN */
NvU16 index; /* IN */
} NV0000_CTRL_OS_UNIX_IMPORT_OBJECTS_FROM_FD_PARAMS;
/* _ctrl0000unix_h_ */
|