physics-mv
FORGE: request-bound machine realization, providers and verification for AienOS. Host, simulated and GB10 hardware paths have separate evidence.
Brought by drakestapleton
physics-mv / third_party / nvidia-open-580.173.02 / kernel-open / common / inc / nv-ioctl.h
| 1 | /* |
| 2 | * SPDX-FileCopyrightText: Copyright (c) 2020-2025 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 | |
| 25 | #ifndef NV_IOCTL_H |
| 26 | #define NV_IOCTL_H |
| 27 | |
| 28 | #include <nv-ioctl-numbers.h> |
| 29 | #include <nvtypes.h> |
| 30 | |
| 31 | typedef struct { |
| 32 | NvU32 domain; /* PCI domain number */ |
| 33 | NvU8 bus; /* PCI bus number */ |
| 34 | NvU8 slot; /* PCI slot number */ |
| 35 | NvU8 function; /* PCI function number */ |
| 36 | NvU16 vendor_id; /* PCI vendor ID */ |
| 37 | NvU16 device_id; /* PCI device ID */ |
| 38 | } nv_pci_info_t; |
| 39 | |
| 40 | /* |
| 41 | * ioctl()'s with parameter structures too large for the |
| 42 | * _IOC cmd layout use the nv_ioctl_xfer_t structure |
| 43 | * and the NV_ESC_IOCTL_XFER_CMD ioctl() to pass the actual |
| 44 | * size and user argument pointer into the RM, which |
| 45 | * will then copy it to/from kernel space in separate steps. |
| 46 | */ |
| 47 | typedef struct nv_ioctl_xfer |
| 48 | { |
| 49 | NvU32 cmd; |
| 50 | NvU32 size; |
| 51 | NvP64 ptr NV_ALIGN_BYTES(8); |
| 52 | } nv_ioctl_xfer_t; |
| 53 | |
| 54 | typedef struct nv_ioctl_card_info |
| 55 | { |
| 56 | NvBool valid; |
| 57 | nv_pci_info_t pci_info; /* PCI config information */ |
| 58 | NvU32 gpu_id; |
| 59 | NvU16 interrupt_line; |
| 60 | NvU64 reg_address NV_ALIGN_BYTES(8); |
| 61 | NvU64 reg_size NV_ALIGN_BYTES(8); |
| 62 | NvU64 fb_address NV_ALIGN_BYTES(8); |
| 63 | NvU64 fb_size NV_ALIGN_BYTES(8); |
| 64 | NvU32 minor_number; |
| 65 | NvU8 dev_name[10]; /* device names such as vmgfx[0-32] for vmkernel */ |
| 66 | } nv_ioctl_card_info_t; |
| 67 | |
| 68 | /* alloc event */ |
| 69 | typedef struct nv_ioctl_alloc_os_event |
| 70 | { |
| 71 | NvHandle hClient; |
| 72 | NvHandle hDevice; |
| 73 | NvU32 fd; |
| 74 | NvU32 Status; |
| 75 | } nv_ioctl_alloc_os_event_t; |
| 76 | |
| 77 | /* free event */ |
| 78 | typedef struct nv_ioctl_free_os_event |
| 79 | { |
| 80 | NvHandle hClient; |
| 81 | NvHandle hDevice; |
| 82 | NvU32 fd; |
| 83 | NvU32 Status; |
| 84 | } nv_ioctl_free_os_event_t; |
| 85 | |
| 86 | /* status code */ |
| 87 | typedef struct nv_ioctl_status_code |
| 88 | { |
| 89 | NvU32 domain; |
| 90 | NvU8 bus; |
| 91 | NvU8 slot; |
| 92 | NvU32 status; |
| 93 | } nv_ioctl_status_code_t; |
| 94 | |
| 95 | /* check version string */ |
| 96 | #define NV_RM_API_VERSION_STRING_LENGTH 64 |
| 97 | |
| 98 | typedef struct nv_ioctl_rm_api_version |
| 99 | { |
| 100 | NvU32 cmd; |
| 101 | NvU32 reply; |
| 102 | char versionString[NV_RM_API_VERSION_STRING_LENGTH]; |
| 103 | } nv_ioctl_rm_api_version_t; |
| 104 | |
| 105 | #define NV_RM_API_VERSION_CMD_STRICT 0 |
| 106 | #define NV_RM_API_VERSION_CMD_RELAXED '1' |
| 107 | #define NV_RM_API_VERSION_CMD_QUERY '2' |
| 108 | |
| 109 | #define NV_RM_API_VERSION_REPLY_UNRECOGNIZED 0 |
| 110 | #define NV_RM_API_VERSION_REPLY_RECOGNIZED 1 |
| 111 | |
| 112 | typedef struct nv_ioctl_query_device_intr |
| 113 | { |
| 114 | NvU32 intrStatus NV_ALIGN_BYTES(4); |
| 115 | NvU32 status; |
| 116 | } nv_ioctl_query_device_intr; |
| 117 | |
| 118 | /* system parameters that the kernel driver may use for configuration */ |
| 119 | typedef struct nv_ioctl_sys_params |
| 120 | { |
| 121 | NvU64 memblock_size NV_ALIGN_BYTES(8); |
| 122 | } nv_ioctl_sys_params_t; |
| 123 | |
| 124 | typedef struct nv_ioctl_register_fd |
| 125 | { |
| 126 | int ctl_fd; |
| 127 | } nv_ioctl_register_fd_t; |
| 128 | |
| 129 | #define NV_DMABUF_EXPORT_MAX_HANDLES 128 |
| 130 | |
| 131 | #define NV_DMABUF_EXPORT_MAPPING_TYPE_DEFAULT 0 |
| 132 | #define NV_DMABUF_EXPORT_MAPPING_TYPE_FORCE_PCIE 1 |
| 133 | |
| 134 | typedef struct nv_ioctl_export_to_dma_buf_fd |
| 135 | { |
| 136 | int fd; |
| 137 | NvHandle hClient; |
| 138 | NvU32 totalObjects; |
| 139 | NvU32 numObjects; |
| 140 | NvU32 index; |
| 141 | NvU64 totalSize NV_ALIGN_BYTES(8); |
| 142 | NvU8 mappingType; |
| 143 | NvBool bAllowMmap; |
| 144 | NvHandle handles[NV_DMABUF_EXPORT_MAX_HANDLES]; |
| 145 | NvU64 offsets[NV_DMABUF_EXPORT_MAX_HANDLES] NV_ALIGN_BYTES(8); |
| 146 | NvU64 sizes[NV_DMABUF_EXPORT_MAX_HANDLES] NV_ALIGN_BYTES(8); |
| 147 | NvU32 status; |
| 148 | } nv_ioctl_export_to_dma_buf_fd_t; |
| 149 | |
| 150 | typedef struct nv_ioctl_wait_open_complete |
| 151 | { |
| 152 | int rc; |
| 153 | NvU32 adapterStatus; |
| 154 | } nv_ioctl_wait_open_complete_t; |
| 155 | |
| 156 | #endif |