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