aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kvm/kvm-ia64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64/kvm/kvm-ia64.c')
-rw-r--r--arch/ia64/kvm/kvm-ia64.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 1887a93a2bd5..acf43ec42704 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -283,6 +283,18 @@ static int handle_sal_call(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
283 283
284} 284}
285 285
286static int __apic_accept_irq(struct kvm_vcpu *vcpu, uint64_t vector)
287{
288 struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd);
289
290 if (!test_and_set_bit(vector, &vpd->irr[0])) {
291 vcpu->arch.irq_new_pending = 1;
292 kvm_vcpu_kick(vcpu);
293 return 1;
294 }
295 return 0;
296}
297
286/* 298/*
287 * offset: address offset to IPI space. 299 * offset: address offset to IPI space.
288 * value: deliver value. 300 * value: deliver value.
@@ -292,20 +304,20 @@ static void vcpu_deliver_ipi(struct kvm_vcpu *vcpu, uint64_t dm,
292{ 304{
293 switch (dm) { 305 switch (dm) {
294 case SAPIC_FIXED: 306 case SAPIC_FIXED:
295 kvm_apic_set_irq(vcpu, vector, dm, 0);
296 break; 307 break;
297 case SAPIC_NMI: 308 case SAPIC_NMI:
298 kvm_apic_set_irq(vcpu, 2, dm, 0); 309 vector = 2;
299 break; 310 break;
300 case SAPIC_EXTINT: 311 case SAPIC_EXTINT:
301 kvm_apic_set_irq(vcpu, 0, dm, 0); 312 vector = 0;
302 break; 313 break;
303 case SAPIC_INIT: 314 case SAPIC_INIT:
304 case SAPIC_PMI: 315 case SAPIC_PMI:
305 default: 316 default:
306 printk(KERN_ERR"kvm: Unimplemented Deliver reserved IPI!\n"); 317 printk(KERN_ERR"kvm: Unimplemented Deliver reserved IPI!\n");
307 break; 318 return;
308 } 319 }
320 __apic_accept_irq(vcpu, vector);
309} 321}
310 322
311static struct kvm_vcpu *lid_to_vcpu(struct kvm *kvm, unsigned long id, 323static struct kvm_vcpu *lid_to_vcpu(struct kvm *kvm, unsigned long id,
@@ -1813,17 +1825,9 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
1813 put_cpu(); 1825 put_cpu();
1814} 1826}
1815 1827
1816int kvm_apic_set_irq(struct kvm_vcpu *vcpu, u8 vec, u8 dmode, u8 trig) 1828int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq)
1817{ 1829{
1818 1830 return __apic_accept_irq(vcpu, irq->vector);
1819 struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd);
1820
1821 if (!test_and_set_bit(vec, &vpd->irr[0])) {
1822 vcpu->arch.irq_new_pending = 1;
1823 kvm_vcpu_kick(vcpu);
1824 return 1;
1825 }
1826 return 0;
1827} 1831}
1828 1832
1829int kvm_apic_match_physical_addr(struct kvm_lapic *apic, u16 dest) 1833int kvm_apic_match_physical_addr(struct kvm_lapic *apic, u16 dest)
@@ -1844,6 +1848,7 @@ int kvm_apic_compare_prio(struct kvm_vcpu *vcpu1, struct kvm_vcpu *vcpu2)
1844int kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source, 1848int kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source,
1845 int short_hand, int dest, int dest_mode) 1849 int short_hand, int dest, int dest_mode)
1846{ 1850{
1851 struct kvm_lapic *target = vcpu->arch.apic;
1847 return (dest_mode == 0) ? 1852 return (dest_mode == 0) ?
1848 kvm_apic_match_physical_addr(target, dest) : 1853 kvm_apic_match_physical_addr(target, dest) :
1849 kvm_apic_match_logical_addr(target, dest); 1854 kvm_apic_match_logical_addr(target, dest);