summaryrefslogtreecommitdiffstats
path: root/userspace/sdks/nv570/nvidia/inc/ctrl/ctrl00f8.h
blob: 595b021a36f2360d1edef08385cffb0bfcf468ef (plain)
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
/*
 * SPDX-FileCopyrightText: Copyright (c) 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/ctrl00f8.finn
//

#include "ctrl/ctrlxxxx.h"

#define NV00F8_CTRL_CMD(cat,idx)       NVXXXX_CTRL_CMD(0x00f8, NV00F8_CTRL_##cat, idx)

/* NV00F8 command categories (6bits) */
#define NV00F8_CTRL_RESERVED (0x00U)
#define NV00F8_CTRL_FABRIC   (0x01U)

/*
 * NV00F8_CTRL_CMD_NULL
 *
 * This command does nothing.
 * This command does not take any parameters.
 *
 * Possible status values returned are:
 *   NV_OK
 */
#define NV00F8_CTRL_CMD_NULL (0xf80000U) /* finn: Evaluated from "(FINN_NV_MEMORY_FABRIC_RESERVED_INTERFACE_ID << 8) | 0x0" */



/*
 * NV00F8_CTRL_CMD_GET_INFO
 *
 * Queries memory allocation attributes.
 *
 *  size [OUT]
 *    Size of the allocation.
 *
 *  pageSize [OUT]
 *    Page size of the allocation.
 *
 *  allocFlags [OUT]
 *    Flags passed during the allocation.
 *
 *  physAttrs [OUT]
 *    Physical attributes associated with memory allocation.
 *    For flexible mappings, it is not possible to retrieve this information,
 *    behavior is undefined (returns all zeros).
 */
#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" */

/*
 * addressSpace
 *     Same as NV0041_CTRL_SURFACE_INFO_INDEX_ADDR_SPACE_TYPE.
 *
 * compressionCoverage
 *     Same as NV0041_CTRL_SURFACE_INFO_INDEX_COMPR_COVERAGE.
 */
typedef struct NV_PHYSICAL_MEMORY_ATTRS {
    NvU32 addressSpace;
    NvU32 compressionCoverage;
} NV_PHYSICAL_MEMORY_ATTRS;

#define NV00F8_CTRL_GET_INFO_PARAMS_MESSAGE_ID (0x1U)

typedef struct NV00F8_CTRL_GET_INFO_PARAMS {
    NV_DECLARE_ALIGNED(NvU64 size, 8);
    NvU32                    pageSize;
    NvU32                    allocFlags;
    NV_PHYSICAL_MEMORY_ATTRS physAttrs;
} NV00F8_CTRL_GET_INFO_PARAMS;

/*
 * NV00F8_CTRL_CMD_DESCRIBE
 *
 * Queries the physical attributes of the fabric memory allocation.
 *
 *  offset [IN]
 *    Offset into memory allocation to query physical addresses for.
 *
 *  totalPfns [OUT]
 *    Number of PFNs in memory allocation.
 *
 *  pfnArray [OUT]
 *    Array of PFNs in memory allocation (2MB page size shifted).
 *
 *  numPfns [OUT]
 *    Number of valid entries in pfnArray.
 *
 * Note: This ctrl call is only available for kerenl mode client in vGPU platforms.
 */

#define NV00F8_CTRL_CMD_DESCRIBE            (0xf80102) /* finn: Evaluated from "(FINN_NV_MEMORY_FABRIC_FABRIC_INTERFACE_ID << 8) | NV00F8_CTRL_DESCRIBE_PARAMS_MESSAGE_ID" */

#define NV00F8_CTRL_DESCRIBE_PFN_ARRAY_SIZE 512

#define NV00F8_CTRL_DESCRIBE_PARAMS_MESSAGE_ID (0x2U)

typedef struct NV00F8_CTRL_DESCRIBE_PARAMS {
    NV_DECLARE_ALIGNED(NvU64 offset, 8);
    NV_DECLARE_ALIGNED(NvU64 totalPfns, 8);
    NvU32 pfnArray[NV00F8_CTRL_DESCRIBE_PFN_ARRAY_SIZE];
    NvU32 numPfns;
} NV00F8_CTRL_DESCRIBE_PARAMS;

/*
 *  hMemory [IN]
 *    Physical memory handle to be attached.
 *
 *  offset [IN]
 *    Offset into the fabric object.
 *    Must be physical memory pagesize aligned (at least).
 *
 *  mapOffSet [IN]
 *    Offset into the physical memory descriptor.
 *    Must be physical memory pagesize aligned.
 *
 *  mapLength [IN]
 *    Length of physical memory handle to be mapped.
 *    Must be physical memory pagesize aligned and less than or equal to
 *    fabric alloc size.
 */
typedef struct NV00F8_CTRL_ATTACH_MEM_INFO {
    NvHandle hMemory;
    NV_DECLARE_ALIGNED(NvU64 offset, 8);
    NV_DECLARE_ALIGNED(NvU64 mapOffset, 8);
    NV_DECLARE_ALIGNED(NvU64 mapLength, 8);
} NV00F8_CTRL_ATTACH_MEM_INFO;

/*
 * NV00F8_CTRL_CMD_ATTACH_MEM
 *
 * Attaches physical memory info to the fabric object.
 *
 *  memInfos [IN]
 *    Memory infos to be attached.
 *
 *  numMemInfos [IN]
 *    Number of memory infos to be attached.
 *
 *  flags [IN]
 *    For future use only. Must be zero for now.
 *
 *  numAttached [OUT]
 *    Successful attach count (returns a valid value on error too)
 *
 *  Restrictions:
 *  a. Physical memory with 2MB pagesize is allowed
 *  b. Only vidmem physical memory handle can be attached
 *  c. Supported only for flexible fabric objects.
 */
#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" */

#define NV00F8_MAX_ATTACHABLE_MEM_INFOS 64

#define NV00F8_CTRL_ATTACH_MEM_PARAMS_MESSAGE_ID (0x3U)

typedef struct NV00F8_CTRL_ATTACH_MEM_PARAMS {
    NV_DECLARE_ALIGNED(NV00F8_CTRL_ATTACH_MEM_INFO memInfos[NV00F8_MAX_ATTACHABLE_MEM_INFOS], 8);
    NvU16 numMemInfos;
    NvU32 flags;
    NvU16 numAttached;
} NV00F8_CTRL_ATTACH_MEM_PARAMS;

/*
 * NV00F8_CTRL_CMD_DETACH_MEM
 *
 * Detaches physical memory handle from the fabric object.
 *
 *  offsets [IN]
 *    Offsets at which memory was attached.
 *
 *  numOffsets [IN]
 *    Number of offsets to be detached.
 *
 *  flags [IN]
 *    For future use only. Must be zero for now.
 *
 *  numDetached [OUT]
 *    Successful detach count (returns a valid value on error too)
 */
#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" */

#define NV00F8_MAX_DETACHABLE_OFFSETS 64

#define NV00F8_CTRL_DETACH_MEM_PARAMS_MESSAGE_ID (0x4U)

typedef struct NV00F8_CTRL_DETACH_MEM_PARAMS {
    NV_DECLARE_ALIGNED(NvU64 offsets[NV00F8_MAX_DETACHABLE_OFFSETS], 8);
    NvU16 numOffsets;
    NvU32 flags;
    NvU16 numDetached;
} NV00F8_CTRL_DETACH_MEM_PARAMS;

/* _ctrl00f8_h_ */