1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2022 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 #ifndef KERNEL_PERF_GPU_BOOST_SYNC_H
25 #define KERNEL_PERF_GPU_BOOST_SYNC_H
26 
27 /* ------------------------ Includes --------------------------------------- */
28 #include "power/gpu_boost_mgr.h"
29 #include "ctrl/ctrl2080/ctrl2080internal.h"
30 
31 /* ------------------------ Macros ----------------------------------------- */
32 /* ------------------------ Datatypes -------------------------------------- */
33 /*
34  * GPU Boost synchronization info
35  */
36 struct KERNEL_PERF_GPU_BOOST_SYNC
37 {
38     /*!
39      * Cached GPU Boost synchronization limits.
40      */
41     NvU32   limits[NV2080_CTRL_INTERNAL_PERF_SYNC_GPU_BOOST_LIMITS_NUM];
42 
43     /*!
44      * Hysteresis value for GPU Boost synchronization hysteresis algorithm.
45      */
46     NvU64   hysteresisus;
47 
48     /*!
49      * Hysteresis algorithm for SLI GPU Boost synchronization enabled
50      */
51     NvBool  bHystersisEnable;
52 
53     /*!
54      * SLI GPU Boost feature is enabled.
55      */
56     NvBool  bSliGpuBoostSyncEnable;
57 
58     /*!
59      * Bridgeless information, supports only MIO bridge
60      */
61     NvBool  bBridgeless;
62 };
63 
64 /*!
65  * SLI GPU Boost synchronization sub-structure.
66  */
67 typedef struct
68 {
69     /*!
70      *  Timestamp of previous GPU Boost synchronization loop.
71      */
72     NvU64   prevChangeTsns;
73 
74     /*!
75      * Limits of previous GPU Boost synchronization loop.
76      */
77     NvU32   prevLimits[NV2080_CTRL_INTERNAL_PERF_SYNC_GPU_BOOST_LIMITS_NUM];
78 } SLI_GPU_BOOST_SYNC;
79 
80 /* ------------------------ Function Prototypes ---------------------------- */
81 NV_STATUS kperfGpuBoostSyncStateUpdate(OBJGPUBOOSTMGR *pBoostMgr, NvU32 boostGroupId, NvBool bActivate);
82 NV_STATUS kPerfGpuBoostSyncBridgelessUpdateInfo(OBJGPU *pGpu, NvBool bBridgeless);
83 
84 #endif // KERNEL_PERF_GPU_BOOST_SYNC_H
85