diff options
Diffstat (limited to 'include/kvm/arm_arch_timer.h')
-rw-r--r-- | include/kvm/arm_arch_timer.h | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h index f0053f884b4a..01ee473517e2 100644 --- a/include/kvm/arm_arch_timer.h +++ b/include/kvm/arm_arch_timer.h | |||
@@ -31,8 +31,15 @@ struct arch_timer_context { | |||
31 | /* Timer IRQ */ | 31 | /* Timer IRQ */ |
32 | struct kvm_irq_level irq; | 32 | struct kvm_irq_level irq; |
33 | 33 | ||
34 | /* Active IRQ state caching */ | 34 | /* |
35 | bool active_cleared_last; | 35 | * We have multiple paths which can save/restore the timer state |
36 | * onto the hardware, so we need some way of keeping track of | ||
37 | * where the latest state is. | ||
38 | * | ||
39 | * loaded == true: State is loaded on the hardware registers. | ||
40 | * loaded == false: State is stored in memory. | ||
41 | */ | ||
42 | bool loaded; | ||
36 | 43 | ||
37 | /* Virtual offset */ | 44 | /* Virtual offset */ |
38 | u64 cntvoff; | 45 | u64 cntvoff; |
@@ -43,13 +50,13 @@ struct arch_timer_cpu { | |||
43 | struct arch_timer_context ptimer; | 50 | struct arch_timer_context ptimer; |
44 | 51 | ||
45 | /* Background timer used when the guest is not running */ | 52 | /* Background timer used when the guest is not running */ |
46 | struct hrtimer timer; | 53 | struct hrtimer bg_timer; |
47 | 54 | ||
48 | /* Work queued with the above timer expires */ | 55 | /* Work queued with the above timer expires */ |
49 | struct work_struct expired; | 56 | struct work_struct expired; |
50 | 57 | ||
51 | /* Background timer active */ | 58 | /* Physical timer emulation */ |
52 | bool armed; | 59 | struct hrtimer phys_timer; |
53 | 60 | ||
54 | /* Is the timer enabled */ | 61 | /* Is the timer enabled */ |
55 | bool enabled; | 62 | bool enabled; |
@@ -59,7 +66,6 @@ int kvm_timer_hyp_init(void); | |||
59 | int kvm_timer_enable(struct kvm_vcpu *vcpu); | 66 | int kvm_timer_enable(struct kvm_vcpu *vcpu); |
60 | int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu); | 67 | int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu); |
61 | void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); | 68 | void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); |
62 | void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu); | ||
63 | void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu); | 69 | void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu); |
64 | bool kvm_timer_should_notify_user(struct kvm_vcpu *vcpu); | 70 | bool kvm_timer_should_notify_user(struct kvm_vcpu *vcpu); |
65 | void kvm_timer_update_run(struct kvm_vcpu *vcpu); | 71 | void kvm_timer_update_run(struct kvm_vcpu *vcpu); |
@@ -72,16 +78,22 @@ int kvm_arm_timer_set_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr); | |||
72 | int kvm_arm_timer_get_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr); | 78 | int kvm_arm_timer_get_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr); |
73 | int kvm_arm_timer_has_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr); | 79 | int kvm_arm_timer_has_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr); |
74 | 80 | ||
75 | bool kvm_timer_should_fire(struct arch_timer_context *timer_ctx); | 81 | bool kvm_timer_is_pending(struct kvm_vcpu *vcpu); |
82 | |||
76 | void kvm_timer_schedule(struct kvm_vcpu *vcpu); | 83 | void kvm_timer_schedule(struct kvm_vcpu *vcpu); |
77 | void kvm_timer_unschedule(struct kvm_vcpu *vcpu); | 84 | void kvm_timer_unschedule(struct kvm_vcpu *vcpu); |
78 | 85 | ||
79 | u64 kvm_phys_timer_read(void); | 86 | u64 kvm_phys_timer_read(void); |
80 | 87 | ||
88 | void kvm_timer_vcpu_load(struct kvm_vcpu *vcpu); | ||
81 | void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu); | 89 | void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu); |
82 | 90 | ||
83 | void kvm_timer_init_vhe(void); | 91 | void kvm_timer_init_vhe(void); |
84 | 92 | ||
85 | #define vcpu_vtimer(v) (&(v)->arch.timer_cpu.vtimer) | 93 | #define vcpu_vtimer(v) (&(v)->arch.timer_cpu.vtimer) |
86 | #define vcpu_ptimer(v) (&(v)->arch.timer_cpu.ptimer) | 94 | #define vcpu_ptimer(v) (&(v)->arch.timer_cpu.ptimer) |
95 | |||
96 | void enable_el1_phys_timer_access(void); | ||
97 | void disable_el1_phys_timer_access(void); | ||
98 | |||
87 | #endif | 99 | #endif |