aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddie Dong <eddie.dong@intel.com>2007-10-10 06:15:54 -0400
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:52:55 -0500
commit8c392696e749171531d155ea5cefdfc1c970fd18 (patch)
tree36b97e721b3423b3272c9866ed32b06251db8b09
parent2fcceae145645ec6a4fab0a806bb674d7484d97b (diff)
KVM: Split IOAPIC reset function and export for kernel RESET
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r--drivers/kvm/ioapic.c17
-rw-r--r--drivers/kvm/irq.h1
2 files changed, 14 insertions, 4 deletions
diff --git a/drivers/kvm/ioapic.c b/drivers/kvm/ioapic.c
index e14b7c724e67..cf1d50b3549b 100644
--- a/drivers/kvm/ioapic.c
+++ b/drivers/kvm/ioapic.c
@@ -371,18 +371,27 @@ static void ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len,
371 } 371 }
372} 372}
373 373
374void kvm_ioapic_reset(struct kvm_ioapic *ioapic)
375{
376 int i;
377
378 for (i = 0; i < IOAPIC_NUM_PINS; i++)
379 ioapic->redirtbl[i].fields.mask = 1;
380 ioapic->base_address = IOAPIC_DEFAULT_BASE_ADDRESS;
381 ioapic->ioregsel = 0;
382 ioapic->irr = 0;
383 ioapic->id = 0;
384}
385
374int kvm_ioapic_init(struct kvm *kvm) 386int kvm_ioapic_init(struct kvm *kvm)
375{ 387{
376 struct kvm_ioapic *ioapic; 388 struct kvm_ioapic *ioapic;
377 int i;
378 389
379 ioapic = kzalloc(sizeof(struct kvm_ioapic), GFP_KERNEL); 390 ioapic = kzalloc(sizeof(struct kvm_ioapic), GFP_KERNEL);
380 if (!ioapic) 391 if (!ioapic)
381 return -ENOMEM; 392 return -ENOMEM;
382 kvm->vioapic = ioapic; 393 kvm->vioapic = ioapic;
383 for (i = 0; i < IOAPIC_NUM_PINS; i++) 394 kvm_ioapic_reset(ioapic);
384 ioapic->redirtbl[i].fields.mask = 1;
385 ioapic->base_address = IOAPIC_DEFAULT_BASE_ADDRESS;
386 ioapic->dev.read = ioapic_mmio_read; 395 ioapic->dev.read = ioapic_mmio_read;
387 ioapic->dev.write = ioapic_mmio_write; 396 ioapic->dev.write = ioapic_mmio_write;
388 ioapic->dev.in_range = ioapic_in_range; 397 ioapic->dev.in_range = ioapic_in_range;
diff --git a/drivers/kvm/irq.h b/drivers/kvm/irq.h
index e08ae1002bd8..5ad3cfd7622d 100644
--- a/drivers/kvm/irq.h
+++ b/drivers/kvm/irq.h
@@ -140,6 +140,7 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu);
140int kvm_create_lapic(struct kvm_vcpu *vcpu); 140int kvm_create_lapic(struct kvm_vcpu *vcpu);
141void kvm_lapic_reset(struct kvm_vcpu *vcpu); 141void kvm_lapic_reset(struct kvm_vcpu *vcpu);
142void kvm_pic_reset(struct kvm_kpic_state *s); 142void kvm_pic_reset(struct kvm_kpic_state *s);
143void kvm_ioapic_reset(struct kvm_ioapic *ioapic);
143void kvm_free_lapic(struct kvm_vcpu *vcpu); 144void kvm_free_lapic(struct kvm_vcpu *vcpu);
144u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu); 145u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu);
145void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8); 146void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8);