aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-08-04 08:30:29 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:33:22 -0400
commit88ba63c2653b9b4857148fedba47ba2d8a4652c9 (patch)
tree83fc7039a1892d9bd092572cf1e6ea050befbd4a /arch/x86/kvm
parent938396a2341a4a96eaa5bea93a2bcdd69827c70c (diff)
KVM: Replace pic_lock()/pic_unlock() with direct call to spinlock functions
They are not doing anything else now. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/i8259.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 3aacd331e2de..01f151682802 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -32,18 +32,6 @@
32#include <linux/kvm_host.h> 32#include <linux/kvm_host.h>
33#include "trace.h" 33#include "trace.h"
34 34
35static void pic_lock(struct kvm_pic *s)
36 __acquires(&s->lock)
37{
38 spin_lock(&s->lock);
39}
40
41static void pic_unlock(struct kvm_pic *s)
42 __releases(&s->lock)
43{
44 spin_unlock(&s->lock);
45}
46
47static void pic_clear_isr(struct kvm_kpic_state *s, int irq) 35static void pic_clear_isr(struct kvm_kpic_state *s, int irq)
48{ 36{
49 s->isr &= ~(1 << irq); 37 s->isr &= ~(1 << irq);
@@ -56,10 +44,10 @@ static void pic_clear_isr(struct kvm_kpic_state *s, int irq)
56void kvm_pic_clear_isr_ack(struct kvm *kvm) 44void kvm_pic_clear_isr_ack(struct kvm *kvm)
57{ 45{
58 struct kvm_pic *s = pic_irqchip(kvm); 46 struct kvm_pic *s = pic_irqchip(kvm);
59 pic_lock(s); 47 spin_lock(&s->lock);
60 s->pics[0].isr_ack = 0xff; 48 s->pics[0].isr_ack = 0xff;
61 s->pics[1].isr_ack = 0xff; 49 s->pics[1].isr_ack = 0xff;
62 pic_unlock(s); 50 spin_unlock(&s->lock);
63} 51}
64 52
65/* 53/*
@@ -160,9 +148,9 @@ static void pic_update_irq(struct kvm_pic *s)
160 148
161void kvm_pic_update_irq(struct kvm_pic *s) 149void kvm_pic_update_irq(struct kvm_pic *s)
162{ 150{
163 pic_lock(s); 151 spin_lock(&s->lock);
164 pic_update_irq(s); 152 pic_update_irq(s);
165 pic_unlock(s); 153 spin_unlock(&s->lock);
166} 154}
167 155
168int kvm_pic_set_irq(void *opaque, int irq, int level) 156int kvm_pic_set_irq(void *opaque, int irq, int level)
@@ -170,14 +158,14 @@ int kvm_pic_set_irq(void *opaque, int irq, int level)
170 struct kvm_pic *s = opaque; 158 struct kvm_pic *s = opaque;
171 int ret = -1; 159 int ret = -1;
172 160
173 pic_lock(s); 161 spin_lock(&s->lock);
174 if (irq >= 0 && irq < PIC_NUM_PINS) { 162 if (irq >= 0 && irq < PIC_NUM_PINS) {
175 ret = pic_set_irq1(&s->pics[irq >> 3], irq & 7, level); 163 ret = pic_set_irq1(&s->pics[irq >> 3], irq & 7, level);
176 pic_update_irq(s); 164 pic_update_irq(s);
177 trace_kvm_pic_set_irq(irq >> 3, irq & 7, s->pics[irq >> 3].elcr, 165 trace_kvm_pic_set_irq(irq >> 3, irq & 7, s->pics[irq >> 3].elcr,
178 s->pics[irq >> 3].imr, ret == 0); 166 s->pics[irq >> 3].imr, ret == 0);
179 } 167 }
180 pic_unlock(s); 168 spin_unlock(&s->lock);
181 169
182 return ret; 170 return ret;
183} 171}
@@ -205,7 +193,7 @@ int kvm_pic_read_irq(struct kvm *kvm)
205 int irq, irq2, intno; 193 int irq, irq2, intno;
206 struct kvm_pic *s = pic_irqchip(kvm); 194 struct kvm_pic *s = pic_irqchip(kvm);
207 195
208 pic_lock(s); 196 spin_lock(&s->lock);
209 irq = pic_get_irq(&s->pics[0]); 197 irq = pic_get_irq(&s->pics[0]);
210 if (irq >= 0) { 198 if (irq >= 0) {
211 pic_intack(&s->pics[0], irq); 199 pic_intack(&s->pics[0], irq);
@@ -230,7 +218,7 @@ int kvm_pic_read_irq(struct kvm *kvm)
230 intno = s->pics[0].irq_base + irq; 218 intno = s->pics[0].irq_base + irq;
231 } 219 }
232 pic_update_irq(s); 220 pic_update_irq(s);
233 pic_unlock(s); 221 spin_unlock(&s->lock);
234 222
235 return intno; 223 return intno;
236} 224}
@@ -448,7 +436,7 @@ static int picdev_write(struct kvm_io_device *this,
448 printk(KERN_ERR "PIC: non byte write\n"); 436 printk(KERN_ERR "PIC: non byte write\n");
449 return 0; 437 return 0;
450 } 438 }
451 pic_lock(s); 439 spin_lock(&s->lock);
452 switch (addr) { 440 switch (addr) {
453 case 0x20: 441 case 0x20:
454 case 0x21: 442 case 0x21:
@@ -461,7 +449,7 @@ static int picdev_write(struct kvm_io_device *this,
461 elcr_ioport_write(&s->pics[addr & 1], addr, data); 449 elcr_ioport_write(&s->pics[addr & 1], addr, data);
462 break; 450 break;
463 } 451 }
464 pic_unlock(s); 452 spin_unlock(&s->lock);
465 return 0; 453 return 0;
466} 454}
467 455
@@ -478,7 +466,7 @@ static int picdev_read(struct kvm_io_device *this,
478 printk(KERN_ERR "PIC: non byte read\n"); 466 printk(KERN_ERR "PIC: non byte read\n");
479 return 0; 467 return 0;
480 } 468 }
481 pic_lock(s); 469 spin_lock(&s->lock);
482 switch (addr) { 470 switch (addr) {
483 case 0x20: 471 case 0x20:
484 case 0x21: 472 case 0x21:
@@ -492,7 +480,7 @@ static int picdev_read(struct kvm_io_device *this,
492 break; 480 break;
493 } 481 }
494 *(unsigned char *)val = data; 482 *(unsigned char *)val = data;
495 pic_unlock(s); 483 spin_unlock(&s->lock);
496 return 0; 484 return 0;
497} 485}
498 486