Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


PMU Host Interface and initial implementation for Linux and AMD/Intel
[palacios.git] / palacios / src / interfaces / vmm_pmu.c
1 /* 
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.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2013, The V3VEE Project <http://www.v3vee.org> 
11  * All rights reserved.
12  *
13  * Author: Chang S. Bae  <chang.bae@eecs.northwestern.edu>
14  * 
15  * This is free software.  You are permitted to use,
16  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
17  */
18
19
20 #include <palacios/vmm.h>
21 #include <palacios/vmm_debug.h>
22 #include <palacios/vmm_types.h>
23 #include <palacios/vm_guest.h>
24 #include <palacios/vmm_lowlevel.h>
25 #include <interfaces/vmm_pmu.h>
26
27 struct v3_pmu_iface * palacios_pmu = 0;
28
29 /*
30  * functions
31  */
32
33 /*
34  * description: init pmu through the interface on this core
35  */
36
37 void v3_pmu_init(void) {
38
39     V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu != NULL);
40     V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu->init != NULL);
41
42     palacios_pmu->init();
43 }
44
45 /*
46  * description: actually stop pmu running through the interface
47  *              on this core
48  */
49 void v3_pmu_deinit(void) {
50
51     V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu != NULL);
52     V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu->deinit != NULL);
53
54     palacios_pmu->deinit();
55 }
56
57 /*
58  * description: init pmu through the interface
59  */
60
61 int v3_pmu_start_tracking(v3_pmon_ctr_t ctr) {
62
63     V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu != NULL);
64     V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu->start_tracking != NULL);
65
66     return palacios_pmu->start_tracking(ctr);
67 }
68
69 /*
70  * description: actually stop pmu running through the interface
71  */
72 int v3_pmu_stop_tracking(v3_pmon_ctr_t ctr) {
73
74     V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu != NULL);
75     V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu->stop_tracking != NULL);
76
77     return palacios_pmu->stop_tracking(ctr);
78 }
79
80 /*
81  * description: actually stop pmu running through the interface
82  */
83 uint64_t v3_pmu_get_value(v3_pmon_ctr_t ctr) {
84
85     V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu != NULL);
86     V3_ASSERT(VM_NONE, VCORE_NONE, palacios_pmu->get_value != NULL);
87
88     return palacios_pmu->get_value(ctr);
89 }
90
91
92 /*
93  * description: init whole interface to pmu 
94  */
95
96 void V3_Init_PMU(struct v3_pmu_iface * pmu_iface) {
97     palacios_pmu = pmu_iface;
98
99     return;
100 }
101
102