2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2014, the V3VEE Project <http://www.v3vee.org>
11 * all rights reserved.
13 * Author: Kyle C. Hale <kh@u.northwestern.edu>
14 * Shiva Rao <shiva.rao.717@gmail.com>
15 * Peter Dinda <pdinda@northwestern.edu>
17 * This is free software. you are permitted to use,
18 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
21 #include <palacios/vmm.h>
23 #include <interfaces/vmm_pstate_ctrl.h>
25 static struct v3_host_pstate_ctrl_iface *pstate_ctrl_hooks = 0;
28 void V3_Init_Pstate_Ctrl(struct v3_host_pstate_ctrl_iface *hooks)
30 pstate_ctrl_hooks = hooks;
32 PrintDebug(VM_NONE, VCORE_NONE, "V3 host p-state control interface inited\n");
38 void v3_get_cpu_pstate_chars(struct v3_cpu_pstate_chars *chars)
40 if (pstate_ctrl_hooks && pstate_ctrl_hooks->get_chars) {
41 pstate_ctrl_hooks->get_chars(chars);
46 void v3_acquire_pstate_ctrl(uint32_t type)
48 if (pstate_ctrl_hooks && pstate_ctrl_hooks->acquire) {
49 pstate_ctrl_hooks->acquire(type);
54 uint64_t v3_get_cpu_pstate(void)
56 if (pstate_ctrl_hooks && pstate_ctrl_hooks->get_pstate) {
57 return pstate_ctrl_hooks->get_pstate();
63 void v3_set_cpu_pstate (uint64_t p)
65 if (pstate_ctrl_hooks && pstate_ctrl_hooks->set_pstate) {
66 pstate_ctrl_hooks->set_pstate(p);
70 uint64_t v3_get_cpu_freq(void)
72 if (pstate_ctrl_hooks && pstate_ctrl_hooks->get_freq) {
73 return pstate_ctrl_hooks->get_freq();
79 void v3_set_cpu_freq(uint64_t f)
81 if (pstate_ctrl_hooks && pstate_ctrl_hooks->set_freq) {
82 pstate_ctrl_hooks->set_freq(f);
86 // If using direct control, relinquish
87 void v3_release_pstate_control()
89 if (pstate_ctrl_hooks && pstate_ctrl_hooks->release) {
90 pstate_ctrl_hooks->release();