1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2022-2023 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/ctrl00f1.finn
31 //
32 
33 #include "ctrl/ctrlxxxx.h"
34 #include "class/cl00e0.h"
35 
36 /*
37  * NV00F1_CTRL_CMD_GET_FABRIC_EVENTS
38  *
39  * Queries the fabric object for events.
40  *
41  *  eventArray [OUT]
42  *    An array of import lifetime events.
43  *
44  *  numEvents [OUT]
45  *    The number of valid events in eventArray.
46  *
47  *  bMoreEvents [OUT]
48  *    Whether there are any remaining events to be queried.
49  *
50  * Possible status values returned are:
51  *    NV_ERR_NOT_SUPPORTED
52  *    NV_OK
53  */
54 #define NV00F1_CTRL_CMD_GET_FABRIC_EVENTS               (0xf10001U) /* finn: Evaluated from "(FINN_IMEX_SESSION_INTERFACE_ID << 8) | NV00F1_CTRL_GET_FABRIC_EVENTS_PARAMS_MESSAGE_ID" */
55 
56 /* Event types */
57 #define NV00F1_CTRL_FABRIC_EVENT_TYPE_MEM_IMPORT        0U
58 #define NV00F1_CTRL_FABRIC_EVENT_TYPE_MEM_UNIMPORT      1U
59 #define NV00F1_CTRL_FABRIC_EVENT_TYPE_REMOTE_GPU_ATTACH 2U
60 #define NV00F1_CTRL_FABRIC_EVENT_TYPE_CLIQUE_ID_CHANGE  3U
61 
62 /*
63  *  id
64  *    Import ID. An import request can be uniquely identified using,
65  *    <packet.uuid + index + ID>.
66  *
67  *  index
68  *    Index of the export object to which the memory object is attached.
69  *
70  *  exportNodeId
71  *    ID of the exporter node where memory will be imported.
72  *
73  *  exportUuid
74  *    Universally unique identifier of the export object. This is extracted
75  *    from a fabric packet.
76  *
77 
78  */
79 typedef struct NV00F1_CTRL_FABRIC_MEM_IMPORT_EVENT_DATA {
80     NV_DECLARE_ALIGNED(NvU64 id, 8);
81     NvU16 index;
82     NvU16 exportNodeId;
83     NvU8  exportUuid[NV_MEM_EXPORT_UUID_LEN];
84 } NV00F1_CTRL_FABRIC_MEM_IMPORT_EVENT_DATA;
85 
86 /*
87  *  importEventId
88  *    ID of the corresponding import event.
89  *
90  *  exportNodeId
91  *    ID of the exporter node where memory will be unimported.
92  */
93 typedef struct NV00F1_CTRL_FABRIC_MEM_UNIMPORT_EVENT_DATA {
94     NV_DECLARE_ALIGNED(NvU64 importEventId, 8);
95     NvU16 exportNodeId;
96 } NV00F1_CTRL_FABRIC_MEM_UNIMPORT_EVENT_DATA;
97 
98 /*
99  *  gpuFabricProbeHandle [IN]
100  *    Fabric probe handle of the remote GPU
101  *
102  *  key [IN]
103  *    Key is used by the GFM in the MCFLA team response as an ID to allow the
104  *    RM to correlate it with the MCFLA team request.
105  *
106  *  cliqueId [IN]
107  *    Clique ID of the remote GPU being attached.
108  *
109  *  index
110  *    Index of the export object to which the memory object is attached.
111  *
112  *  exportNodeId
113  *    ID of the exporter node where memory will be imported.
114  *
115  *  exportUuid
116  *    Universally unique identifier of the export object. This is extracted
117  *    from a fabric packet.
118  */
119 typedef struct NV00F1_CTRL_ATTACH_REMOTE_GPU_EVENT_DATA {
120     NV_DECLARE_ALIGNED(NvU64 gpuFabricProbeHandle, 8);
121     NV_DECLARE_ALIGNED(NvU64 key, 8);
122     NvU32 cliqueId;
123     NvU16 index;
124     NvU16 exportNodeId;
125     NvU8  exportUuid[NV_MEM_EXPORT_UUID_LEN];
126 } NV00F1_CTRL_ATTACH_REMOTE_GPU_EVENT_DATA;
127 
128 /*
129  *  gpuId
130  *    GPU ID of the GPU whose cliqueID has changed.
131  *
132  *  cliqueId
133  *    Clique ID of the GPU.
134  */
135 typedef struct NV00F1_CTRL_CLIQUE_ID_CHANGE_GPU_EVENT_DATA {
136     NvU32 gpuId;
137     NvU32 cliqueId;
138 } NV00F1_CTRL_CLIQUE_ID_CHANGE_GPU_EVENT_DATA;
139 
140 /*
141  *  type
142  *    Event type, one of NV00F1_CTRL_FABRIC_EVENT_TYPE_*.
143  *
144  *  id
145  *    A monotonically increasing event ID.
146  *
147  *  imexChannel
148  *    imex channel subscribed by the caller.
149  *
150  *  data
151  *    Event data
152  */
153 typedef struct NV00F1_CTRL_FABRIC_EVENT {
154     NvU8  type;
155     NV_DECLARE_ALIGNED(NvU64 id, 8);
156     NvU32 imexChannel;
157 
158     union {
159         NV_DECLARE_ALIGNED(NV00F1_CTRL_FABRIC_MEM_IMPORT_EVENT_DATA import, 8);
160         NV_DECLARE_ALIGNED(NV00F1_CTRL_FABRIC_MEM_UNIMPORT_EVENT_DATA unimport, 8);
161         NV_DECLARE_ALIGNED(NV00F1_CTRL_ATTACH_REMOTE_GPU_EVENT_DATA attach, 8);
162         NV00F1_CTRL_CLIQUE_ID_CHANGE_GPU_EVENT_DATA cliqueIdChange;
163     } data;
164 } NV00F1_CTRL_FABRIC_EVENT;
165 
166 #define NV00F1_CTRL_GET_FABRIC_EVENTS_ARRAY_SIZE 128U
167 
168 #define NV00F1_CTRL_GET_FABRIC_EVENTS_PARAMS_MESSAGE_ID (0x1U)
169 
170 typedef struct NV00F1_CTRL_GET_FABRIC_EVENTS_PARAMS {
171     NV_DECLARE_ALIGNED(NV00F1_CTRL_FABRIC_EVENT eventArray[NV00F1_CTRL_GET_FABRIC_EVENTS_ARRAY_SIZE], 8);
172     NvU32  numEvents;
173     NvBool bMoreEvents;
174 } NV00F1_CTRL_GET_FABRIC_EVENTS_PARAMS;
175 
176 /*
177  * NV00F1_CTRL_CMD_FINISH_MEM_UNIMPORT
178  *
179  * Notifies the unimport sequence is finished.
180  *
181  *  tokenArray [IN]
182  *    An array of tokens that finished the unimport sequence.
183  *
184  *  numTokens [IN]
185  *    The number of valid tokens in the tokenArray.
186  *
187  * Possible status values returned are:
188  *    NV_ERR_OBJECT_NOT_FOUND
189  *    NV_ERR_NOT_SUPPORTED
190  *    NV_OK
191  */
192 #define NV00F1_CTRL_CMD_FINISH_MEM_UNIMPORT (0xf10002U) /* finn: Evaluated from "(FINN_IMEX_SESSION_INTERFACE_ID << 8) | NV00F1_CTRL_FINISH_MEM_UNIMPORT_PARAMS_MESSAGE_ID" */
193 
194 /*
195  *  unimportEventId
196  *    ID of the unimport event.
197  */
198 typedef struct NV00F1_CTRL_FABRIC_UNIMPORT_TOKEN {
199     NV_DECLARE_ALIGNED(NvU64 unimportEventId, 8);
200 } NV00F1_CTRL_FABRIC_UNIMPORT_TOKEN;
201 
202 #define NV00F1_CTRL_FINISH_MEM_UNIMPORT_ARRAY_SIZE 256U
203 
204 #define NV00F1_CTRL_FINISH_MEM_UNIMPORT_PARAMS_MESSAGE_ID (0x2U)
205 
206 typedef struct NV00F1_CTRL_FINISH_MEM_UNIMPORT_PARAMS {
207     NV_DECLARE_ALIGNED(NV00F1_CTRL_FABRIC_UNIMPORT_TOKEN tokenArray[NV00F1_CTRL_FINISH_MEM_UNIMPORT_ARRAY_SIZE], 8);
208     NvU32 numTokens;
209 } NV00F1_CTRL_FINISH_MEM_UNIMPORT_PARAMS;
210 
211 /*
212  * NV00F1_CTRL_CMD_DISABLE_IMPORTERS
213  *
214  *  Disables clients which imported memory from the given nodeId. Channel
215  *  recovery (disablement) sequence is also invoked to halt fabric traffic
216  *  from these clients.
217  *
218  *  nodeId [IN]
219  *    An array of tokens that finished the unimport sequence.
220  *
221  * Possible status values returned are:
222  *    NV_ERR_NOT_SUPPORTED
223  *    NV_OK
224  */
225 #define NV00F1_CTRL_CMD_DISABLE_IMPORTERS (0xf10003U) /* finn: Evaluated from "(FINN_IMEX_SESSION_INTERFACE_ID << 8) | NV00F1_CTRL_DISABLE_IMPORTERS_PARAMS_MESSAGE_ID" */
226 
227 #define NV00F1_CTRL_DISABLE_IMPORTERS_PARAMS_MESSAGE_ID (0x3U)
228 
229 typedef struct NV00F1_CTRL_DISABLE_IMPORTERS_PARAMS {
230     NvU16 nodeId;
231 } NV00F1_CTRL_DISABLE_IMPORTERS_PARAMS;
232 
233 /* _ctrl00f1.h_ */
234