1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2018-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 //
27 // This file was generated with FINN, an NVIDIA coding tool.
28 // Source file:      ctrl/ctrlb0cc.finn
29 //
30 
31 
32 
33 
34 #include "ctrl/ctrlxxxx.h"
35 #include "ctrl/ctrl2080/ctrl2080gpu.h"  // NV2080_CTRL_GPU_REG_OP
36 #include "ctrlb0cc/ctrlb0ccprofiler.h"
37 #include "ctrlb0cc/ctrlb0ccinternal.h"
38 #include "ctrlb0cc/ctrlb0ccpower.h"
39 
40 /*
41  * NVB0CC_CTRL_CMD_PROFILER_REQUEST_CG_CONTROLS
42  *
43  * This command attempts to enable or disable various clock-gating features of
44  * the GPU on behalf of the profiler. If this command is unable to set the
45  * clock-gating feature state of any of the requested features, this command
46  * will fail and none of the requested features will be modified. If this
47  * command fails because one or more clock-gating feature requests were
48  * rejected, it will return NV_ERR_STATE_IN_USE in the globalStatus
49  * parameter and the fields in the statusMask parameter for the features for
50  * which the requests were rejected will have the value
51  * NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_*_REQUEST_REJECTED.
52  * If a given feature is not supported on the GPU, the field for that clock-
53  * gating feature will have the value
54  * NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_*_REQUEST_NOT_SUPPORTED in the
55  * statusMask parameter, but this condition by itself will not cause the
56  * command to fail. Even if this command fails, the field for clock-gating
57  * features which would have successfully changed will have the value
58  * NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_*_FULFILLED in the statusMask
59  * parameter.
60  *
61  * Each of the clock-gating features is reference-counted individually, so
62  * that multiple MAXWELL_PROFILER objects may request and rely on the same
63  * settings for the features simultaneously. Each clock-gating feature is
64  * locked to the requested state until the MAXWELL_PROFILER object is freed or
65  * the NVB0CC_CTRL_CMD_PROFILER_RELEASE_CG_CONTROLS command is called for that
66  * feature.
67  *
68  * Currently, only MAXWELL_PROFILER requests for power features using this
69  * command are reference counted. Changes to the power feature settings made
70  * either by other control commands or the RM itself may interfere with the
71  * settings requested by MAXWELL_PROFILER instances.
72  *
73  * This command will always return NV_OK when given valid
74  * parameters. If there is any other failure that prevents the clock-gating
75  * features from being set appropriately, the globalStatus parameter will
76  * indicate this and the statusMask parameter will indicate which clock-gating
77  * feature requests failed and why.
78  *
79  *   controlMask
80  *     This parameter indicates which clock-gating features the request should
81  *     apply to. This parameter has the following fields:
82  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG
83  *         The value of this field indicates whether this request should apply
84  *         to engine-level clock-gating of the GR engine. Valid values for
85  *         this field are:
86  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_IGNORE
87  *             This value indicates that the GR engine-level clock-gating
88  *             should be ignored. This will not affect the reference count for
89  *             this feature.
90  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_DISABLE
91  *             This value indicates that the GR engine-level clock-gating
92  *             should be disabled.
93  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_ENABLE
94  *             This value indicates that the GR engine-level clock-gating
95  *             should be enabled.
96  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG
97  *         The value of this field indicates whether this request should apply
98  *         to block-level clock-gating. Valid values for this field are:
99  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_IGNORE
100  *             This value indicates that block-level clock-gating should be
101  *             ignored. This will not affect the reference count for this
102  *             feature.
103  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_DISABLE
104  *             This value indicates that block-level clock-gating should be
105  *             disabled.
106  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_ENABLE
107  *             This value indicates that block-level clock-gating should be
108  *             enabled.
109  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG
110  *         The value of this field indicates whether this request should apply
111  *         to second-level clock-gating. Valid values for this field are:
112  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_IGNORE
113  *             This value indicates that second-level clock-gating should be
114  *             ignored. This will not affect the reference count for this
115  *             feature.
116  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_DISABLE
117  *             This value indicates that second-level clock-gating should be
118  *             disabled.
119  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_ENABLE
120  *             This value indicates that second-level clock-gating should be
121  *             enabled.
122  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG
123  *         The value of this field indicates whether this request should apply
124  *         to GR engine-level power-gating. Valid values for this field are:
125  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_IGNORE
126  *             This value indicates that engine-level power-gating should be
127  *             ignored. This will not affect the reference count for this
128  *             feature.
129  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_DISABLE
130  *             This value indicates that engine-level power-gating should be
131  *             disabled.
132  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_ENABLE
133  *             This value indicates that engine-level power-gating should be
134  *             enabled.
135  *         Note that this field is only temporary to allow reference counting
136  *         restricted to MAXWELL_PROFILER instances, until the time when the
137  *         existing controls for this power feature can be updated to support
138  *         reference counting across all clients and the RM.
139  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN
140  *         The value of this field indicates whether this request should apply
141  *         to SM idle slowdown. Valid values for this field are:
142  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_IGNORE
143  *             This value indicates that SM idle slowdown should be ignored.
144  *             This will not affect the reference count for this feature.
145  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_DISABLE
146  *             This value indicates that SM idle slowdown should be disabled.
147  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_ENABLE
148  *             This value indicates that SM idle slowdown should be enabled.
149  *         Note that this field is only temporary to allow reference counting
150  *         restricted to MAXWELL_PROFILER instances, until the time when the
151  *         existing controls for this power feature can be updated to support
152  *         reference counting across all clients and the RM.
153   *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT
154  *         The value of this field indicates whether this request should apply
155  *         to VAT. Valid values for this field are:
156  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_IGNORE
157  *             This value indicates that VAT should be ignored.
158  *             This will not affect the reference count for this feature.
159  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_DISABLE
160  *             This value indicates that VAT should be disabled.
161  *           NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_ENABLE
162  *             This value indicates that VAT should be enabled.
163  *         Note that this field is only temporary to allow reference counting
164  *         restricted to MAXWELL_PROFILER instances, until the time when the
165  *         existing controls for this power feature can be updated to support
166  *         reference counting across all clients and the RM.
167  *   globalStatus
168  *     This parameter returns the overall status of the requests for all
169  *     clock-gating controls. If the value of this parameter is not
170  *     NV_OK, none of the clock-gating controls will be set as
171  *     requested. Possible values for this parameter are:
172  *       NV_OK
173  *         This value indicates that all of the clock-gating control requests
174  *         were either fulfilled or not supported on the hardware.
175  *       NV_ERR_INVALID_REQUEST
176  *         This value indicates that at least one of the clock-gating control
177  *         requests were invalid given the MAXWELL_PROFILER instance's
178  *         outstanding requests.
179  *       NV_ERR_STATE_IN_USE
180  *         This value indicates that at least one of the clock-gating controls
181  *         has already been locked to a conflicting state by another
182  *         MAXWELL_PROFILER instance or the RM itself.
183  *   statusMask
184  *     This parameter returns the status of the request to set each clock-
185  *     gating control specified by the controlMask parameter. The fields are
186  *     identical to those of the controlMask parameter. For each field for
187  *     which the corresponding field in the controlMask parameter has the
188  *     value NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_*_IGNORE, the value is
189  *     undefined. For each field for which the corresponding field in the
190  *     controlMask parameter has the value
191  *     NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_*_REQUEST, the value will be
192  *     one of the following:
193  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_*_REQUEST_FULFILLED
194  *         This value indicates that the clock-gating feature corresponding to
195  *         the field in question was enabled or disabled according to the
196  *         controlMask parameter, and the reference count for the feature was
197  *         incremented accordingly.
198  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_*_REQUEST_REJECTED
199  *         This value indicates that the clock-gating feature corresponding to
200  *         the field in question was not set to the expected state according
201  *         to the controlMask parameter because another conflicting request is
202  *         currently outstanding for the clock-gating feature.
203  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_*_REQUEST_FAILED
204  *         This value indicates that the clock-gating feature corresponding to
205  *         the field in question was not set to the expected state according
206  *         to the controlMask parameter because the attempt to do so failed
207  *         with an error other than a conflicting request.
208  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_*_REQUEST_NOT_SUPPORTED
209  *         This value indicates that the clock-gating feature corresponding to
210  *         the field in question is not supported on this GPU.
211  *
212  * Possible status values returned are:
213  *    NV_OK
214  *    NV_ERR_INVALID_ARGUMENT
215  */
216 #define NVB0CC_CTRL_CMD_PROFILER_REQUEST_CG_CONTROLS NVB0CC_CTRL_CMD_POWER_REQUEST_FEATURES
217 
218 typedef NVB0CC_CTRL_POWER_REQUEST_FEATURES_PARAMS NVB0CC_CTRL_PROFILER_REQUEST_CG_CONTROLS_PARAMS;
219 
220 /* valid fields for the controlMask and statusMask parameters */
221 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG                 1:0
222 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG                 3:2
223 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG                 5:4
224 
225 /*
226  * The following are temporary fields for the controlMask and statusMask
227  * parameters. They are required to reference count their respective features
228  * until the existing RM controls can be safely updated, and the definitions
229  * for these features will be removed soon after that.
230  */
231 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG                 7:6
232 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN        9:8
233 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT                  11:10
234 
235 /* valid values for fields in the controlMask parameter */
236 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_IGNORE                                   (0x00000000)
237 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_DISABLE                                  (0x00000001)
238 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_ENABLE                                   (0x00000002)
239 
240 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_IGNORE                         NVB0CC_CTRL_PROFILER_CG_CONTROL_IGNORE
241 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_DISABLE                        NVB0CC_CTRL_PROFILER_CG_CONTROL_DISABLE
242 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_ENABLE                         NVB0CC_CTRL_PROFILER_CG_CONTROL_ENABLE
243 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_IGNORE                         NVB0CC_CTRL_PROFILER_CG_CONTROL_IGNORE
244 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_DISABLE                        NVB0CC_CTRL_PROFILER_CG_CONTROL_DISABLE
245 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_ENABLE                         NVB0CC_CTRL_PROFILER_CG_CONTROL_ENABLE
246 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_IGNORE                         NVB0CC_CTRL_PROFILER_CG_CONTROL_IGNORE
247 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_DISABLE                        NVB0CC_CTRL_PROFILER_CG_CONTROL_DISABLE
248 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_ENABLE                         NVB0CC_CTRL_PROFILER_CG_CONTROL_ENABLE
249 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_IGNORE                         NVB0CC_CTRL_PROFILER_CG_CONTROL_IGNORE
250 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_DISABLE                        NVB0CC_CTRL_PROFILER_CG_CONTROL_DISABLE
251 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_ENABLE                         NVB0CC_CTRL_PROFILER_CG_CONTROL_ENABLE
252 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_IGNORE                NVB0CC_CTRL_PROFILER_CG_CONTROL_IGNORE
253 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_DISABLE               NVB0CC_CTRL_PROFILER_CG_CONTROL_DISABLE
254 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_ENABLE                NVB0CC_CTRL_PROFILER_CG_CONTROL_ENABLE
255 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_IGNORE                          NVB0CC_CTRL_PROFILER_CG_CONTROL_IGNORE
256 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_DISABLE                         NVB0CC_CTRL_PROFILER_CG_CONTROL_DISABLE
257 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_ENABLE                          NVB0CC_CTRL_PROFILER_CG_CONTROL_ENABLE
258 /* possible values for fields in the statusMask parameter */
259 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FULFILLED                        (0x00000000)
260 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_REJECTED                         (0x00000001)
261 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_NOT_SUPPORTED                    (0x00000002)
262 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FAILED                           (0x00000003)
263 
264 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_REQUEST_FULFILLED              NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FULFILLED
265 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_REQUEST_REJECTED               NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_REJECTED
266 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_REQUEST_NOT_SUPPORTED          NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_NOT_SUPPORTED
267 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_REQUEST_FAILED                 NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FAILED
268 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_REQUEST_FULFILLED              NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FULFILLED
269 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_REQUEST_REJECTED               NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_REJECTED
270 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_REQUEST_NOT_SUPPORTED          NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_NOT_SUPPORTED
271 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_REQUEST_FAILED                 NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FAILED
272 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_REQUEST_FULFILLED              NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FULFILLED
273 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_REQUEST_REJECTED               NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_REJECTED
274 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_REQUEST_NOT_SUPPORTED          NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_NOT_SUPPORTED
275 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_REQUEST_FAILED                 NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FAILED
276 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_REQUEST_FULFILLED              NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FULFILLED
277 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_REQUEST_REJECTED               NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_REJECTED
278 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_REQUEST_NOT_SUPPORTED          NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_NOT_SUPPORTED
279 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_REQUEST_FAILED                 NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FAILED
280 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_REQUEST_FULFILLED     NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FULFILLED
281 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_REQUEST_REJECTED      NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_REJECTED
282 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_REQUEST_NOT_SUPPORTED NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_NOT_SUPPORTED
283 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_REQUEST_FAILED        NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FAILED
284 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_REQUEST_FULFILLED               NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FULFILLED
285 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_REQUEST_REJECTED                NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_REJECTED
286 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_REQUEST_NOT_SUPPORTED           NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_NOT_SUPPORTED
287 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_REQUEST_FAILED                  NVB0CC_CTRL_PROFILER_CG_CONTROL_REQUEST_FAILED
288 
289 /* utility masks for the controlMask parameter for all controls */
290 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ALL                             \
291     DRF_SHIFTMASK(NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG) |               \
292     DRF_SHIFTMASK(NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG) |               \
293     DRF_SHIFTMASK(NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG) |               \
294     DRF_SHIFTMASK(NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG) |               \
295     DRF_SHIFTMASK(NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN) |      \
296     DRF_SHIFTMASK(NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT)
297 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ALL_IGNORE                      \
298     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _ELCG, _IGNORE) |          \
299     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _BLCG, _IGNORE) |          \
300     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _SLCG, _IGNORE) |          \
301     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _ELPG, _IGNORE) |          \
302     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _IDLE_SLOWDOWN, _IGNORE) | \
303     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _VAT, _IGNORE)
304 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ALL_DISABLE                     \
305     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _ELCG, _DISABLE) |         \
306     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _BLCG, _DISABLE) |         \
307     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _SLCG, _DISABLE) |         \
308     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _ELPG, _DISABLE) |         \
309     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _IDLE_SLOWDOWN, _DISABLE)| \
310     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _VAT, _DISABLE)
311 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ALL_ENABLE                      \
312     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _ELCG, _ENABLE) |          \
313     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _BLCG, _ENABLE) |          \
314     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _SLCG, _ENABLE) |          \
315     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _ELPG, _ENABLE) |          \
316     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _IDLE_SLOWDOWN, _ENABLE) | \
317     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _VAT, _ENABLE)
318 
319 /*
320  * NVB0CC_CTRL_CMD_PROFILER_RELEASE_CG_CONTROLS
321  *
322  * This command is deprecated; please us
323  * NVB0CC_CTRL_CMD_POWER_RELEASE_FEATURES.
324  *
325  * This command releases the MAXWELL_PROFILER's request for the given clock-
326  * gating features that was previously created by the
327  * NVB0CC_CTRL_CMD_PROFILER_REQUEST_CG_CONTROLS command. If the MAXWELL_PROFILER
328  * object does not have an outstanding request to one or more of the given
329  * clock-gating features, those features will be ignored while the other
330  * feature requests will be released.
331  *
332  * After calling this command, the calling client may not rely on the current
333  * value of any of the released clock-gating features to remain, even if
334  * several identical requests for the given clock-gating features were made
335  * using NVB0CC_CTRL_CMD_PROFILER_REQUEST_CG_CONTROLS. The RM only reference-
336  * counts the settings requested by MAXWELL_PROFILER instances - it does not
337  * reference-count multiple identical requests made using the same
338  * MAXWELL_PROFILER instance.
339  *
340  * All outstanding requests made using this MAXWELL_PROFILER object are
341  * implicitly released when the MAXWELL_PROFILER is freed.
342  *
343  *   controlMask
344  *     This parameter indicates which clock-gating features the RM should
345  *     release the MAXWELL_PROFILER's reference to. See
346  *     NVB0CC_CTRL_CMD_PROFILER_REQUEST_CG_CONTROLS for valid fields. Valid
347  *     values for each field are:
348  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_IGNORE
349  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_IGNORE
350  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_IGNORE
351  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_IGNORE
352  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_IGNORE
353  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_IGNORE
354  *         This value indicates that the clock-gating feature associated with
355  *         the field should not be released, even if the MAXWELL_PROFILER has an
356  *         outstanding request for it. This will not affect the reference
357  *         count for the feature.
358  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_RELEASE
359  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_RELEASE
360  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_RELEASE
361  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_RELEASE
362  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_RELEASE
363  *       NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_RELEASE
364  *         This value indicates that the MAXWELL_PROFILER's outstanding request
365  *         for the clock-gating feature associated with the field should be
366  *         released. This will decrement the reference count for the feature
367  *         if the MAXWELL_PROFILER has an outstanding request for it.
368  *
369  * Possible status values returned are:
370  *    NV_OK
371  *    NV_ERR_INVALID_ARGUMENT
372  */
373 #define NVB0CC_CTRL_CMD_PROFILER_RELEASE_CG_CONTROLS                             NVB0CC_CTRL_CMD_POWER_RELEASE_FEATURES
374 
375 typedef NVB0CC_CTRL_POWER_RELEASE_FEATURES_PARAMS NVB0CC_CTRL_PROFILER_RELEASE_CG_CONTROLS_PARAMS;
376 
377 /*
378  * valid values for the controlMask parameter in addition to
379  * NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_*_IGNORE
380  */
381 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_RELEASE                    (0x00000003)
382 
383 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELCG_RELEASE          NVB0CC_CTRL_PROFILER_CG_CONTROL_RELEASE
384 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_BLCG_RELEASE          NVB0CC_CTRL_PROFILER_CG_CONTROL_RELEASE
385 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_SLCG_RELEASE          NVB0CC_CTRL_PROFILER_CG_CONTROL_RELEASE
386 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ELPG_RELEASE          NVB0CC_CTRL_PROFILER_CG_CONTROL_RELEASE
387 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_IDLE_SLOWDOWN_RELEASE NVB0CC_CTRL_PROFILER_CG_CONTROL_RELEASE
388 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_VAT_RELEASE           NVB0CC_CTRL_PROFILER_CG_CONTROL_RELEASE
389 
390 /* utility mask for the controlMask parameter for all fields */
391 #define NVB0CC_CTRL_PROFILER_CG_CONTROL_MASK_ALL_RELEASE                     \
392     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _ELCG, _RELEASE) |         \
393     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _BLCG, _RELEASE) |         \
394     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _SLCG, _RELEASE) |         \
395     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _ELPG, _RELEASE) |         \
396     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _IDLE_SLOWDOWN, _RELEASE)| \
397     DRF_DEF(B0CC, _CTRL_PROFILER_CG_CONTROL_MASK, _VAT, _RELEASE)
398