diff options
author | Avi Kivity <avi@qumranet.com> | 2008-07-07 07:45:39 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-10-15 04:15:14 -0400 |
commit | 7edd0ce05892831c77fa4cebe24a6056d33336d5 (patch) | |
tree | 9ab07d5d6de1acc42f12c87ade8eb3dfb856efd9 | |
parent | 60bd83a125030878665684f353c7d36fd54f09fd (diff) |
KVM: Consolidate PIC isr clearing into a function
Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r-- | arch/x86/kvm/i8259.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index c31164e8aa46..55e179ad98ef 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c | |||
@@ -30,6 +30,11 @@ | |||
30 | 30 | ||
31 | #include <linux/kvm_host.h> | 31 | #include <linux/kvm_host.h> |
32 | 32 | ||
33 | static void pic_clear_isr(struct kvm_kpic_state *s, int irq) | ||
34 | { | ||
35 | s->isr &= ~(1 << irq); | ||
36 | } | ||
37 | |||
33 | /* | 38 | /* |
34 | * set irq level. If an edge is detected, then the IRR is set to 1 | 39 | * set irq level. If an edge is detected, then the IRR is set to 1 |
35 | */ | 40 | */ |
@@ -141,11 +146,12 @@ void kvm_pic_set_irq(void *opaque, int irq, int level) | |||
141 | */ | 146 | */ |
142 | static inline void pic_intack(struct kvm_kpic_state *s, int irq) | 147 | static inline void pic_intack(struct kvm_kpic_state *s, int irq) |
143 | { | 148 | { |
149 | s->isr |= 1 << irq; | ||
144 | if (s->auto_eoi) { | 150 | if (s->auto_eoi) { |
145 | if (s->rotate_on_auto_eoi) | 151 | if (s->rotate_on_auto_eoi) |
146 | s->priority_add = (irq + 1) & 7; | 152 | s->priority_add = (irq + 1) & 7; |
147 | } else | 153 | pic_clear_isr(s, irq); |
148 | s->isr |= (1 << irq); | 154 | } |
149 | /* | 155 | /* |
150 | * We don't clear a level sensitive interrupt here | 156 | * We don't clear a level sensitive interrupt here |
151 | */ | 157 | */ |
@@ -243,7 +249,7 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val) | |||
243 | priority = get_priority(s, s->isr); | 249 | priority = get_priority(s, s->isr); |
244 | if (priority != 8) { | 250 | if (priority != 8) { |
245 | irq = (priority + s->priority_add) & 7; | 251 | irq = (priority + s->priority_add) & 7; |
246 | s->isr &= ~(1 << irq); | 252 | pic_clear_isr(s, irq); |
247 | if (cmd == 5) | 253 | if (cmd == 5) |
248 | s->priority_add = (irq + 1) & 7; | 254 | s->priority_add = (irq + 1) & 7; |
249 | pic_update_irq(s->pics_state); | 255 | pic_update_irq(s->pics_state); |
@@ -251,7 +257,7 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val) | |||
251 | break; | 257 | break; |
252 | case 3: | 258 | case 3: |
253 | irq = val & 7; | 259 | irq = val & 7; |
254 | s->isr &= ~(1 << irq); | 260 | pic_clear_isr(s, irq); |
255 | pic_update_irq(s->pics_state); | 261 | pic_update_irq(s->pics_state); |
256 | break; | 262 | break; |
257 | case 6: | 263 | case 6: |
@@ -260,8 +266,8 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val) | |||
260 | break; | 266 | break; |
261 | case 7: | 267 | case 7: |
262 | irq = val & 7; | 268 | irq = val & 7; |
263 | s->isr &= ~(1 << irq); | ||
264 | s->priority_add = (irq + 1) & 7; | 269 | s->priority_add = (irq + 1) & 7; |
270 | pic_clear_isr(s, irq); | ||
265 | pic_update_irq(s->pics_state); | 271 | pic_update_irq(s->pics_state); |
266 | break; | 272 | break; |
267 | default: | 273 | default: |
@@ -303,7 +309,7 @@ static u32 pic_poll_read(struct kvm_kpic_state *s, u32 addr1) | |||
303 | s->pics_state->pics[0].irr &= ~(1 << 2); | 309 | s->pics_state->pics[0].irr &= ~(1 << 2); |
304 | } | 310 | } |
305 | s->irr &= ~(1 << ret); | 311 | s->irr &= ~(1 << ret); |
306 | s->isr &= ~(1 << ret); | 312 | pic_clear_isr(s, ret); |
307 | if (addr1 >> 7 || ret != 2) | 313 | if (addr1 >> 7 || ret != 2) |
308 | pic_update_irq(s->pics_state); | 314 | pic_update_irq(s->pics_state); |
309 | } else { | 315 | } else { |