1 /* 2 * SPDX-FileCopyrightText: Copyright (c) 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/ctrl00f8.finn 31 // 32 33 #include "ctrl/ctrlxxxx.h" 34 35 #define NV00F8_CTRL_CMD(cat,idx) NVXXXX_CTRL_CMD(0x00f8, NV00F8_CTRL_##cat, idx) 36 37 /* NV00F8 command categories (6bits) */ 38 #define NV00F8_CTRL_RESERVED (0x00U) 39 #define NV00F8_CTRL_FABRIC (0x01U) 40 41 /* 42 * NV00F8_CTRL_CMD_NULL 43 * 44 * This command does nothing. 45 * This command does not take any parameters. 46 * 47 * Possible status values returned are: 48 * NV_OK 49 */ 50 #define NV00F8_CTRL_CMD_NULL (0xf80000U) /* finn: Evaluated from "(FINN_NV_MEMORY_FABRIC_RESERVED_INTERFACE_ID << 8) | 0x0" */ 51 52 53 54 /* 55 * NV00F8_CTRL_CMD_GET_INFO 56 * 57 * Queries memory allocation attributes. 58 * 59 * size [OUT] 60 * Size of the allocation. 61 * 62 * pageSize [OUT] 63 * Page size of the allocation. 64 * 65 * allocFlags [OUT] 66 * Flags passed during the allocation. 67 * 68 * physAttrs [OUT] 69 * Physical attributes associated with memory allocation. 70 * For flexible mappings, it is not possible to retrieve this information, 71 * behavior is undefined (returns all zeros). 72 */ 73 #define NV00F8_CTRL_CMD_GET_INFO (0xf80101U) /* finn: Evaluated from "(FINN_NV_MEMORY_FABRIC_FABRIC_INTERFACE_ID << 8) | NV00F8_CTRL_GET_INFO_PARAMS_MESSAGE_ID" */ 74 75 /* 76 * addressSpace 77 * Same as NV0041_CTRL_SURFACE_INFO_INDEX_ADDR_SPACE_TYPE. 78 * 79 * compressionCoverage 80 * Same as NV0041_CTRL_SURFACE_INFO_INDEX_COMPR_COVERAGE. 81 */ 82 typedef struct NV_PHYSICAL_MEMORY_ATTRS { 83 NvU32 addressSpace; 84 NvU32 compressionCoverage; 85 } NV_PHYSICAL_MEMORY_ATTRS; 86 87 #define NV00F8_CTRL_GET_INFO_PARAMS_MESSAGE_ID (0x1U) 88 89 typedef struct NV00F8_CTRL_GET_INFO_PARAMS { 90 NV_DECLARE_ALIGNED(NvU64 size, 8); 91 NvU32 pageSize; 92 NvU32 allocFlags; 93 NV_PHYSICAL_MEMORY_ATTRS physAttrs; 94 } NV00F8_CTRL_GET_INFO_PARAMS; 95 96 /* 97 * NV00F8_CTRL_CMD_DESCRIBE 98 * 99 * Queries the physical attributes of the fabric memory allocation. 100 * 101 * offset [IN] 102 * Offset into memory allocation to query physical addresses for. 103 * 104 * totalPfns [OUT] 105 * Number of PFNs in memory allocation. 106 * 107 * pfnArray [OUT] 108 * Array of PFNs in memory allocation (2MB page size shifted). 109 * 110 * numPfns [OUT] 111 * Number of valid entries in pfnArray. 112 * 113 * Note: This ctrl call is only available for kerenl mode client in vGPU platforms. 114 */ 115 116 #define NV00F8_CTRL_CMD_DESCRIBE (0xf80102) /* finn: Evaluated from "(FINN_NV_MEMORY_FABRIC_FABRIC_INTERFACE_ID << 8) | NV00F8_CTRL_DESCRIBE_PARAMS_MESSAGE_ID" */ 117 118 #define NV00F8_CTRL_DESCRIBE_PFN_ARRAY_SIZE 512 119 120 #define NV00F8_CTRL_DESCRIBE_PARAMS_MESSAGE_ID (0x2U) 121 122 typedef struct NV00F8_CTRL_DESCRIBE_PARAMS { 123 NV_DECLARE_ALIGNED(NvU64 offset, 8); 124 NV_DECLARE_ALIGNED(NvU64 totalPfns, 8); 125 NvU32 pfnArray[NV00F8_CTRL_DESCRIBE_PFN_ARRAY_SIZE]; 126 NvU32 numPfns; 127 } NV00F8_CTRL_DESCRIBE_PARAMS; 128 129 /* 130 * hMemory 131 * Physical memory handle to be attached. 132 * 133 * offset 134 * Offset into the fabric object. 135 * Must be physical memory pagesize aligned (at least). 136 * 137 * mapOffSet 138 * Offset into the physical memory descriptor. 139 * Must be physical memory pagesize aligned. 140 * 141 * mapLength 142 * Length of physical memory handle to be mapped. 143 * Must be physical memory pagesize aligned and less than or equal to 144 * fabric alloc size. 145 */ 146 typedef struct NV00F8_CTRL_ATTACH_MEM_INFO { 147 NvHandle hMemory; 148 NV_DECLARE_ALIGNED(NvU64 offset, 8); 149 NV_DECLARE_ALIGNED(NvU64 mapOffset, 8); 150 NV_DECLARE_ALIGNED(NvU64 mapLength, 8); 151 } NV00F8_CTRL_ATTACH_MEM_INFO; 152 153 /* 154 * NV00F8_CTRL_CMD_ATTACH_MEM 155 * 156 * Attaches physical memory info to the fabric object. 157 * 158 * memInfos [IN] 159 * Memory infos to be attached. 160 * 161 * numMemInfos [IN] 162 * Number of memory infos to be attached. 163 * 164 * flags [IN] 165 * For future use only. Must be zero for now. 166 * 167 * numAttached [OUT] 168 * Successful attach count (returns a valid value on error too) 169 * 170 * Restrictions: 171 * a. Physical memory with 2MB pagesize is allowed 172 * b. Only vidmem physical memory handle can be attached 173 * c. Supported only for flexible fabric objects. 174 */ 175 #define NV00F8_CTRL_CMD_ATTACH_MEM (0xf80103) /* finn: Evaluated from "(FINN_NV_MEMORY_FABRIC_FABRIC_INTERFACE_ID << 8) | NV00F8_CTRL_ATTACH_MEM_PARAMS_MESSAGE_ID" */ 176 177 #define NV00F8_MAX_ATTACHABLE_MEM_INFOS 64 178 179 #define NV00F8_CTRL_ATTACH_MEM_PARAMS_MESSAGE_ID (0x3U) 180 181 typedef struct NV00F8_CTRL_ATTACH_MEM_PARAMS { 182 NV_DECLARE_ALIGNED(NV00F8_CTRL_ATTACH_MEM_INFO memInfos[NV00F8_MAX_ATTACHABLE_MEM_INFOS], 8); 183 NvU16 numMemInfos; 184 NvU32 flags; 185 NvU16 numAttached; 186 } NV00F8_CTRL_ATTACH_MEM_PARAMS; 187 188 /* 189 * NV00F8_CTRL_CMD_DETACH_MEM 190 * 191 * Detaches physical memory handle from the fabric object. 192 * 193 * offsets [IN] 194 * Offsets at which memory was attached. 195 * 196 * numOffsets [IN] 197 * Number of offsets to be detached. 198 * 199 * flags [IN] 200 * For future use only. Must be zero for now. 201 * 202 * numDetached [OUT] 203 * Successful detach count (returns a valid value on error too) 204 */ 205 #define NV00F8_CTRL_CMD_DETACH_MEM (0xf80104) /* finn: Evaluated from "(FINN_NV_MEMORY_FABRIC_FABRIC_INTERFACE_ID << 8) | NV00F8_CTRL_DETACH_MEM_PARAMS_MESSAGE_ID" */ 206 207 #define NV00F8_MAX_DETACHABLE_OFFSETS 64 208 209 #define NV00F8_CTRL_DETACH_MEM_PARAMS_MESSAGE_ID (0x4U) 210 211 typedef struct NV00F8_CTRL_DETACH_MEM_PARAMS { 212 NV_DECLARE_ALIGNED(NvU64 offsets[NV00F8_MAX_DETACHABLE_OFFSETS], 8); 213 NvU16 numOffsets; 214 NvU32 flags; 215 NvU16 numDetached; 216 } NV00F8_CTRL_DETACH_MEM_PARAMS; 217 218 /* 219 * NV00F8_CTRL_CMD_GET_NUM_ATTACHED_MEM 220 * 221 * Returns number of attached physical memory info to the fabric object in 222 * a given offset range. 223 * 224 * offsetStart [IN] 225 * Offsets at which memory was attached. 226 * 227 * offsetEnd [IN] 228 * Offsets at which memory was attached. 229 * 230 * numMemInfos [OUT] 231 * Number of memory infos. 232 */ 233 #define NV00F8_CTRL_CMD_GET_NUM_ATTACHED_MEM (0xf80105) /* finn: Evaluated from "(FINN_NV_MEMORY_FABRIC_FABRIC_INTERFACE_ID << 8) | NV00F8_CTRL_GET_NUM_ATTACHED_MEM_PARAMS_MESSAGE_ID" */ 234 235 #define NV00F8_CTRL_GET_NUM_ATTACHED_MEM_PARAMS_MESSAGE_ID (0x5U) 236 237 typedef struct NV00F8_CTRL_GET_NUM_ATTACHED_MEM_PARAMS { 238 NV_DECLARE_ALIGNED(NvU64 offsetStart, 8); 239 NV_DECLARE_ALIGNED(NvU64 offsetEnd, 8); 240 NvU16 numMemInfos; 241 } NV00F8_CTRL_GET_NUM_ATTACHED_MEM_PARAMS; 242 243 /* 244 * NV00F8_CTRL_CMD_GET_ATTACHED_MEM 245 * 246 * Queries attached physical memory info to the fabric object. 247 * 248 * offsetStart [IN] 249 * Offsets at which memory was attached. 250 * 251 * numMemInfos [IN] 252 * Number of memory infos to be filled. 253 * 254 * memInfos [IN/OUT] 255 * Attached memory infos. 256 * Use must populate a non-zero `hMemory` handle. This handle will be used by 257 * RM for duping physical memory. 258 */ 259 #define NV00F8_CTRL_CMD_GET_ATTACHED_MEM (0xf80106) /* finn: Evaluated from "(FINN_NV_MEMORY_FABRIC_FABRIC_INTERFACE_ID << 8) | NV00F8_CTRL_GET_ATTACHED_MEM_PARAMS_MESSAGE_ID" */ 260 261 #define NV00F8_MAX_ATTACHED_MEM_INFOS 64 262 263 #define NV00F8_CTRL_GET_ATTACHED_MEM_PARAMS_MESSAGE_ID (0x6U) 264 265 typedef struct NV00F8_CTRL_GET_ATTACHED_MEM_PARAMS { 266 NV_DECLARE_ALIGNED(NvU64 offsetStart, 8); 267 NvU16 numMemInfos; 268 NV_DECLARE_ALIGNED(NV00F8_CTRL_ATTACH_MEM_INFO memInfos[NV00F8_MAX_ATTACHED_MEM_INFOS], 8); 269 } NV00F8_CTRL_GET_ATTACHED_MEM_PARAMS; 270 271 /* _ctrl00f8_h_ */ 272