aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/ioapic.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-01-04 10:10:50 -0500
committerAvi Kivity <avi@redhat.com>2009-03-24 05:03:03 -0400
commit75858a84a6207f5e60196f6bbd18fde4250e5759 (patch)
treead8ab5d60a616270c61d88a9af08713cefbc9d35 /virt/kvm/ioapic.c
parent5d9b8e30f543a9f21a968a4cda71e8f6d1c66a61 (diff)
KVM: Interrupt mask notifiers for ioapic
Allow clients to request notifications when the guest masks or unmasks a particular irq line. This complements irq ack notifications, as the guest will not ack an irq line that is masked. Currently implemented for the ioapic only. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm/ioapic.c')
-rw-r--r--virt/kvm/ioapic.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index 23b81cf242af..e85a2bcd2db1 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -101,6 +101,7 @@ static void ioapic_service(struct kvm_ioapic *ioapic, unsigned int idx)
101static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) 101static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
102{ 102{
103 unsigned index; 103 unsigned index;
104 bool mask_before, mask_after;
104 105
105 switch (ioapic->ioregsel) { 106 switch (ioapic->ioregsel) {
106 case IOAPIC_REG_VERSION: 107 case IOAPIC_REG_VERSION:
@@ -120,6 +121,7 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
120 ioapic_debug("change redir index %x val %x\n", index, val); 121 ioapic_debug("change redir index %x val %x\n", index, val);
121 if (index >= IOAPIC_NUM_PINS) 122 if (index >= IOAPIC_NUM_PINS)
122 return; 123 return;
124 mask_before = ioapic->redirtbl[index].fields.mask;
123 if (ioapic->ioregsel & 1) { 125 if (ioapic->ioregsel & 1) {
124 ioapic->redirtbl[index].bits &= 0xffffffff; 126 ioapic->redirtbl[index].bits &= 0xffffffff;
125 ioapic->redirtbl[index].bits |= (u64) val << 32; 127 ioapic->redirtbl[index].bits |= (u64) val << 32;
@@ -128,6 +130,9 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
128 ioapic->redirtbl[index].bits |= (u32) val; 130 ioapic->redirtbl[index].bits |= (u32) val;
129 ioapic->redirtbl[index].fields.remote_irr = 0; 131 ioapic->redirtbl[index].fields.remote_irr = 0;
130 } 132 }
133 mask_after = ioapic->redirtbl[index].fields.mask;
134 if (mask_before != mask_after)
135 kvm_fire_mask_notifiers(ioapic->kvm, index, mask_after);
131 if (ioapic->irr & (1 << index)) 136 if (ioapic->irr & (1 << index))
132 ioapic_service(ioapic, index); 137 ioapic_service(ioapic, index);
133 break; 138 break;
@@ -426,3 +431,4 @@ int kvm_ioapic_init(struct kvm *kvm)
426 kvm_io_bus_register_dev(&kvm->mmio_bus, &ioapic->dev); 431 kvm_io_bus_register_dev(&kvm->mmio_bus, &ioapic->dev);
427 return 0; 432 return 0;
428} 433}
434