4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 #include <cmdline_rdline.h>
43 #include <cmdline_parse.h>
44 #include <cmdline_parse_string.h>
45 #include <cmdline_parse_num.h>
46 #include <cmdline_socket.h>
49 #include "vm_power_cli.h"
50 #include "channel_manager.h"
51 #include "channel_monitor.h"
52 #include "power_manager.h"
53 #include "channel_commands.h"
55 struct cmd_quit_result
{
56 cmdline_fixed_string_t quit
;
59 static void cmd_quit_parsed(__attribute__((unused
)) void *parsed_result
,
61 __attribute__((unused
)) void *data
)
63 channel_monitor_exit();
64 channel_manager_exit();
69 cmdline_parse_token_string_t cmd_quit_quit
=
70 TOKEN_STRING_INITIALIZER(struct cmd_quit_result
, quit
, "quit");
72 cmdline_parse_inst_t cmd_quit
= {
73 .f
= cmd_quit_parsed
, /* function to call */
74 .data
= NULL
, /* 2nd arg of func */
75 .help_str
= "close the application",
76 .tokens
= { /* token list, NULL terminated */
77 (void *)&cmd_quit_quit
,
82 /* *** VM operations *** */
83 struct cmd_show_vm_result
{
84 cmdline_fixed_string_t show_vm
;
85 cmdline_fixed_string_t vm_name
;
89 cmd_show_vm_parsed(void *parsed_result
, struct cmdline
*cl
,
90 __attribute__((unused
)) void *data
)
92 struct cmd_show_vm_result
*res
= parsed_result
;
96 if (get_info_vm(res
->vm_name
, &info
) != 0)
98 cmdline_printf(cl
, "VM: '%s', status = ", info
.name
);
99 if (info
.status
== CHANNEL_MGR_VM_ACTIVE
)
100 cmdline_printf(cl
, "ACTIVE\n");
102 cmdline_printf(cl
, "INACTIVE\n");
103 cmdline_printf(cl
, "Channels %u\n", info
.num_channels
);
104 for (i
= 0; i
< info
.num_channels
; i
++) {
105 cmdline_printf(cl
, " [%u]: %s, status = ", i
,
106 info
.channels
[i
].channel_path
);
107 switch (info
.channels
[i
].status
) {
108 case CHANNEL_MGR_CHANNEL_CONNECTED
:
109 cmdline_printf(cl
, "CONNECTED\n");
111 case CHANNEL_MGR_CHANNEL_DISCONNECTED
:
112 cmdline_printf(cl
, "DISCONNECTED\n");
114 case CHANNEL_MGR_CHANNEL_DISABLED
:
115 cmdline_printf(cl
, "DISABLED\n");
117 case CHANNEL_MGR_CHANNEL_PROCESSING
:
118 cmdline_printf(cl
, "PROCESSING\n");
121 cmdline_printf(cl
, "UNKNOWN\n");
125 cmdline_printf(cl
, "Virtual CPU(s): %u\n", info
.num_vcpus
);
126 for (i
= 0; i
< info
.num_vcpus
; i
++) {
127 cmdline_printf(cl
, " [%u]: Physical CPU Mask 0x%"PRIx64
"\n", i
,
134 cmdline_parse_token_string_t cmd_vm_show
=
135 TOKEN_STRING_INITIALIZER(struct cmd_show_vm_result
,
137 cmdline_parse_token_string_t cmd_show_vm_name
=
138 TOKEN_STRING_INITIALIZER(struct cmd_show_vm_result
,
141 cmdline_parse_inst_t cmd_show_vm_set
= {
142 .f
= cmd_show_vm_parsed
,
144 .help_str
= "show_vm <vm_name>, prints the information on the "
145 "specified VM(s), the information lists the number of vCPUS, the "
146 "pinning to pCPU(s) as a bit mask, along with any communication "
147 "channels associated with each VM",
149 (void *)&cmd_vm_show
,
150 (void *)&cmd_show_vm_name
,
155 /* *** vCPU to pCPU mapping operations *** */
156 struct cmd_set_pcpu_mask_result
{
157 cmdline_fixed_string_t set_pcpu_mask
;
158 cmdline_fixed_string_t vm_name
;
164 cmd_set_pcpu_mask_parsed(void *parsed_result
, struct cmdline
*cl
,
165 __attribute__((unused
)) void *data
)
167 struct cmd_set_pcpu_mask_result
*res
= parsed_result
;
169 if (set_pcpus_mask(res
->vm_name
, res
->vcpu
, res
->core_mask
) == 0)
170 cmdline_printf(cl
, "Pinned vCPU(%"PRId8
") to pCPU core "
171 "mask(0x%"PRIx64
")\n", res
->vcpu
, res
->core_mask
);
173 cmdline_printf(cl
, "Unable to pin vCPU(%"PRId8
") to pCPU core "
174 "mask(0x%"PRIx64
")\n", res
->vcpu
, res
->core_mask
);
177 cmdline_parse_token_string_t cmd_set_pcpu_mask
=
178 TOKEN_STRING_INITIALIZER(struct cmd_set_pcpu_mask_result
,
179 set_pcpu_mask
, "set_pcpu_mask");
180 cmdline_parse_token_string_t cmd_set_pcpu_mask_vm_name
=
181 TOKEN_STRING_INITIALIZER(struct cmd_set_pcpu_mask_result
,
183 cmdline_parse_token_num_t set_pcpu_mask_vcpu
=
184 TOKEN_NUM_INITIALIZER(struct cmd_set_pcpu_mask_result
,
186 cmdline_parse_token_num_t set_pcpu_mask_core_mask
=
187 TOKEN_NUM_INITIALIZER(struct cmd_set_pcpu_mask_result
,
191 cmdline_parse_inst_t cmd_set_pcpu_mask_set
= {
192 .f
= cmd_set_pcpu_mask_parsed
,
194 .help_str
= "set_pcpu_mask <vm_name> <vcpu> <pcpu>, Set the binding "
195 "of Virtual CPU on VM to the Physical CPU mask.",
197 (void *)&cmd_set_pcpu_mask
,
198 (void *)&cmd_set_pcpu_mask_vm_name
,
199 (void *)&set_pcpu_mask_vcpu
,
200 (void *)&set_pcpu_mask_core_mask
,
205 struct cmd_set_pcpu_result
{
206 cmdline_fixed_string_t set_pcpu
;
207 cmdline_fixed_string_t vm_name
;
213 cmd_set_pcpu_parsed(void *parsed_result
, struct cmdline
*cl
,
214 __attribute__((unused
)) void *data
)
216 struct cmd_set_pcpu_result
*res
= parsed_result
;
218 if (set_pcpu(res
->vm_name
, res
->vcpu
, res
->core
) == 0)
219 cmdline_printf(cl
, "Pinned vCPU(%"PRId8
") to pCPU core "
220 "%"PRId8
")\n", res
->vcpu
, res
->core
);
222 cmdline_printf(cl
, "Unable to pin vCPU(%"PRId8
") to pCPU core "
223 "%"PRId8
")\n", res
->vcpu
, res
->core
);
226 cmdline_parse_token_string_t cmd_set_pcpu
=
227 TOKEN_STRING_INITIALIZER(struct cmd_set_pcpu_result
,
228 set_pcpu
, "set_pcpu");
229 cmdline_parse_token_string_t cmd_set_pcpu_vm_name
=
230 TOKEN_STRING_INITIALIZER(struct cmd_set_pcpu_result
,
232 cmdline_parse_token_num_t set_pcpu_vcpu
=
233 TOKEN_NUM_INITIALIZER(struct cmd_set_pcpu_result
,
235 cmdline_parse_token_num_t set_pcpu_core
=
236 TOKEN_NUM_INITIALIZER(struct cmd_set_pcpu_result
,
240 cmdline_parse_inst_t cmd_set_pcpu_set
= {
241 .f
= cmd_set_pcpu_parsed
,
243 .help_str
= "set_pcpu <vm_name> <vcpu> <pcpu>, Set the binding "
244 "of Virtual CPU on VM to the Physical CPU.",
246 (void *)&cmd_set_pcpu
,
247 (void *)&cmd_set_pcpu_vm_name
,
248 (void *)&set_pcpu_vcpu
,
249 (void *)&set_pcpu_core
,
254 struct cmd_vm_op_result
{
255 cmdline_fixed_string_t op_vm
;
256 cmdline_fixed_string_t vm_name
;
260 cmd_vm_op_parsed(void *parsed_result
, struct cmdline
*cl
,
261 __attribute__((unused
)) void *data
)
263 struct cmd_vm_op_result
*res
= parsed_result
;
265 if (!strcmp(res
->op_vm
, "add_vm")) {
266 if (add_vm(res
->vm_name
) < 0)
267 cmdline_printf(cl
, "Unable to add VM '%s'\n", res
->vm_name
);
268 } else if (remove_vm(res
->vm_name
) < 0)
269 cmdline_printf(cl
, "Unable to remove VM '%s'\n", res
->vm_name
);
272 cmdline_parse_token_string_t cmd_vm_op
=
273 TOKEN_STRING_INITIALIZER(struct cmd_vm_op_result
,
274 op_vm
, "add_vm#rm_vm");
275 cmdline_parse_token_string_t cmd_vm_name
=
276 TOKEN_STRING_INITIALIZER(struct cmd_vm_op_result
,
279 cmdline_parse_inst_t cmd_vm_op_set
= {
280 .f
= cmd_vm_op_parsed
,
282 .help_str
= "add_vm|rm_vm <name>, add a VM for "
283 "subsequent operations with the CLI or remove a previously added "
284 "VM from the VM Power Manager",
287 (void *)&cmd_vm_name
,
292 /* *** VM channel operations *** */
293 struct cmd_channels_op_result
{
294 cmdline_fixed_string_t op
;
295 cmdline_fixed_string_t vm_name
;
296 cmdline_fixed_string_t channel_list
;
299 cmd_channels_op_parsed(void *parsed_result
, struct cmdline
*cl
,
300 __attribute__((unused
)) void *data
)
302 unsigned num_channels
= 0, channel_num
, i
;
304 unsigned channel_list
[CHANNEL_CMDS_MAX_VM_CHANNELS
];
305 char *token
, *remaining
, *tail_ptr
;
306 struct cmd_channels_op_result
*res
= parsed_result
;
308 if (!strcmp(res
->channel_list
, "all")) {
309 channels_added
= add_all_channels(res
->vm_name
);
310 cmdline_printf(cl
, "Added %d channels for VM '%s'\n",
311 channels_added
, res
->vm_name
);
315 remaining
= res
->channel_list
;
317 if (remaining
== NULL
|| remaining
[0] == '\0')
320 token
= strsep(&remaining
, ",");
324 channel_num
= (unsigned)strtol(token
, &tail_ptr
, 10);
325 if ((errno
!= 0) || tail_ptr
== NULL
|| (*tail_ptr
!= '\0'))
328 if (channel_num
== CHANNEL_CMDS_MAX_VM_CHANNELS
) {
329 cmdline_printf(cl
, "Channel number '%u' exceeds the maximum number "
330 "of allowable channels(%u) for VM '%s'\n", channel_num
,
331 CHANNEL_CMDS_MAX_VM_CHANNELS
, res
->vm_name
);
334 channel_list
[num_channels
++] = channel_num
;
336 for (i
= 0; i
< num_channels
; i
++)
337 cmdline_printf(cl
, "[%u]: Adding channel %u\n", i
, channel_list
[i
]);
339 channels_added
= add_channels(res
->vm_name
, channel_list
,
341 cmdline_printf(cl
, "Enabled %d channels for '%s'\n", channels_added
,
345 cmdline_parse_token_string_t cmd_channels_op
=
346 TOKEN_STRING_INITIALIZER(struct cmd_channels_op_result
,
348 cmdline_parse_token_string_t cmd_channels_vm_name
=
349 TOKEN_STRING_INITIALIZER(struct cmd_channels_op_result
,
351 cmdline_parse_token_string_t cmd_channels_list
=
352 TOKEN_STRING_INITIALIZER(struct cmd_channels_op_result
,
355 cmdline_parse_inst_t cmd_channels_op_set
= {
356 .f
= cmd_channels_op_parsed
,
358 .help_str
= "add_channels <vm_name> <list>|all, add "
359 "communication channels for the specified VM, the "
360 "virtio channels must be enabled in the VM "
361 "configuration(qemu/libvirt) and the associated VM must be active. "
362 "<list> is a comma-separated list of channel numbers to add, using "
363 "the keyword 'all' will attempt to add all channels for the VM",
365 (void *)&cmd_channels_op
,
366 (void *)&cmd_channels_vm_name
,
367 (void *)&cmd_channels_list
,
372 struct cmd_channels_status_op_result
{
373 cmdline_fixed_string_t op
;
374 cmdline_fixed_string_t vm_name
;
375 cmdline_fixed_string_t channel_list
;
376 cmdline_fixed_string_t status
;
380 cmd_channels_status_op_parsed(void *parsed_result
, struct cmdline
*cl
,
381 __attribute__((unused
)) void *data
)
383 unsigned num_channels
= 0, channel_num
;
385 unsigned channel_list
[CHANNEL_CMDS_MAX_VM_CHANNELS
];
386 char *token
, *remaining
, *tail_ptr
;
387 struct cmd_channels_status_op_result
*res
= parsed_result
;
388 enum channel_status status
;
390 if (!strcmp(res
->status
, "enabled"))
391 status
= CHANNEL_MGR_CHANNEL_CONNECTED
;
393 status
= CHANNEL_MGR_CHANNEL_DISABLED
;
395 if (!strcmp(res
->channel_list
, "all")) {
396 changed
= set_channel_status_all(res
->vm_name
, status
);
397 cmdline_printf(cl
, "Updated status of %d channels "
398 "for VM '%s'\n", changed
, res
->vm_name
);
401 remaining
= res
->channel_list
;
403 if (remaining
== NULL
|| remaining
[0] == '\0')
405 token
= strsep(&remaining
, ",");
409 channel_num
= (unsigned)strtol(token
, &tail_ptr
, 10);
410 if ((errno
!= 0) || tail_ptr
== NULL
|| (*tail_ptr
!= '\0'))
413 if (channel_num
== CHANNEL_CMDS_MAX_VM_CHANNELS
) {
414 cmdline_printf(cl
, "%u exceeds the maximum number of allowable "
415 "channels(%u) for VM '%s'\n", channel_num
,
416 CHANNEL_CMDS_MAX_VM_CHANNELS
, res
->vm_name
);
419 channel_list
[num_channels
++] = channel_num
;
421 changed
= set_channel_status(res
->vm_name
, channel_list
, num_channels
,
423 cmdline_printf(cl
, "Updated status of %d channels "
424 "for VM '%s'\n", changed
, res
->vm_name
);
427 cmdline_parse_token_string_t cmd_channels_status_op
=
428 TOKEN_STRING_INITIALIZER(struct cmd_channels_status_op_result
,
429 op
, "set_channel_status");
430 cmdline_parse_token_string_t cmd_channels_status_vm_name
=
431 TOKEN_STRING_INITIALIZER(struct cmd_channels_status_op_result
,
433 cmdline_parse_token_string_t cmd_channels_status_list
=
434 TOKEN_STRING_INITIALIZER(struct cmd_channels_status_op_result
,
436 cmdline_parse_token_string_t cmd_channels_status
=
437 TOKEN_STRING_INITIALIZER(struct cmd_channels_status_op_result
,
438 status
, "enabled#disabled");
440 cmdline_parse_inst_t cmd_channels_status_op_set
= {
441 .f
= cmd_channels_status_op_parsed
,
443 .help_str
= "set_channel_status <vm_name> <list>|all enabled|disabled, "
444 " enable or disable the communication channels in "
445 "list(comma-separated) for the specified VM, alternatively "
446 "list can be replaced with keyword 'all'. "
447 "Disabled channels will still receive packets on the host, "
448 "however the commands they specify will be ignored. "
449 "Set status to 'enabled' to begin processing requests again.",
451 (void *)&cmd_channels_status_op
,
452 (void *)&cmd_channels_status_vm_name
,
453 (void *)&cmd_channels_status_list
,
454 (void *)&cmd_channels_status
,
459 /* *** CPU Frequency operations *** */
460 struct cmd_show_cpu_freq_mask_result
{
461 cmdline_fixed_string_t show_cpu_freq_mask
;
466 cmd_show_cpu_freq_mask_parsed(void *parsed_result
, struct cmdline
*cl
,
467 __attribute__((unused
)) void *data
)
469 struct cmd_show_cpu_freq_mask_result
*res
= parsed_result
;
471 uint64_t mask
= res
->core_mask
;
474 for (i
= 0; mask
; mask
&= ~(1ULL << i
++)) {
475 if ((mask
>> i
) & 1) {
476 freq
= power_manager_get_current_frequency(i
);
478 cmdline_printf(cl
, "Core %u: %"PRId32
"\n", i
, freq
);
483 cmdline_parse_token_string_t cmd_show_cpu_freq_mask
=
484 TOKEN_STRING_INITIALIZER(struct cmd_show_cpu_freq_mask_result
,
485 show_cpu_freq_mask
, "show_cpu_freq_mask");
486 cmdline_parse_token_num_t cmd_show_cpu_freq_mask_core_mask
=
487 TOKEN_NUM_INITIALIZER(struct cmd_show_cpu_freq_mask_result
,
490 cmdline_parse_inst_t cmd_show_cpu_freq_mask_set
= {
491 .f
= cmd_show_cpu_freq_mask_parsed
,
493 .help_str
= "show_cpu_freq_mask <mask>, Get the current frequency for each "
494 "core specified in the mask",
496 (void *)&cmd_show_cpu_freq_mask
,
497 (void *)&cmd_show_cpu_freq_mask_core_mask
,
502 struct cmd_set_cpu_freq_mask_result
{
503 cmdline_fixed_string_t set_cpu_freq_mask
;
505 cmdline_fixed_string_t cmd
;
509 cmd_set_cpu_freq_mask_parsed(void *parsed_result
, struct cmdline
*cl
,
510 __attribute__((unused
)) void *data
)
512 struct cmd_set_cpu_freq_mask_result
*res
= parsed_result
;
515 if (!strcmp(res
->cmd
, "up"))
516 ret
= power_manager_scale_mask_up(res
->core_mask
);
517 else if (!strcmp(res
->cmd
, "down"))
518 ret
= power_manager_scale_mask_down(res
->core_mask
);
519 else if (!strcmp(res
->cmd
, "min"))
520 ret
= power_manager_scale_mask_min(res
->core_mask
);
521 else if (!strcmp(res
->cmd
, "max"))
522 ret
= power_manager_scale_mask_max(res
->core_mask
);
524 cmdline_printf(cl
, "Error scaling core_mask(0x%"PRIx64
") '%s' , not "
525 "all cores specified have been scaled\n",
526 res
->core_mask
, res
->cmd
);
530 cmdline_parse_token_string_t cmd_set_cpu_freq_mask
=
531 TOKEN_STRING_INITIALIZER(struct cmd_set_cpu_freq_mask_result
,
532 set_cpu_freq_mask
, "set_cpu_freq_mask");
533 cmdline_parse_token_num_t cmd_set_cpu_freq_mask_core_mask
=
534 TOKEN_NUM_INITIALIZER(struct cmd_set_cpu_freq_mask_result
,
536 cmdline_parse_token_string_t cmd_set_cpu_freq_mask_result
=
537 TOKEN_STRING_INITIALIZER(struct cmd_set_cpu_freq_mask_result
,
538 cmd
, "up#down#min#max");
540 cmdline_parse_inst_t cmd_set_cpu_freq_mask_set
= {
541 .f
= cmd_set_cpu_freq_mask_parsed
,
543 .help_str
= "set_cpu_freq <core_mask> <up|down|min|max>, Set the current "
544 "frequency for the cores specified in <core_mask> by scaling "
545 "each up/down/min/max.",
547 (void *)&cmd_set_cpu_freq_mask
,
548 (void *)&cmd_set_cpu_freq_mask_core_mask
,
549 (void *)&cmd_set_cpu_freq_mask_result
,
556 struct cmd_show_cpu_freq_result
{
557 cmdline_fixed_string_t show_cpu_freq
;
562 cmd_show_cpu_freq_parsed(void *parsed_result
, struct cmdline
*cl
,
563 __attribute__((unused
)) void *data
)
565 struct cmd_show_cpu_freq_result
*res
= parsed_result
;
566 uint32_t curr_freq
= power_manager_get_current_frequency(res
->core_num
);
568 if (curr_freq
== 0) {
569 cmdline_printf(cl
, "Unable to get frequency for core %u\n",
573 cmdline_printf(cl
, "Core %u frequency: %"PRId32
"\n", res
->core_num
,
577 cmdline_parse_token_string_t cmd_show_cpu_freq
=
578 TOKEN_STRING_INITIALIZER(struct cmd_show_cpu_freq_result
,
579 show_cpu_freq
, "show_cpu_freq");
581 cmdline_parse_token_num_t cmd_show_cpu_freq_core_num
=
582 TOKEN_NUM_INITIALIZER(struct cmd_show_cpu_freq_result
,
585 cmdline_parse_inst_t cmd_show_cpu_freq_set
= {
586 .f
= cmd_show_cpu_freq_parsed
,
588 .help_str
= "Get the current frequency for the specified core",
590 (void *)&cmd_show_cpu_freq
,
591 (void *)&cmd_show_cpu_freq_core_num
,
596 struct cmd_set_cpu_freq_result
{
597 cmdline_fixed_string_t set_cpu_freq
;
599 cmdline_fixed_string_t cmd
;
603 cmd_set_cpu_freq_parsed(void *parsed_result
, struct cmdline
*cl
,
604 __attribute__((unused
)) void *data
)
607 struct cmd_set_cpu_freq_result
*res
= parsed_result
;
609 if (!strcmp(res
->cmd
, "up"))
610 ret
= power_manager_scale_core_up(res
->core_num
);
611 else if (!strcmp(res
->cmd
, "down"))
612 ret
= power_manager_scale_core_down(res
->core_num
);
613 else if (!strcmp(res
->cmd
, "min"))
614 ret
= power_manager_scale_core_min(res
->core_num
);
615 else if (!strcmp(res
->cmd
, "max"))
616 ret
= power_manager_scale_core_max(res
->core_num
);
618 cmdline_printf(cl
, "Error scaling core(%u) '%s'\n", res
->core_num
,
623 cmdline_parse_token_string_t cmd_set_cpu_freq
=
624 TOKEN_STRING_INITIALIZER(struct cmd_set_cpu_freq_result
,
625 set_cpu_freq
, "set_cpu_freq");
626 cmdline_parse_token_num_t cmd_set_cpu_freq_core_num
=
627 TOKEN_NUM_INITIALIZER(struct cmd_set_cpu_freq_result
,
629 cmdline_parse_token_string_t cmd_set_cpu_freq_cmd_cmd
=
630 TOKEN_STRING_INITIALIZER(struct cmd_set_cpu_freq_result
,
631 cmd
, "up#down#min#max");
633 cmdline_parse_inst_t cmd_set_cpu_freq_set
= {
634 .f
= cmd_set_cpu_freq_parsed
,
636 .help_str
= "set_cpu_freq <core_num> <up|down|min|max>, Set the current "
637 "frequency for the specified core by scaling up/down/min/max",
639 (void *)&cmd_set_cpu_freq
,
640 (void *)&cmd_set_cpu_freq_core_num
,
641 (void *)&cmd_set_cpu_freq_cmd_cmd
,
646 cmdline_parse_ctx_t main_ctx
[] = {
647 (cmdline_parse_inst_t
*)&cmd_quit
,
648 (cmdline_parse_inst_t
*)&cmd_vm_op_set
,
649 (cmdline_parse_inst_t
*)&cmd_channels_op_set
,
650 (cmdline_parse_inst_t
*)&cmd_channels_status_op_set
,
651 (cmdline_parse_inst_t
*)&cmd_show_vm_set
,
652 (cmdline_parse_inst_t
*)&cmd_show_cpu_freq_mask_set
,
653 (cmdline_parse_inst_t
*)&cmd_set_cpu_freq_mask_set
,
654 (cmdline_parse_inst_t
*)&cmd_show_cpu_freq_set
,
655 (cmdline_parse_inst_t
*)&cmd_set_cpu_freq_set
,
656 (cmdline_parse_inst_t
*)&cmd_set_pcpu_mask_set
,
657 (cmdline_parse_inst_t
*)&cmd_set_pcpu_set
,
662 run_cli(__attribute__((unused
)) void *arg
)
666 cl
= cmdline_stdin_new(main_ctx
, "vmpower> ");
670 cmdline_interact(cl
);
671 cmdline_stdin_exit(cl
);