doc: add Meson coding style to contributors guide
[dpdk.git] / lib / librte_power / power_kvm_vm.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4
5 #ifndef _POWER_KVM_VM_H
6 #define _POWER_KVM_VM_H
7
8 /**
9  * @file
10  * RTE Power Management KVM VM
11  */
12
13 #include <rte_common.h>
14 #include <rte_byteorder.h>
15 #include <rte_log.h>
16 #include <rte_string_fns.h>
17 #include "rte_power.h"
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 /**
24  * Check if KVM power management is supported.
25  *
26  * @return
27  *   - 1 if supported
28  *   - 0 if unsupported
29  *   - -1 if error, with rte_errno indicating reason for error.
30  */
31 int power_kvm_vm_check_supported(void);
32
33 /**
34  * Initialize power management for a specific lcore.
35  *
36  * @param lcore_id
37  *  lcore id.
38  *
39  * @return
40  *  - 0 on success.
41  *  - Negative on error.
42  */
43 int power_kvm_vm_init(unsigned int lcore_id);
44
45 /**
46  * Exit power management on a specific lcore.
47  *
48  * @param lcore_id
49  *  lcore id.
50  *
51  * @return
52  *  - 0 on success.
53  *  - Negative on error.
54  */
55 int power_kvm_vm_exit(unsigned int lcore_id);
56
57 /**
58  * Get the available frequencies of a specific lcore.
59  * It is not currently supported for VM Power Management.
60  *
61  * @param lcore_id
62  *  lcore id.
63  * @param freqs
64  *  The buffer array to save the frequencies.
65  * @param num
66  *  The number of frequencies to get.
67  *
68  * @return
69  *  -ENOTSUP
70  */
71 uint32_t power_kvm_vm_freqs(unsigned int lcore_id, uint32_t *freqs,
72                 uint32_t num);
73
74 /**
75  * Return the current index of available frequencies of a specific lcore.
76  * It is not currently supported for VM Power Management.
77  *
78  * @param lcore_id
79  *  lcore id.
80  *
81  * @return
82  *  -ENOTSUP
83  */
84 uint32_t power_kvm_vm_get_freq(unsigned int lcore_id);
85
86 /**
87  * Set the new frequency for a specific lcore by indicating the index of
88  * available frequencies.
89  * It is not currently supported for VM Power Management.
90  *
91  * @param lcore_id
92  *  lcore id.
93  * @param index
94  *  The index of available frequencies.
95  *
96  * @return
97  *  -ENOTSUP
98  */
99 int power_kvm_vm_set_freq(unsigned int lcore_id, uint32_t index);
100
101 /**
102  * Scale up the frequency of a specific lcore. This request is forwarded to the
103  * host monitor.
104  * It should be protected outside of this function for threadsafe.
105  *
106  * @param lcore_id
107  *  lcore id.
108  *
109  * @return
110  *  - 1 on success.
111  *  - Negative on error.
112  */
113 int power_kvm_vm_freq_up(unsigned int lcore_id);
114
115 /**
116  * Scale down the frequency of a specific lcore according to the available
117  * frequencies.
118  * It should be protected outside of this function for threadsafe.
119  *
120  * @param lcore_id
121  *  lcore id.
122  *
123  * @return
124  *  - 1 on success.
125  *  - Negative on error.
126  */
127 int power_kvm_vm_freq_down(unsigned int lcore_id);
128
129 /**
130  * Scale up the frequency of a specific lcore to the highest according to the
131  * available frequencies.
132  * It should be protected outside of this function for threadsafe.
133  *
134  * @param lcore_id
135  *  lcore id.
136  *
137  * @return
138  *  - 1 on success.
139  *  - Negative on error.
140  */
141 int power_kvm_vm_freq_max(unsigned int lcore_id);
142
143 /**
144  * Scale down the frequency of a specific lcore to the lowest according to the
145  * available frequencies.
146  * It should be protected outside of this function for threadsafe.
147  *
148  * @param lcore_id
149  *  lcore id.
150  *
151  * @return
152  *  - 1 on success.
153  *  - Negative on error.
154  */
155 int power_kvm_vm_freq_min(unsigned int lcore_id);
156
157 /**
158  * It should be protected outside of this function for threadsafe.
159  *
160  * @param lcore_id
161  *  lcore id.
162  *
163  * @return
164  *  -ENOTSUP
165  */
166 int power_kvm_vm_turbo_status(unsigned int lcore_id);
167
168 /**
169  * It should be protected outside of this function for threadsafe.
170  *
171  * @param lcore_id
172  *  lcore id.
173  *
174  * @return
175  *  - 1 on success.
176  *  - Negative on error.
177  */
178 int power_kvm_vm_enable_turbo(unsigned int lcore_id);
179
180 /**
181  * It should be protected outside of this function for threadsafe.
182  *
183  * @param lcore_id
184  *  lcore id.
185  *
186  * @return
187  *  - 1 on success.
188  *  - Negative on error.
189  */
190 int power_kvm_vm_disable_turbo(unsigned int lcore_id);
191
192 /**
193  * Returns power capabilities for a specific lcore.
194  *
195  * @param lcore_id
196  *  lcore id.
197  * @param caps
198  *  pointer to rte_power_core_capabilities object.
199  *
200  * @return
201  *  - 0 on success.
202  *  - Negative on error.
203  */
204 int power_kvm_vm_get_capabilities(unsigned int lcore_id,
205                 struct rte_power_core_capabilities *caps);
206
207 #ifdef __cplusplus
208 }
209 #endif
210 #endif