diff options
author | Zhang Xiantao <xiantao.zhang@intel.com> | 2007-12-11 07:36:00 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:22 -0500 |
commit | 682c59a3f3f211ed555b17144f2d82eb8286a1db (patch) | |
tree | 939bb2644ec6d556d27e82ecfb0cdf8ec9e7378a /drivers | |
parent | 2bacc55c7c3c61e356aef06b9a319b4cee90b519 (diff) |
KVM: Portability: Move kvm{pic,ioapic} accesors to x86 specific code
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/kvm/irq.h | 18 | ||||
-rw-r--r-- | drivers/kvm/kvm.h | 18 | ||||
-rw-r--r-- | drivers/kvm/x86.h | 1 |
3 files changed, 19 insertions, 18 deletions
diff --git a/drivers/kvm/irq.h b/drivers/kvm/irq.h index 730a87c173e5..e88d93957d24 100644 --- a/drivers/kvm/irq.h +++ b/drivers/kvm/irq.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/hrtimer.h> | 26 | #include <linux/hrtimer.h> |
27 | #include <asm/kvm.h> | 27 | #include <asm/kvm.h> |
28 | #include "iodev.h" | 28 | #include "iodev.h" |
29 | #include "x86.h" | ||
29 | 30 | ||
30 | struct kvm; | 31 | struct kvm; |
31 | struct kvm_vcpu; | 32 | struct kvm_vcpu; |
@@ -63,8 +64,6 @@ struct kvm_pic { | |||
63 | struct kvm_pic *kvm_create_pic(struct kvm *kvm); | 64 | struct kvm_pic *kvm_create_pic(struct kvm *kvm); |
64 | void kvm_pic_set_irq(void *opaque, int irq, int level); | 65 | void kvm_pic_set_irq(void *opaque, int irq, int level); |
65 | int kvm_pic_read_irq(struct kvm_pic *s); | 66 | int kvm_pic_read_irq(struct kvm_pic *s); |
66 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); | ||
67 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); | ||
68 | void kvm_pic_update_irq(struct kvm_pic *s); | 67 | void kvm_pic_update_irq(struct kvm_pic *s); |
69 | 68 | ||
70 | #define IOAPIC_NUM_PINS KVM_IOAPIC_NUM_PINS | 69 | #define IOAPIC_NUM_PINS KVM_IOAPIC_NUM_PINS |
@@ -147,6 +146,21 @@ do { \ | |||
147 | #define ASSERT(x) do { } while (0) | 146 | #define ASSERT(x) do { } while (0) |
148 | #endif | 147 | #endif |
149 | 148 | ||
149 | static inline struct kvm_pic *pic_irqchip(struct kvm *kvm) | ||
150 | { | ||
151 | return kvm->vpic; | ||
152 | } | ||
153 | |||
154 | static inline struct kvm_ioapic *ioapic_irqchip(struct kvm *kvm) | ||
155 | { | ||
156 | return kvm->vioapic; | ||
157 | } | ||
158 | |||
159 | static inline int irqchip_in_kernel(struct kvm *kvm) | ||
160 | { | ||
161 | return pic_irqchip(kvm) != NULL; | ||
162 | } | ||
163 | |||
150 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); | 164 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); |
151 | int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu); | 165 | int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu); |
152 | int kvm_apic_accept_pic_intr(struct kvm_vcpu *vcpu); | 166 | int kvm_apic_accept_pic_intr(struct kvm_vcpu *vcpu); |
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index ceefb4427dbd..668a8300365d 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -273,21 +273,6 @@ struct kvm { | |||
273 | struct kvm_vm_stat stat; | 273 | struct kvm_vm_stat stat; |
274 | }; | 274 | }; |
275 | 275 | ||
276 | static inline struct kvm_pic *pic_irqchip(struct kvm *kvm) | ||
277 | { | ||
278 | return kvm->vpic; | ||
279 | } | ||
280 | |||
281 | static inline struct kvm_ioapic *ioapic_irqchip(struct kvm *kvm) | ||
282 | { | ||
283 | return kvm->vioapic; | ||
284 | } | ||
285 | |||
286 | static inline int irqchip_in_kernel(struct kvm *kvm) | ||
287 | { | ||
288 | return pic_irqchip(kvm) != NULL; | ||
289 | } | ||
290 | |||
291 | /* The guest did something we don't support. */ | 276 | /* The guest did something we don't support. */ |
292 | #define pr_unimpl(vcpu, fmt, ...) \ | 277 | #define pr_unimpl(vcpu, fmt, ...) \ |
293 | do { \ | 278 | do { \ |
@@ -417,6 +402,9 @@ void kvm_free_physmem(struct kvm *kvm); | |||
417 | struct kvm *kvm_arch_create_vm(void); | 402 | struct kvm *kvm_arch_create_vm(void); |
418 | void kvm_arch_destroy_vm(struct kvm *kvm); | 403 | void kvm_arch_destroy_vm(struct kvm *kvm); |
419 | 404 | ||
405 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); | ||
406 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); | ||
407 | |||
420 | static inline void kvm_guest_enter(void) | 408 | static inline void kvm_guest_enter(void) |
421 | { | 409 | { |
422 | account_system_vtime(current); | 410 | account_system_vtime(current); |
diff --git a/drivers/kvm/x86.h b/drivers/kvm/x86.h index 78396d627be0..0fc7020aa1a5 100644 --- a/drivers/kvm/x86.h +++ b/drivers/kvm/x86.h | |||
@@ -12,7 +12,6 @@ | |||
12 | #define KVM_X86_H | 12 | #define KVM_X86_H |
13 | 13 | ||
14 | #include "kvm.h" | 14 | #include "kvm.h" |
15 | #include "irq.h" | ||
16 | 15 | ||
17 | #include <linux/types.h> | 16 | #include <linux/types.h> |
18 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |