diff options
author | Gleb Natapov <gleb@redhat.com> | 2009-02-04 10:28:14 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-03-24 05:03:11 -0400 |
commit | 4925663a079c77d95d8685228ad6675fc5639c8e (patch) | |
tree | 52e93df78b23a44ed21d015f835688f673dd351a /arch/x86/kvm/x86.c | |
parent | 452425dbaa1974e9fc489e64a8de46a47b4c2754 (diff) |
KVM: Report IRQ injection status to userspace.
IRQ injection status is either -1 (if there was no CPU found
that should except the interrupt because IRQ was masked or
ioapic was misconfigured or ...) or >= 0 in that case the
number indicates to how many CPUs interrupt was injected.
If the value is 0 it means that the interrupt was coalesced
and probably should be reinjected.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 05d7be89b5eb..e4db5be7c953 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1019,6 +1019,7 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
1019 | case KVM_CAP_MP_STATE: | 1019 | case KVM_CAP_MP_STATE: |
1020 | case KVM_CAP_SYNC_MMU: | 1020 | case KVM_CAP_SYNC_MMU: |
1021 | case KVM_CAP_REINJECT_CONTROL: | 1021 | case KVM_CAP_REINJECT_CONTROL: |
1022 | case KVM_CAP_IRQ_INJECT_STATUS: | ||
1022 | r = 1; | 1023 | r = 1; |
1023 | break; | 1024 | break; |
1024 | case KVM_CAP_COALESCED_MMIO: | 1025 | case KVM_CAP_COALESCED_MMIO: |
@@ -1877,6 +1878,7 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
1877 | create_pit_unlock: | 1878 | create_pit_unlock: |
1878 | mutex_unlock(&kvm->lock); | 1879 | mutex_unlock(&kvm->lock); |
1879 | break; | 1880 | break; |
1881 | case KVM_IRQ_LINE_STATUS: | ||
1880 | case KVM_IRQ_LINE: { | 1882 | case KVM_IRQ_LINE: { |
1881 | struct kvm_irq_level irq_event; | 1883 | struct kvm_irq_level irq_event; |
1882 | 1884 | ||
@@ -1884,10 +1886,17 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
1884 | if (copy_from_user(&irq_event, argp, sizeof irq_event)) | 1886 | if (copy_from_user(&irq_event, argp, sizeof irq_event)) |
1885 | goto out; | 1887 | goto out; |
1886 | if (irqchip_in_kernel(kvm)) { | 1888 | if (irqchip_in_kernel(kvm)) { |
1889 | __s32 status; | ||
1887 | mutex_lock(&kvm->lock); | 1890 | mutex_lock(&kvm->lock); |
1888 | kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, | 1891 | status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, |
1889 | irq_event.irq, irq_event.level); | 1892 | irq_event.irq, irq_event.level); |
1890 | mutex_unlock(&kvm->lock); | 1893 | mutex_unlock(&kvm->lock); |
1894 | if (ioctl == KVM_IRQ_LINE_STATUS) { | ||
1895 | irq_event.status = status; | ||
1896 | if (copy_to_user(argp, &irq_event, | ||
1897 | sizeof irq_event)) | ||
1898 | goto out; | ||
1899 | } | ||
1891 | r = 0; | 1900 | r = 0; |
1892 | } | 1901 | } |
1893 | break; | 1902 | break; |