diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-12-20 10:37:23 +0000 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-12-20 10:37:23 +0000 |
commit | ddc35d1cc994bde1c3560c5dc30a4adc944ef4ac (patch) | |
tree | 70de5fedc1a3be62d38992962caac2b15647da6d /xen/arch/x86/hvm/irq.c | |
parent | 625141e5d7a0076eddf421cd7afccefce9cb000e (diff) | |
download | xen-ddc35d1cc994bde1c3560c5dc30a4adc944ef4ac.tar.gz xen-ddc35d1cc994bde1c3560c5dc30a4adc944ef4ac.tar.bz2 xen-ddc35d1cc994bde1c3560c5dc30a4adc944ef4ac.zip |
[HVM] Enable more than one platform timer (PIT/RTC/HPET)
programmed as periodic timer and adds them to abstract layer, which
keeps track of pending_intr_nr to avoid time interrupt lost and
sync'ed timer with TSC.
It also makes some cleanup to the time related code.
Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Diffstat (limited to 'xen/arch/x86/hvm/irq.c')
-rw-r--r-- | xen/arch/x86/hvm/irq.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c index b65799b2aa..238312e0f8 100644 --- a/xen/arch/x86/hvm/irq.c +++ b/xen/arch/x86/hvm/irq.c @@ -225,3 +225,51 @@ void hvm_set_callback_gsi(struct domain *d, unsigned int gsi) dprintk(XENLOG_G_INFO, "Dom%u callback GSI changed %u -> %u\n", d->domain_id, old_gsi, gsi); } + +int cpu_has_pending_irq(struct vcpu *v) +{ + struct hvm_domain *plat = &v->domain->arch.hvm_domain; + int dummy; + + /* APIC */ + if ( cpu_get_apic_interrupt(v, &dummy) != -1 ) + return 1; + + /* PIC */ + if ( !vlapic_accept_pic_intr(v) ) + return 0; + + return plat->irq.vpic[0].int_output; +} + +int cpu_get_interrupt(struct vcpu *v, int *type) +{ + int vector; + + if ( (vector = cpu_get_apic_interrupt(v, type)) != -1 ) + return vector; + + if ( (v->vcpu_id == 0) && + ((vector = cpu_get_pic_interrupt(v, type)) != -1) ) + return vector; + + return -1; +} + +int get_intr_vector(struct vcpu* v, int irq, int type) +{ + if ( type == APIC_DM_EXTINT ) + return v->domain->arch.hvm_domain.irq.vpic[irq >> 3].irq_base + + (irq & 0x7); + + return domain_vioapic(v->domain)->redirtbl[irq].fields.vector; +} + +int is_irq_masked(struct vcpu *v, int irq) +{ + if ( v->domain->arch.hvm_domain.irq.vpic[irq >> 3].imr & (1 << (irq & 7)) + && domain_vioapic(v->domain)->redirtbl[irq].fields.mask ) + return 1; + + return 0; +} |