aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-06-09 08:56:27 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:32:52 -0400
commit1ed0ce000a6c20c36ec649e32fc24393ef418ed8 (patch)
tree85a78c27d972c64e8bd9ff6b429d398977f8ac8b /arch/x86/kvm
parentc5af89b68abb26eea5e745f33228f4d672f115e5 (diff)
KVM: Use pointer to vcpu instead of vcpu_id in timer code.
Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/i8254.c2
-rw-r--r--arch/x86/kvm/kvm_timer.h2
-rw-r--r--arch/x86/kvm/lapic.c2
-rw-r--r--arch/x86/kvm/timer.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 008a83185067..06d8f84ae8a2 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -294,7 +294,7 @@ static void create_pit_timer(struct kvm_kpit_state *ps, u32 val, int is_period)
294 pt->timer.function = kvm_timer_fn; 294 pt->timer.function = kvm_timer_fn;
295 pt->t_ops = &kpit_ops; 295 pt->t_ops = &kpit_ops;
296 pt->kvm = ps->pit->kvm; 296 pt->kvm = ps->pit->kvm;
297 pt->vcpu_id = 0; 297 pt->vcpu = pt->kvm->bsp_vcpu;
298 298
299 atomic_set(&pt->pending, 0); 299 atomic_set(&pt->pending, 0);
300 ps->irq_ack = 1; 300 ps->irq_ack = 1;
diff --git a/arch/x86/kvm/kvm_timer.h b/arch/x86/kvm/kvm_timer.h
index 26bd6ba74e1c..55c7524dda54 100644
--- a/arch/x86/kvm/kvm_timer.h
+++ b/arch/x86/kvm/kvm_timer.h
@@ -6,7 +6,7 @@ struct kvm_timer {
6 bool reinject; 6 bool reinject;
7 struct kvm_timer_ops *t_ops; 7 struct kvm_timer_ops *t_ops;
8 struct kvm *kvm; 8 struct kvm *kvm;
9 int vcpu_id; 9 struct kvm_vcpu *vcpu;
10}; 10};
11 11
12struct kvm_timer_ops { 12struct kvm_timer_ops {
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index b0661300eb28..b1694dc45729 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -950,7 +950,7 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu)
950 apic->lapic_timer.timer.function = kvm_timer_fn; 950 apic->lapic_timer.timer.function = kvm_timer_fn;
951 apic->lapic_timer.t_ops = &lapic_timer_ops; 951 apic->lapic_timer.t_ops = &lapic_timer_ops;
952 apic->lapic_timer.kvm = vcpu->kvm; 952 apic->lapic_timer.kvm = vcpu->kvm;
953 apic->lapic_timer.vcpu_id = vcpu->vcpu_id; 953 apic->lapic_timer.vcpu = vcpu;
954 954
955 apic->base_address = APIC_DEFAULT_PHYS_BASE; 955 apic->base_address = APIC_DEFAULT_PHYS_BASE;
956 vcpu->arch.apic_base = APIC_DEFAULT_PHYS_BASE; 956 vcpu->arch.apic_base = APIC_DEFAULT_PHYS_BASE;
diff --git a/arch/x86/kvm/timer.c b/arch/x86/kvm/timer.c
index 86dbac072d0c..85cc743a8203 100644
--- a/arch/x86/kvm/timer.c
+++ b/arch/x86/kvm/timer.c
@@ -33,7 +33,7 @@ enum hrtimer_restart kvm_timer_fn(struct hrtimer *data)
33 struct kvm_vcpu *vcpu; 33 struct kvm_vcpu *vcpu;
34 struct kvm_timer *ktimer = container_of(data, struct kvm_timer, timer); 34 struct kvm_timer *ktimer = container_of(data, struct kvm_timer, timer);
35 35
36 vcpu = ktimer->kvm->vcpus[ktimer->vcpu_id]; 36 vcpu = ktimer->vcpu;
37 if (!vcpu) 37 if (!vcpu)
38 return HRTIMER_NORESTART; 38 return HRTIMER_NORESTART;
39 39