New upstream version 18.08
[deb_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  * Initialize power management for a specific lcore.
25  *
26  * @param lcore_id
27  *  lcore id.
28  *
29  * @return
30  *  - 0 on success.
31  *  - Negative on error.
32  */
33 int power_kvm_vm_init(unsigned int lcore_id);
34
35 /**
36  * Exit power management on a specific lcore.
37  *
38  * @param lcore_id
39  *  lcore id.
40  *
41  * @return
42  *  - 0 on success.
43  *  - Negative on error.
44  */
45 int power_kvm_vm_exit(unsigned int lcore_id);
46
47 /**
48  * Get the available frequencies of a specific lcore.
49  * It is not currently supported for VM Power Management.
50  *
51  * @param lcore_id
52  *  lcore id.
53  * @param freqs
54  *  The buffer array to save the frequencies.
55  * @param num
56  *  The number of frequencies to get.
57  *
58  * @return
59  *  -ENOTSUP
60  */
61 uint32_t power_kvm_vm_freqs(unsigned int lcore_id, uint32_t *freqs,
62                 uint32_t num);
63
64 /**
65  * Return the current index of available frequencies of a specific lcore.
66  * It is not currently supported for VM Power Management.
67  *
68  * @param lcore_id
69  *  lcore id.
70  *
71  * @return
72  *  -ENOTSUP
73  */
74 uint32_t power_kvm_vm_get_freq(unsigned int lcore_id);
75
76 /**
77  * Set the new frequency for a specific lcore by indicating the index of
78  * available frequencies.
79  * It is not currently supported for VM Power Management.
80  *
81  * @param lcore_id
82  *  lcore id.
83  * @param index
84  *  The index of available frequencies.
85  *
86  * @return
87  *  -ENOTSUP
88  */
89 int power_kvm_vm_set_freq(unsigned int lcore_id, uint32_t index);
90
91 /**
92  * Scale up the frequency of a specific lcore. This request is forwarded to the
93  * host monitor.
94  * It should be protected outside of this function for threadsafe.
95  *
96  * @param lcore_id
97  *  lcore id.
98  *
99  * @return
100  *  - 1 on success.
101  *  - Negative on error.
102  */
103 int power_kvm_vm_freq_up(unsigned int lcore_id);
104
105 /**
106  * Scale down the frequency of a specific lcore according to the available
107  * frequencies.
108  * It should be protected outside of this function for threadsafe.
109  *
110  * @param lcore_id
111  *  lcore id.
112  *
113  * @return
114  *  - 1 on success.
115  *  - Negative on error.
116  */
117 int power_kvm_vm_freq_down(unsigned int lcore_id);
118
119 /**
120  * Scale up the frequency of a specific lcore to the highest according to the
121  * available frequencies.
122  * It should be protected outside of this function for threadsafe.
123  *
124  * @param lcore_id
125  *  lcore id.
126  *
127  * @return
128  *  - 1 on success.
129  *  - Negative on error.
130  */
131 int power_kvm_vm_freq_max(unsigned int lcore_id);
132
133 /**
134  * Scale down the frequency of a specific lcore to the lowest according to the
135  * available frequencies.
136  * It should be protected outside of this function for threadsafe.
137  *
138  * @param lcore_id
139  *  lcore id.
140  *
141  * @return
142  *  - 1 on success.
143  *  - Negative on error.
144  */
145 int power_kvm_vm_freq_min(unsigned int lcore_id);
146
147 /**
148  * It should be protected outside of this function for threadsafe.
149  *
150  * @param lcore_id
151  *  lcore id.
152  *
153  * @return
154  *  -ENOTSUP
155  */
156 int power_kvm_vm_turbo_status(unsigned int lcore_id);
157
158 /**
159  * It should be protected outside of this function for threadsafe.
160  *
161  * @param lcore_id
162  *  lcore id.
163  *
164  * @return
165  *  - 1 on success.
166  *  - Negative on error.
167  */
168 int power_kvm_vm_enable_turbo(unsigned int lcore_id);
169
170 /**
171  * It should be protected outside of this function for threadsafe.
172  *
173  * @param lcore_id
174  *  lcore id.
175  *
176  * @return
177  *  - 1 on success.
178  *  - Negative on error.
179  */
180 int power_kvm_vm_disable_turbo(unsigned int lcore_id);
181
182 /**
183  * Returns power capabilities for a specific lcore.
184  *
185  * @param lcore_id
186  *  lcore id.
187  * @param caps
188  *  pointer to rte_power_core_capabilities object.
189  *
190  * @return
191  *  - 0 on success.
192  *  - Negative on error.
193  */
194 int power_kvm_vm_get_capabilities(unsigned int lcore_id,
195                 struct rte_power_core_capabilities *caps);
196
197 #ifdef __cplusplus
198 }
199 #endif
200 #endif