[PATCH] KVM: Properly support LINT1 pin
DORMANTno replies
From: Gregory Haskins <hidden>
Date: 2007-06-21 11:25:20
Subsystem:
the rest · Maintainer:
Linus Torvalds
This patch applies to the lapic branch. Its a simple little cleanup that I meant to get in earlier and never got around to. --- KVM: Properly support LINT1 pin LINT1 is not currently "wired" to anything, so there is no support for it in the LAPIC code. We should fix the support for completeness since its not difficult Signed-off-by: Gregory Haskins <redacted> --- drivers/kvm/lapic.c | 45 ++++++++++++++++++++------------------------- 1 files changed, 20 insertions(+), 25 deletions(-)
diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c
index dfc06e5..c4810df 100644
--- a/drivers/kvm/lapic.c
+++ b/drivers/kvm/lapic.c@@ -1313,43 +1313,38 @@ static int apic_irqdev_ack(struct kvm_irqdevice *this, int flags, static int apic_irqdev_set_pin(struct kvm_irqdevice *this, int irq, int level) { struct kvm_kern_apic *apic = (struct kvm_kern_apic*)this->private; - int lvt = 0; + int accept = 0; + int dm = 0; + int vector = 0; spin_lock_bh(&apic->lock); + /* + * pin "0" is LINT0, and "1" is LINT1 + */ + BUG_ON(irq > 1); + if (!apic_enabled(apic)) { /* * If the LAPIC is disabled, we simply forward the interrupt * on to the output line */ - __apic_accept_irq(apic, APIC_DM_EXTINT, 0, level, 1); - goto out; - } - - /* - * pin "0" is LINT0, and "1" is LINT1 - */ - BUG_ON(irq > 1); + accept = 1; + dm = !irq ? APIC_DM_EXTINT : APIC_DM_NMI; + } else { + int lvt = !irq ? APIC_LVT0 : APIC_LVT1; - switch(irq) { - case 0: - lvt = APIC_LVT0; - break; - case 1: - lvt = APIC_LVT1; - break; + if (apic_lvt_enabled(apic, lvt)) { + accept = 1; + dm = apic_lvt_dm(apic, lvt); + vector = apic_lvt_vector(apic, lvt); + } } - if (apic_lvt_enabled(apic, lvt)) - __apic_accept_irq(apic, - apic_lvt_dm(apic, lvt), - apic_lvt_vector(apic, lvt), - level, - 1); - + if (accept) + __apic_accept_irq(apic, dm, vector, level, 1); - out: - spin_unlock_bh(&apic->lock); + spin_unlock_bh(&apic->lock); return 0; } -------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/