]> git.proxmox.com Git - pve-kernel-2.6.32.git/blame - kvm-x86-ignore-ioapic-polarity.patch
update to vzkernel-2.6.32-042stab113.12.src.rpm
[pve-kernel-2.6.32.git] / kvm-x86-ignore-ioapic-polarity.patch
CommitLineData
2327c57f
DM
1From 100943c54e0947a07d2c0185368fc2fd848f7f28 Mon Sep 17 00:00:00 2001
2From: "Gabriel L. Somlo" <gsomlo@gmail.com>
3Date: Thu, 27 Feb 2014 23:06:17 -0500
4Subject: kvm: x86: ignore ioapic polarity
5
6Both QEMU and KVM have already accumulated a significant number of
7optimizations based on the hard-coded assumption that ioapic polarity
8will always use the ActiveHigh convention, where the logical and
9physical states of level-triggered irq lines always match (i.e.,
10active(asserted) == high == 1, inactive == low == 0). QEMU guests
11are expected to follow directions given via ACPI and configure the
12ioapic with polarity 0 (ActiveHigh). However, even when misbehaving
13guests (e.g. OS X <= 10.9) set the ioapic polarity to 1 (ActiveLow),
14QEMU will still use the ActiveHigh signaling convention when
15interfacing with KVM.
16
17This patch modifies KVM to completely ignore ioapic polarity as set by
18the guest OS, enabling misbehaving guests to work alongside those which
19comply with the ActiveHigh polarity specified by QEMU's ACPI tables.
20
21Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
22Signed-off-by: Gabriel L. Somlo <somlo@cmu.edu>
23[Move documentation to KVM_IRQ_LINE, add ia64. - Paolo]
24Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
25
26diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
27index 53f44be..6a4309b 100644
28--- a/arch/ia64/kvm/kvm-ia64.c
29+++ b/arch/ia64/kvm/kvm-ia64.c
30@@ -197,6 +197,7 @@ int kvm_dev_ioctl_check_extension(long ext)
31 case KVM_CAP_IRQCHIP:
32 case KVM_CAP_MP_STATE:
33 case KVM_CAP_IRQ_INJECT_STATUS:
34+ case KVM_CAP_IOAPIC_POLARITY_IGNORED:
35 r = 1;
36 break;
37 case KVM_CAP_COALESCED_MMIO:
38diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
39index d906391..a37da6b 100644
40--- a/arch/x86/kvm/x86.c
41+++ b/arch/x86/kvm/x86.c
42@@ -1971,6 +1971,7 @@ int kvm_dev_ioctl_check_extension(long ext)
43 case KVM_CAP_XSAVE:
44 case KVM_CAP_GET_TSC_KHZ:
45 case KVM_CAP_KVMCLOCK_CTRL:
46+ case KVM_CAP_IOAPIC_POLARITY_IGNORED:
47 r = 1;
48 break;
49 case KVM_CAP_COALESCED_MMIO:
50diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
51index 7d76401..a7518be 100644
52--- a/include/linux/kvm.h
53+++ b/include/linux/kvm.h
54@@ -459,6 +459,7 @@ struct kvm_ppc_smmu_info {
55 #define KVM_CAP_GET_TSC_KHZ 61
56 #define KVM_CAP_TSC_DEADLINE_TIMER 72
57 #define KVM_CAP_KVMCLOCK_CTRL 76
58+#define KVM_CAP_IOAPIC_POLARITY_IGNORED 97
59
60 #ifdef KVM_CAP_IRQ_ROUTING
61
62diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
63index ce9ed99..1539d37 100644
64--- a/virt/kvm/ioapic.c
65+++ b/virt/kvm/ioapic.c
66@@ -206,7 +206,6 @@ int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int irq_source_id,
67 int irq_level = __kvm_irq_line_state(&ioapic->irq_states[irq],
68 irq_source_id, level);
69 entry = ioapic->redirtbl[irq];
70- irq_level ^= entry.fields.polarity;
71 if (!irq_level)
72 ioapic->irr &= ~mask;
73 else {
74--
75cgit v0.10.1
76