Blame view

include/kvm/arm_arch_timer.h 2.06 KB
53e724067   Marc Zyngier   ARM: KVM: arch_ti...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  /*
   * Copyright (C) 2012 ARM Ltd.
   * Author: Marc Zyngier <marc.zyngier@arm.com>
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with this program; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
   */
  
  #ifndef __ASM_ARM_KVM_ARCH_TIMER_H
  #define __ASM_ARM_KVM_ARCH_TIMER_H
  
  #include <linux/clocksource.h>
  #include <linux/hrtimer.h>
  #include <linux/workqueue.h>
  
  struct arch_timer_kvm {
53e724067   Marc Zyngier   ARM: KVM: arch_ti...
27
28
29
30
31
  	/* Is the timer enabled */
  	bool			enabled;
  
  	/* Virtual offset */
  	cycle_t			cntvoff;
53e724067   Marc Zyngier   ARM: KVM: arch_ti...
32
33
34
  };
  
  struct arch_timer_cpu {
53e724067   Marc Zyngier   ARM: KVM: arch_ti...
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  	/* Registers: control register, timer value */
  	u32				cntv_ctl;	/* Saved/restored */
  	cycle_t				cntv_cval;	/* Saved/restored */
  
  	/*
  	 * Anything that is not used directly from assembly code goes
  	 * here.
  	 */
  
  	/* Background timer used when the guest is not running */
  	struct hrtimer			timer;
  
  	/* Work queued with the above timer expires */
  	struct work_struct		expired;
  
  	/* Background timer active */
  	bool				armed;
  
  	/* Timer IRQ */
  	const struct kvm_irq_level	*irq;
53e724067   Marc Zyngier   ARM: KVM: arch_ti...
55
  };
53e724067   Marc Zyngier   ARM: KVM: arch_ti...
56
  int kvm_timer_hyp_init(void);
05971120f   Christoffer Dall   arm/arm64: KVM: R...
57
58
  void kvm_timer_enable(struct kvm *kvm);
  void kvm_timer_init(struct kvm *kvm);
5ae7f87a5   Anup Patel   ARM: KVM: Allow h...
59
60
  void kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu,
  			  const struct kvm_irq_level *irq);
53e724067   Marc Zyngier   ARM: KVM: arch_ti...
61
62
63
64
  void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);
  void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu);
  void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu);
  void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu);
1df08ba0a   Alex BennĂ©e   arm64: KVM: allow...
65
66
67
  
  u64 kvm_arm_timer_get_reg(struct kvm_vcpu *, u64 regid);
  int kvm_arm_timer_set_reg(struct kvm_vcpu *, u64 regid, u64 value);
1a7484788   Christoffer Dall   arm/arm64: KVM: F...
68
  bool kvm_timer_should_fire(struct kvm_vcpu *vcpu);
53e724067   Marc Zyngier   ARM: KVM: arch_ti...
69
  #endif