Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125177
b: refs/heads/master
c: 23930f9
h: refs/heads/master
i:
  125175: 46f6d84
v: v3
  • Loading branch information
Jan Kiszka authored and Avi Kivity committed Dec 31, 2008
1 parent 84c4d95 commit 017ab03
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 66a5a347c2690db4c0756524a8eb5a05e0437aa8
refs/heads/master: 23930f9521c9c4d4aa96cdb9d1e1703f3782bb94
15 changes: 15 additions & 0 deletions trunk/arch/x86/kvm/i8254.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,25 @@ void kvm_free_pit(struct kvm *kvm)

static void __inject_pit_timer_intr(struct kvm *kvm)
{
struct kvm_vcpu *vcpu;
int i;

mutex_lock(&kvm->lock);
kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 1);
kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 0);
mutex_unlock(&kvm->lock);

/*
* Provides NMI watchdog support in IOAPIC mode.
* The route is: PIT -> PIC -> LVT0 in NMI mode,
* timer IRQs will continue to flow through the IOAPIC.
*/
for (i = 0; i < KVM_MAX_VCPUS; ++i) {
vcpu = kvm->vcpus[i];
if (!vcpu)
continue;
kvm_apic_local_deliver(vcpu, APIC_LVT0);
}
}

void kvm_inject_pit_timer_irqs(struct kvm_vcpu *vcpu)
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/x86/kvm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ void kvm_pic_reset(struct kvm_kpic_state *s);
void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu);
void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu);
int kvm_apic_local_deliver(struct kvm_vcpu *vcpu, int lvt_type);
void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu);
void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu);
void __kvm_migrate_timers(struct kvm_vcpu *vcpu);
Expand Down
34 changes: 29 additions & 5 deletions trunk/arch/x86/kvm/lapic.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,14 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
}
break;

case APIC_DM_EXTINT:
/*
* Should only be called by kvm_apic_local_deliver() with LVT0,
* before NMI watchdog was enabled. Already handled by
* kvm_apic_accept_pic_intr().
*/
break;

default:
printk(KERN_ERR "TODO: unsupported delivery mode %x\n",
delivery_mode);
Expand Down Expand Up @@ -743,10 +751,13 @@ static void apic_mmio_write(struct kvm_io_device *this,
apic_set_reg(apic, APIC_ICR2, val & 0xff000000);
break;

case APIC_LVT0:
if (val == APIC_DM_NMI)
apic_debug("Receive NMI setting on APIC_LVT0 "
"for cpu %d\n", apic->vcpu->vcpu_id);
case APIC_LVTT:
case APIC_LVTTHMR:
case APIC_LVTPC:
case APIC_LVT0:
case APIC_LVT1:
case APIC_LVTERR:
/* TODO: Check vector */
Expand Down Expand Up @@ -961,12 +972,25 @@ int apic_has_pending_timer(struct kvm_vcpu *vcpu)
return 0;
}

static int __inject_apic_timer_irq(struct kvm_lapic *apic)
int kvm_apic_local_deliver(struct kvm_vcpu *vcpu, int lvt_type)
{
int vector;
struct kvm_lapic *apic = vcpu->arch.apic;
int vector, mode, trig_mode;
u32 reg;

if (apic && apic_enabled(apic)) {
reg = apic_get_reg(apic, lvt_type);
vector = reg & APIC_VECTOR_MASK;
mode = reg & APIC_MODE_MASK;
trig_mode = reg & APIC_LVT_LEVEL_TRIGGER;
return __apic_accept_irq(apic, mode, vector, 1, trig_mode);
}
return 0;
}

vector = apic_lvt_vector(apic, APIC_LVTT);
return __apic_accept_irq(apic, APIC_DM_FIXED, vector, 1, 0);
static inline int __inject_apic_timer_irq(struct kvm_lapic *apic)
{
return kvm_apic_local_deliver(apic->vcpu, APIC_LVTT);
}

static enum hrtimer_restart apic_timer_fn(struct hrtimer *data)
Expand Down

0 comments on commit 017ab03

Please sign in to comment.