xref: /illumos-kvm/kvm_timer.h (revision 2a9ff8dc)
1 /*
2  * GPL HEADER START
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16  *
17  * GPL HEADER END
18  *
19  * Copyright 2011 various Linux Kernel contributors.
20  * Copyright 2011 Joyent, Inc. All Rights Reserved.
21  */
22 
23 #ifndef __KVM_TIMER_H__
24 #define	__KVM_TIMER_H__
25 
26 #include <sys/types.h>
27 #include <sys/cyclic.h>
28 
29 typedef struct kvm_timer {
30 	cyclic_id_t kvm_cyclic_id;
31 	cyc_handler_t kvm_cyc_handler;
32 	cyc_time_t kvm_cyc_when;
33 	int active;
34 	int intervals;
35 	hrtime_t start;
36 	int64_t period; 		/* unit: ns */
37 	int pending;			/* accumulated triggered timers */
38 	int reinject;
39 	struct kvm_timer_ops *t_ops;
40 	struct kvm *kvm;
41 	struct kvm_vcpu *vcpu;
42 } kvm_timer_t;
43 
44 typedef struct kvm_timer_ops {
45 	int (*is_periodic)(struct kvm_timer *);
46 } kvm_timer_ops_t;
47 
48 extern void kvm_timer_fire(void *);
49 
50 #endif
51