aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/ioapic.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2009-06-04 14:08:23 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:32:49 -0400
commit60eead79ad8750f80384cbe48fc44edcc78a0305 (patch)
treebf7b2a6e83c47f709e9d0afb2a8c53eb2944b05c /virt/kvm/ioapic.c
parent64a2268dcfc9c3626aa7f70902690e2fc10c1630 (diff)
KVM: introduce irq_lock, use it to protect ioapic
Introduce irq_lock, and use to protect ioapic data structures. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm/ioapic.c')
-rw-r--r--virt/kvm/ioapic.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index 469b9faae665..2a5667173995 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -243,6 +243,7 @@ static void ioapic_mmio_read(struct kvm_io_device *this, gpa_t addr, int len,
243 ioapic_debug("addr %lx\n", (unsigned long)addr); 243 ioapic_debug("addr %lx\n", (unsigned long)addr);
244 ASSERT(!(addr & 0xf)); /* check alignment */ 244 ASSERT(!(addr & 0xf)); /* check alignment */
245 245
246 mutex_lock(&ioapic->kvm->irq_lock);
246 addr &= 0xff; 247 addr &= 0xff;
247 switch (addr) { 248 switch (addr) {
248 case IOAPIC_REG_SELECT: 249 case IOAPIC_REG_SELECT:
@@ -269,6 +270,7 @@ static void ioapic_mmio_read(struct kvm_io_device *this, gpa_t addr, int len,
269 default: 270 default:
270 printk(KERN_WARNING "ioapic: wrong length %d\n", len); 271 printk(KERN_WARNING "ioapic: wrong length %d\n", len);
271 } 272 }
273 mutex_unlock(&ioapic->kvm->irq_lock);
272} 274}
273 275
274static void ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len, 276static void ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len,
@@ -280,6 +282,8 @@ static void ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len,
280 ioapic_debug("ioapic_mmio_write addr=%p len=%d val=%p\n", 282 ioapic_debug("ioapic_mmio_write addr=%p len=%d val=%p\n",
281 (void*)addr, len, val); 283 (void*)addr, len, val);
282 ASSERT(!(addr & 0xf)); /* check alignment */ 284 ASSERT(!(addr & 0xf)); /* check alignment */
285
286 mutex_lock(&ioapic->kvm->irq_lock);
283 if (len == 4 || len == 8) 287 if (len == 4 || len == 8)
284 data = *(u32 *) val; 288 data = *(u32 *) val;
285 else { 289 else {
@@ -305,6 +309,7 @@ static void ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len,
305 default: 309 default:
306 break; 310 break;
307 } 311 }
312 mutex_unlock(&ioapic->kvm->irq_lock);
308} 313}
309 314
310void kvm_ioapic_reset(struct kvm_ioapic *ioapic) 315void kvm_ioapic_reset(struct kvm_ioapic *ioapic)