===================================================================
@@ -375,6 +375,8 @@ struct kvm_vcpu_arch {
u64 mcg_status;
u64 mcg_ctl;
u64 *mce_banks;
+
+ struct list_head timers;
};
struct kvm_mem_alias {
===================================================================
@@ -7,6 +7,7 @@ struct kvm_timer {
bool periodic;
struct kvm *kvm;
struct kvm_vcpu *vcpu;
+ struct list_head vcpu_timer;
};
void kvm_timer_init(struct kvm *kvm, struct kvm_timer *ktimer);
===================================================================
@@ -4644,6 +4644,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *
BUG_ON(vcpu->kvm == NULL);
kvm = vcpu->kvm;
+ INIT_LIST_HEAD(&vcpu->arch.timers);
+
vcpu->arch.mmu.root_hpa = INVALID_PAGE;
if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu))
vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
===================================================================
@@ -53,11 +53,13 @@ void kvm_timer_init(struct kvm *kvm, str
ktimer->kvm = kvm;
hrtimer_init(&ktimer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
ktimer->timer.function = kvm_timer_fn;
+ INIT_LIST_HEAD(&ktimer->vcpu_timer);
}
void kvm_timer_vcpu_bind(struct kvm_timer *ktimer, struct kvm_vcpu *vcpu)
{
ktimer->vcpu = vcpu;
+ list_add(&ktimer->vcpu_timer, &vcpu->arch.timers);
}
void kvm_timer_start(struct kvm_timer *ktimer, u64 interval, bool periodic)
Add a per-vcpu list of (emulated) timers. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>