diff options
author | Yang Zhang <yang.z.zhang@Intel.com> | 2013-04-11 07:25:13 -0400 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2013-04-16 15:32:40 -0400 |
commit | 3d81bc7e96d6bca0b8f8b7d1bf6ea72caa3aac57 (patch) | |
tree | 3e8d83b8d80c87c38cc0bb1d3caef6286ad9dd48 /virt/kvm/ioapic.c | |
parent | 01e439be7753c163932538276f04f95cb1b66697 (diff) |
KVM: Call common update function when ioapic entry changed.
Both TMR and EOI exit bitmap need to be updated when ioapic changed
or vcpu's id/ldr/dfr changed. So use common function instead eoi exit
bitmap specific function.
Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt/kvm/ioapic.c')
-rw-r--r-- | virt/kvm/ioapic.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 97c67a50f904..f2157a985a1f 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c | |||
@@ -193,15 +193,13 @@ static void update_handled_vectors(struct kvm_ioapic *ioapic) | |||
193 | smp_wmb(); | 193 | smp_wmb(); |
194 | } | 194 | } |
195 | 195 | ||
196 | void kvm_ioapic_calculate_eoi_exitmap(struct kvm_vcpu *vcpu, | 196 | void kvm_ioapic_scan_entry(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) |
197 | u64 *eoi_exit_bitmap) | ||
198 | { | 197 | { |
199 | struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; | 198 | struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; |
200 | union kvm_ioapic_redirect_entry *e; | 199 | union kvm_ioapic_redirect_entry *e; |
201 | int index; | 200 | int index; |
202 | 201 | ||
203 | spin_lock(&ioapic->lock); | 202 | spin_lock(&ioapic->lock); |
204 | /* traverse ioapic entry to set eoi exit bitmap*/ | ||
205 | for (index = 0; index < IOAPIC_NUM_PINS; index++) { | 203 | for (index = 0; index < IOAPIC_NUM_PINS; index++) { |
206 | e = &ioapic->redirtbl[index]; | 204 | e = &ioapic->redirtbl[index]; |
207 | if (!e->fields.mask && | 205 | if (!e->fields.mask && |
@@ -215,16 +213,22 @@ void kvm_ioapic_calculate_eoi_exitmap(struct kvm_vcpu *vcpu, | |||
215 | } | 213 | } |
216 | spin_unlock(&ioapic->lock); | 214 | spin_unlock(&ioapic->lock); |
217 | } | 215 | } |
218 | EXPORT_SYMBOL_GPL(kvm_ioapic_calculate_eoi_exitmap); | ||
219 | 216 | ||
220 | void kvm_ioapic_make_eoibitmap_request(struct kvm *kvm) | 217 | #ifdef CONFIG_X86 |
218 | void kvm_vcpu_request_scan_ioapic(struct kvm *kvm) | ||
221 | { | 219 | { |
222 | struct kvm_ioapic *ioapic = kvm->arch.vioapic; | 220 | struct kvm_ioapic *ioapic = kvm->arch.vioapic; |
223 | 221 | ||
224 | if (!kvm_apic_vid_enabled(kvm) || !ioapic) | 222 | if (!ioapic) |
225 | return; | 223 | return; |
226 | kvm_make_update_eoibitmap_request(kvm); | 224 | kvm_make_scan_ioapic_request(kvm); |
227 | } | 225 | } |
226 | #else | ||
227 | void kvm_vcpu_request_scan_ioapic(struct kvm *kvm) | ||
228 | { | ||
229 | return; | ||
230 | } | ||
231 | #endif | ||
228 | 232 | ||
229 | static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) | 233 | static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) |
230 | { | 234 | { |
@@ -267,7 +271,7 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) | |||
267 | if (e->fields.trig_mode == IOAPIC_LEVEL_TRIG | 271 | if (e->fields.trig_mode == IOAPIC_LEVEL_TRIG |
268 | && ioapic->irr & (1 << index)) | 272 | && ioapic->irr & (1 << index)) |
269 | ioapic_service(ioapic, index, false); | 273 | ioapic_service(ioapic, index, false); |
270 | kvm_ioapic_make_eoibitmap_request(ioapic->kvm); | 274 | kvm_vcpu_request_scan_ioapic(ioapic->kvm); |
271 | break; | 275 | break; |
272 | } | 276 | } |
273 | } | 277 | } |
@@ -586,7 +590,7 @@ int kvm_set_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state) | |||
586 | spin_lock(&ioapic->lock); | 590 | spin_lock(&ioapic->lock); |
587 | memcpy(ioapic, state, sizeof(struct kvm_ioapic_state)); | 591 | memcpy(ioapic, state, sizeof(struct kvm_ioapic_state)); |
588 | update_handled_vectors(ioapic); | 592 | update_handled_vectors(ioapic); |
589 | kvm_ioapic_make_eoibitmap_request(kvm); | 593 | kvm_vcpu_request_scan_ioapic(kvm); |
590 | kvm_rtc_eoi_tracking_restore_all(ioapic); | 594 | kvm_rtc_eoi_tracking_restore_all(ioapic); |
591 | spin_unlock(&ioapic->lock); | 595 | spin_unlock(&ioapic->lock); |
592 | return 0; | 596 | return 0; |