aboutsummaryrefslogtreecommitdiffstats
path: root/include/lpwr/lpwr.h
diff options
context:
space:
mode:
authorJoshua Bakita <bakitajoshua@gmail.com>2023-06-28 18:24:25 -0400
committerJoshua Bakita <bakitajoshua@gmail.com>2023-06-28 18:24:25 -0400
commit01e6fac4d61fdd7fff5433942ec93fc2ea1e4df1 (patch)
tree4ef34501728a087be24f4ba0af90f91486bf780b /include/lpwr/lpwr.h
parent306a03d18b305e4e573be3b2931978fa10679eb9 (diff)
Include nvgpu headers
These are needed to build on NVIDIA's Jetson boards for the time being. Only a couple structs are required, so it should be fairly easy to remove this dependency at some point in the future.
Diffstat (limited to 'include/lpwr/lpwr.h')
-rw-r--r--include/lpwr/lpwr.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/include/lpwr/lpwr.h b/include/lpwr/lpwr.h
new file mode 100644
index 0000000..c38ba62
--- /dev/null
+++ b/include/lpwr/lpwr.h
@@ -0,0 +1,101 @@
1/*
2 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22#ifndef NVGPU_LPWR_H
23#define NVGPU_LPWR_H
24
25#define MAX_SWASR_MCLK_FREQ_WITHOUT_WR_TRAINING_MAXWELL_MHZ 540
26
27#define NV_PMU_PG_PARAM_MCLK_CHANGE_MS_SWASR_ENABLED BIT(0x1)
28#define NV_PMU_PG_PARAM_MCLK_CHANGE_GDDR5_WR_TRAINING_ENABLED BIT(0x3)
29
30#define LPWR_ENTRY_COUNT_MAX 0x06
31
32#define LPWR_VBIOS_IDX_ENTRY_COUNT_MAX (LPWR_ENTRY_COUNT_MAX)
33
34#define LPWR_VBIOS_IDX_ENTRY_RSVD \
35 (LPWR_VBIOS_IDX_ENTRY_COUNT_MAX - 1)
36
37#define LPWR_VBIOS_BASE_SAMPLING_PERIOD_DEFAULT (500)
38
39struct nvgpu_lpwr_bios_idx_entry {
40 u8 pcie_idx;
41 u8 gr_idx;
42 u8 ms_idx;
43 u8 di_idx;
44 u8 gc6_idx;
45};
46
47struct nvgpu_lpwr_bios_idx_data {
48 u16 base_sampling_period;
49 struct nvgpu_lpwr_bios_idx_entry entry[LPWR_VBIOS_IDX_ENTRY_COUNT_MAX];
50};
51
52#define LPWR_VBIOS_MS_ENTRY_COUNT_MAX (LPWR_ENTRY_COUNT_MAX)
53
54struct nvgpu_lpwr_bios_ms_entry {
55 bool ms_enabled;
56 u32 feature_mask;
57 u32 asr_efficiency_thresholdl;
58 u16 dynamic_current_logic;
59 u16 dynamic_current_sram;
60};
61
62struct nvgpu_lpwr_bios_ms_data {
63 u8 default_entry_idx;
64 u32 idle_threshold_us;
65 struct nvgpu_lpwr_bios_ms_entry entry[LPWR_VBIOS_MS_ENTRY_COUNT_MAX];
66};
67
68#define LPWR_VBIOS_GR_ENTRY_COUNT_MAX (LPWR_ENTRY_COUNT_MAX)
69
70struct nvgpu_lpwr_bios_gr_entry {
71 bool gr_enabled;
72 u32 feature_mask;
73};
74
75struct nvgpu_lpwr_bios_gr_data {
76 u8 default_entry_idx;
77 u32 idle_threshold_us;
78 u8 adaptive_gr_multiplier;
79 struct nvgpu_lpwr_bios_gr_entry entry[LPWR_VBIOS_GR_ENTRY_COUNT_MAX];
80};
81
82struct nvgpu_lpwr_bios_data {
83 struct nvgpu_lpwr_bios_idx_data idx;
84 struct nvgpu_lpwr_bios_ms_data ms;
85 struct nvgpu_lpwr_bios_gr_data gr;
86};
87
88struct obj_lwpr {
89 struct nvgpu_lpwr_bios_data lwpr_bios_data;
90 u32 mclk_change_cache;
91};
92
93u32 nvgpu_lpwr_pg_setup(struct gk20a *g);
94int nvgpu_lwpr_mclk_change(struct gk20a *g, u32 pstate);
95int nvgpu_lpwr_enable_pg(struct gk20a *g, bool pstate_lock);
96int nvgpu_lpwr_disable_pg(struct gk20a *g, bool pstate_lock);
97u32 nvgpu_lpwr_is_mscg_supported(struct gk20a *g, u32 pstate_num);
98u32 nvgpu_lpwr_is_rppg_supported(struct gk20a *g, u32 pstate_num);
99u32 nvgpu_lpwr_post_init(struct gk20a *g);
100
101#endif /* NVGPU_LPWR_H */