aboutsummaryrefslogtreecommitdiffstats
path: root/include/kvm/arm_arch_timer.h
diff options
context:
space:
mode:
authorRadim Krčmář <rkrcmar@redhat.com>2017-11-08 09:28:34 -0500
committerRadim Krčmář <rkrcmar@redhat.com>2017-11-08 09:28:34 -0500
commitf0d438e4fb35244efc035a0c55ef876cc75a0abb (patch)
tree4044e4f4c0908ac9ad916f535044a398c106bbd7 /include/kvm/arm_arch_timer.h
parent6d6ab940dc8b1c84fc86195c0f15a82ef282c8a3 (diff)
parenta2b83133339067c1b27f902e32506ab2871e2320 (diff)
Merge tag 'kvm-arm-for-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into next
KVM/ARM Changes for v4.15 Changes include: - Optimized arch timer handling for KVM/ARM - Improvements to the VGIC ITS code and introduction of an ITS reset ioctl - Unification of the 32-bit fault injection logic - More exact external abort matching logic
Diffstat (limited to 'include/kvm/arm_arch_timer.h')
-rw-r--r--include/kvm/arm_arch_timer.h26
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);
59int kvm_timer_enable(struct kvm_vcpu *vcpu); 66int kvm_timer_enable(struct kvm_vcpu *vcpu);
60int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu); 67int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu);
61void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); 68void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);
62void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu);
63void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu); 69void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu);
64bool kvm_timer_should_notify_user(struct kvm_vcpu *vcpu); 70bool kvm_timer_should_notify_user(struct kvm_vcpu *vcpu);
65void kvm_timer_update_run(struct kvm_vcpu *vcpu); 71void 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);
72int kvm_arm_timer_get_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr); 78int kvm_arm_timer_get_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr);
73int kvm_arm_timer_has_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr); 79int kvm_arm_timer_has_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr);
74 80
75bool kvm_timer_should_fire(struct arch_timer_context *timer_ctx); 81bool kvm_timer_is_pending(struct kvm_vcpu *vcpu);
82
76void kvm_timer_schedule(struct kvm_vcpu *vcpu); 83void kvm_timer_schedule(struct kvm_vcpu *vcpu);
77void kvm_timer_unschedule(struct kvm_vcpu *vcpu); 84void kvm_timer_unschedule(struct kvm_vcpu *vcpu);
78 85
79u64 kvm_phys_timer_read(void); 86u64 kvm_phys_timer_read(void);
80 87
88void kvm_timer_vcpu_load(struct kvm_vcpu *vcpu);
81void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu); 89void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu);
82 90
83void kvm_timer_init_vhe(void); 91void 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
96void enable_el1_phys_timer_access(void);
97void disable_el1_phys_timer_access(void);
98
87#endif 99#endif