Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172327
b: refs/heads/master
c: 3ddea12
h: refs/heads/master
i:
  172325: b8cd555
  172323: 0c2576d
  172319: a6150d5
v: v3
  • Loading branch information
Marcelo Tosatti authored and Avi Kivity committed Dec 3, 2009
1 parent 1c830d6 commit 4137efa
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 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: 92c0d900159a4fa582e1c8ebcc1c4a8020defff5
refs/heads/master: 3ddea128ad75bd33e88780fe44f44c3717369b98
6 changes: 5 additions & 1 deletion trunk/arch/x86/kvm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ static inline struct kvm_pic *pic_irqchip(struct kvm *kvm)

static inline int irqchip_in_kernel(struct kvm *kvm)
{
return pic_irqchip(kvm) != NULL;
int ret;

ret = (pic_irqchip(kvm) != NULL);
smp_rmb();
return ret;
}

void kvm_pic_reset(struct kvm_kpic_state *s);
Expand Down
30 changes: 22 additions & 8 deletions trunk/arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -2362,25 +2362,39 @@ long kvm_arch_vm_ioctl(struct file *filp,
if (r)
goto out;
break;
case KVM_CREATE_IRQCHIP:
case KVM_CREATE_IRQCHIP: {
struct kvm_pic *vpic;

mutex_lock(&kvm->lock);
r = -EEXIST;
if (kvm->arch.vpic)
goto create_irqchip_unlock;
r = -ENOMEM;
kvm->arch.vpic = kvm_create_pic(kvm);
if (kvm->arch.vpic) {
vpic = kvm_create_pic(kvm);
if (vpic) {
r = kvm_ioapic_init(kvm);
if (r) {
kfree(kvm->arch.vpic);
kvm->arch.vpic = NULL;
goto out;
kfree(vpic);
goto create_irqchip_unlock;
}
} else
goto out;
goto create_irqchip_unlock;
smp_wmb();
kvm->arch.vpic = vpic;
smp_wmb();
r = kvm_setup_default_irq_routing(kvm);
if (r) {
mutex_lock(&kvm->irq_lock);
kfree(kvm->arch.vpic);
kfree(kvm->arch.vioapic);
goto out;
kvm->arch.vpic = NULL;
kvm->arch.vioapic = NULL;
mutex_unlock(&kvm->irq_lock);
}
create_irqchip_unlock:
mutex_unlock(&kvm->lock);
break;
}
case KVM_CREATE_PIT:
u.pit_config.flags = KVM_PIT_SPEAKER_DUMMY;
goto create_pit;
Expand Down

0 comments on commit 4137efa

Please sign in to comment.