aboutsummaryrefslogtreecommitdiffstats
path: root/include/kvm
diff options
context:
space:
mode:
authorJintack Lim <jintack@cs.columbia.edu>2017-02-03 10:19:59 -0500
committerMarc Zyngier <marc.zyngier@arm.com>2017-02-08 10:13:32 -0500
commitfbb4aeec5fc2ab47615b2a0cbabc503e1eef4c60 (patch)
treec4393d9305a159691d9af8ff6393fb8ed0753416 /include/kvm
parent0bdbf3b071986ba80731203683cf623d5c0cacb1 (diff)
KVM: arm/arm64: Abstract virtual timer context into separate structure
Abstract virtual timer context into a separate structure and change all callers referring to timer registers, irq state and so on. No change in functionality. This is about to become very handy when adding the EL1 physical timer. Signed-off-by: Jintack Lim <jintack@cs.columbia.edu> Acked-by: Christoffer Dall <christoffer.dall@linaro.org> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'include/kvm')
-rw-r--r--include/kvm/arm_arch_timer.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h
index 5c970ce67949..daad3c133b9f 100644
--- a/include/kvm/arm_arch_timer.h
+++ b/include/kvm/arm_arch_timer.h
@@ -28,15 +28,20 @@ struct arch_timer_kvm {
28 u64 cntvoff; 28 u64 cntvoff;
29}; 29};
30 30
31struct arch_timer_cpu { 31struct arch_timer_context {
32 /* Registers: control register, timer value */ 32 /* Registers: control register, timer value */
33 u32 cntv_ctl; /* Saved/restored */ 33 u32 cnt_ctl;
34 u64 cntv_cval; /* Saved/restored */ 34 u64 cnt_cval;
35
36 /* Timer IRQ */
37 struct kvm_irq_level irq;
38
39 /* Active IRQ state caching */
40 bool active_cleared_last;
41};
35 42
36 /* 43struct arch_timer_cpu {
37 * Anything that is not used directly from assembly code goes 44 struct arch_timer_context vtimer;
38 * here.
39 */
40 45
41 /* Background timer used when the guest is not running */ 46 /* Background timer used when the guest is not running */
42 struct hrtimer timer; 47 struct hrtimer timer;
@@ -47,12 +52,6 @@ struct arch_timer_cpu {
47 /* Background timer active */ 52 /* Background timer active */
48 bool armed; 53 bool armed;
49 54
50 /* Timer IRQ */
51 struct kvm_irq_level irq;
52
53 /* Active IRQ state caching */
54 bool active_cleared_last;
55
56 /* Is the timer enabled */ 55 /* Is the timer enabled */
57 bool enabled; 56 bool enabled;
58}; 57};
@@ -77,4 +76,6 @@ void kvm_timer_unschedule(struct kvm_vcpu *vcpu);
77void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu); 76void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu);
78 77
79void kvm_timer_init_vhe(void); 78void kvm_timer_init_vhe(void);
79
80#define vcpu_vtimer(v) (&(v)->arch.timer_cpu.vtimer)
80#endif 81#endif