diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/include/asm/kvm_host.h | 3 | ||||
-rw-r--r-- | arch/ia64/kvm/kvm-ia64.c | 8 | ||||
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 3 | ||||
-rw-r--r-- | arch/x86/kvm/i8254.c | 11 | ||||
-rw-r--r-- | arch/x86/kvm/i8254.h | 1 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 6 |
6 files changed, 26 insertions, 6 deletions
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h index 85db124d37f6..04c0b88f7b3a 100644 --- a/arch/ia64/include/asm/kvm_host.h +++ b/arch/ia64/include/asm/kvm_host.h | |||
@@ -417,6 +417,9 @@ struct kvm_arch { | |||
417 | struct list_head assigned_dev_head; | 417 | struct list_head assigned_dev_head; |
418 | struct dmar_domain *intel_iommu_domain; | 418 | struct dmar_domain *intel_iommu_domain; |
419 | struct hlist_head irq_ack_notifier_list; | 419 | struct hlist_head irq_ack_notifier_list; |
420 | |||
421 | unsigned long irq_sources_bitmap; | ||
422 | unsigned long irq_states[KVM_IOAPIC_NUM_PINS]; | ||
420 | }; | 423 | }; |
421 | 424 | ||
422 | union cpuid3_t { | 425 | union cpuid3_t { |
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index a312c9e9b9ef..8a2b13ff0aff 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -778,6 +778,9 @@ static void kvm_init_vm(struct kvm *kvm) | |||
778 | kvm_build_io_pmt(kvm); | 778 | kvm_build_io_pmt(kvm); |
779 | 779 | ||
780 | INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); | 780 | INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); |
781 | |||
782 | /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */ | ||
783 | set_bit(KVM_USERSPACE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap); | ||
781 | } | 784 | } |
782 | 785 | ||
783 | struct kvm *kvm_arch_create_vm(void) | 786 | struct kvm *kvm_arch_create_vm(void) |
@@ -941,9 +944,8 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
941 | goto out; | 944 | goto out; |
942 | if (irqchip_in_kernel(kvm)) { | 945 | if (irqchip_in_kernel(kvm)) { |
943 | mutex_lock(&kvm->lock); | 946 | mutex_lock(&kvm->lock); |
944 | kvm_ioapic_set_irq(kvm->arch.vioapic, | 947 | kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, |
945 | irq_event.irq, | 948 | irq_event.irq, irq_event.level); |
946 | irq_event.level); | ||
947 | mutex_unlock(&kvm->lock); | 949 | mutex_unlock(&kvm->lock); |
948 | r = 0; | 950 | r = 0; |
949 | } | 951 | } |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 65679d006337..8346be87cfa1 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -364,6 +364,9 @@ struct kvm_arch{ | |||
364 | 364 | ||
365 | struct page *ept_identity_pagetable; | 365 | struct page *ept_identity_pagetable; |
366 | bool ept_identity_pagetable_done; | 366 | bool ept_identity_pagetable_done; |
367 | |||
368 | unsigned long irq_sources_bitmap; | ||
369 | unsigned long irq_states[KVM_IOAPIC_NUM_PINS]; | ||
367 | }; | 370 | }; |
368 | 371 | ||
369 | struct kvm_vm_stat { | 372 | struct kvm_vm_stat { |
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 11c6725fb798..8772dc946823 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
@@ -545,6 +545,12 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm) | |||
545 | if (!pit) | 545 | if (!pit) |
546 | return NULL; | 546 | return NULL; |
547 | 547 | ||
548 | mutex_lock(&kvm->lock); | ||
549 | pit->irq_source_id = kvm_request_irq_source_id(kvm); | ||
550 | mutex_unlock(&kvm->lock); | ||
551 | if (pit->irq_source_id < 0) | ||
552 | return NULL; | ||
553 | |||
548 | mutex_init(&pit->pit_state.lock); | 554 | mutex_init(&pit->pit_state.lock); |
549 | mutex_lock(&pit->pit_state.lock); | 555 | mutex_lock(&pit->pit_state.lock); |
550 | spin_lock_init(&pit->pit_state.inject_lock); | 556 | spin_lock_init(&pit->pit_state.inject_lock); |
@@ -587,6 +593,7 @@ void kvm_free_pit(struct kvm *kvm) | |||
587 | mutex_lock(&kvm->arch.vpit->pit_state.lock); | 593 | mutex_lock(&kvm->arch.vpit->pit_state.lock); |
588 | timer = &kvm->arch.vpit->pit_state.pit_timer.timer; | 594 | timer = &kvm->arch.vpit->pit_state.pit_timer.timer; |
589 | hrtimer_cancel(timer); | 595 | hrtimer_cancel(timer); |
596 | kvm_free_irq_source_id(kvm, kvm->arch.vpit->irq_source_id); | ||
590 | mutex_unlock(&kvm->arch.vpit->pit_state.lock); | 597 | mutex_unlock(&kvm->arch.vpit->pit_state.lock); |
591 | kfree(kvm->arch.vpit); | 598 | kfree(kvm->arch.vpit); |
592 | } | 599 | } |
@@ -595,8 +602,8 @@ void kvm_free_pit(struct kvm *kvm) | |||
595 | static void __inject_pit_timer_intr(struct kvm *kvm) | 602 | static void __inject_pit_timer_intr(struct kvm *kvm) |
596 | { | 603 | { |
597 | mutex_lock(&kvm->lock); | 604 | mutex_lock(&kvm->lock); |
598 | kvm_set_irq(kvm, 0, 1); | 605 | kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 1); |
599 | kvm_set_irq(kvm, 0, 0); | 606 | kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 0); |
600 | mutex_unlock(&kvm->lock); | 607 | mutex_unlock(&kvm->lock); |
601 | } | 608 | } |
602 | 609 | ||
diff --git a/arch/x86/kvm/i8254.h b/arch/x86/kvm/i8254.h index e436d4983aa1..4178022b97aa 100644 --- a/arch/x86/kvm/i8254.h +++ b/arch/x86/kvm/i8254.h | |||
@@ -44,6 +44,7 @@ struct kvm_pit { | |||
44 | struct kvm_io_device speaker_dev; | 44 | struct kvm_io_device speaker_dev; |
45 | struct kvm *kvm; | 45 | struct kvm *kvm; |
46 | struct kvm_kpit_state pit_state; | 46 | struct kvm_kpit_state pit_state; |
47 | int irq_source_id; | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | #define KVM_PIT_BASE_ADDRESS 0x40 | 50 | #define KVM_PIT_BASE_ADDRESS 0x40 |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 4f0677d1eae8..f1f8ff2f1fa2 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1742,7 +1742,8 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
1742 | goto out; | 1742 | goto out; |
1743 | if (irqchip_in_kernel(kvm)) { | 1743 | if (irqchip_in_kernel(kvm)) { |
1744 | mutex_lock(&kvm->lock); | 1744 | mutex_lock(&kvm->lock); |
1745 | kvm_set_irq(kvm, irq_event.irq, irq_event.level); | 1745 | kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, |
1746 | irq_event.irq, irq_event.level); | ||
1746 | mutex_unlock(&kvm->lock); | 1747 | mutex_unlock(&kvm->lock); |
1747 | r = 0; | 1748 | r = 0; |
1748 | } | 1749 | } |
@@ -4013,6 +4014,9 @@ struct kvm *kvm_arch_create_vm(void) | |||
4013 | INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); | 4014 | INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); |
4014 | INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); | 4015 | INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); |
4015 | 4016 | ||
4017 | /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */ | ||
4018 | set_bit(KVM_USERSPACE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap); | ||
4019 | |||
4016 | return kvm; | 4020 | return kvm; |
4017 | } | 4021 | } |
4018 | 4022 | ||