diff options
author | Avi Kivity <avi@redhat.com> | 2010-05-03 10:34:34 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-08-01 03:47:03 -0400 |
commit | 073d46133ab0b42154f6b8429f4f66dbe2760bda (patch) | |
tree | 5b092dba4f6d1f65e3b91a28ebc45a17397150ee /arch/x86/kvm/i8259.c | |
parent | b74a07beed0e64bfba413dcb70dd6749c57f43dc (diff) |
KVM: i8259: reduce excessive abstraction for pic_irq_request()
Part of the i8259 code pretends it isn't part of kvm, but we know better.
Reduce excessive abstraction, eliminating callbacks and void pointers.
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/i8259.c')
-rw-r--r-- | arch/x86/kvm/i8259.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index 2c73f4493148..caf6e1b3d957 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include <linux/kvm_host.h> | 34 | #include <linux/kvm_host.h> |
35 | #include "trace.h" | 35 | #include "trace.h" |
36 | 36 | ||
37 | static void pic_irq_request(struct kvm *kvm, int level); | ||
38 | |||
37 | static void pic_lock(struct kvm_pic *s) | 39 | static void pic_lock(struct kvm_pic *s) |
38 | __acquires(&s->lock) | 40 | __acquires(&s->lock) |
39 | { | 41 | { |
@@ -175,9 +177,9 @@ static void pic_update_irq(struct kvm_pic *s) | |||
175 | } | 177 | } |
176 | irq = pic_get_irq(&s->pics[0]); | 178 | irq = pic_get_irq(&s->pics[0]); |
177 | if (irq >= 0) | 179 | if (irq >= 0) |
178 | s->irq_request(s->irq_request_opaque, 1); | 180 | pic_irq_request(s->kvm, 1); |
179 | else | 181 | else |
180 | s->irq_request(s->irq_request_opaque, 0); | 182 | pic_irq_request(s->kvm, 0); |
181 | } | 183 | } |
182 | 184 | ||
183 | void kvm_pic_update_irq(struct kvm_pic *s) | 185 | void kvm_pic_update_irq(struct kvm_pic *s) |
@@ -262,8 +264,7 @@ int kvm_pic_read_irq(struct kvm *kvm) | |||
262 | void kvm_pic_reset(struct kvm_kpic_state *s) | 264 | void kvm_pic_reset(struct kvm_kpic_state *s) |
263 | { | 265 | { |
264 | int irq; | 266 | int irq; |
265 | struct kvm *kvm = s->pics_state->irq_request_opaque; | 267 | struct kvm_vcpu *vcpu0 = s->pics_state->kvm->bsp_vcpu; |
266 | struct kvm_vcpu *vcpu0 = kvm->bsp_vcpu; | ||
267 | u8 irr = s->irr, isr = s->imr; | 268 | u8 irr = s->irr, isr = s->imr; |
268 | 269 | ||
269 | s->last_irr = 0; | 270 | s->last_irr = 0; |
@@ -302,8 +303,7 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val) | |||
302 | /* | 303 | /* |
303 | * deassert a pending interrupt | 304 | * deassert a pending interrupt |
304 | */ | 305 | */ |
305 | s->pics_state->irq_request(s->pics_state-> | 306 | pic_irq_request(s->pics_state->kvm, 0); |
306 | irq_request_opaque, 0); | ||
307 | s->init_state = 1; | 307 | s->init_state = 1; |
308 | s->init4 = val & 1; | 308 | s->init4 = val & 1; |
309 | if (val & 0x02) | 309 | if (val & 0x02) |
@@ -519,9 +519,8 @@ static int picdev_read(struct kvm_io_device *this, | |||
519 | /* | 519 | /* |
520 | * callback when PIC0 irq status changed | 520 | * callback when PIC0 irq status changed |
521 | */ | 521 | */ |
522 | static void pic_irq_request(void *opaque, int level) | 522 | static void pic_irq_request(struct kvm *kvm, int level) |
523 | { | 523 | { |
524 | struct kvm *kvm = opaque; | ||
525 | struct kvm_vcpu *vcpu = kvm->bsp_vcpu; | 524 | struct kvm_vcpu *vcpu = kvm->bsp_vcpu; |
526 | struct kvm_pic *s = pic_irqchip(kvm); | 525 | struct kvm_pic *s = pic_irqchip(kvm); |
527 | int irq = pic_get_irq(&s->pics[0]); | 526 | int irq = pic_get_irq(&s->pics[0]); |
@@ -550,8 +549,6 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm) | |||
550 | s->kvm = kvm; | 549 | s->kvm = kvm; |
551 | s->pics[0].elcr_mask = 0xf8; | 550 | s->pics[0].elcr_mask = 0xf8; |
552 | s->pics[1].elcr_mask = 0xde; | 551 | s->pics[1].elcr_mask = 0xde; |
553 | s->irq_request = pic_irq_request; | ||
554 | s->irq_request_opaque = kvm; | ||
555 | s->pics[0].pics_state = s; | 552 | s->pics[0].pics_state = s; |
556 | s->pics[1].pics_state = s; | 553 | s->pics[1].pics_state = s; |
557 | 554 | ||