Commit 682c59a3 authored by Zhang Xiantao's avatar Zhang Xiantao Committed by Avi Kivity

KVM: Portability: Move kvm{pic,ioapic} accesors to x86 specific code

Signed-off-by: default avatarZhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 2bacc55c
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/hrtimer.h> #include <linux/hrtimer.h>
#include <asm/kvm.h> #include <asm/kvm.h>
#include "iodev.h" #include "iodev.h"
#include "x86.h"
struct kvm; struct kvm;
struct kvm_vcpu; struct kvm_vcpu;
...@@ -63,8 +64,6 @@ struct kvm_pic { ...@@ -63,8 +64,6 @@ struct kvm_pic {
struct kvm_pic *kvm_create_pic(struct kvm *kvm); struct kvm_pic *kvm_create_pic(struct kvm *kvm);
void kvm_pic_set_irq(void *opaque, int irq, int level); void kvm_pic_set_irq(void *opaque, int irq, int level);
int kvm_pic_read_irq(struct kvm_pic *s); int kvm_pic_read_irq(struct kvm_pic *s);
int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
void kvm_pic_update_irq(struct kvm_pic *s); void kvm_pic_update_irq(struct kvm_pic *s);
#define IOAPIC_NUM_PINS KVM_IOAPIC_NUM_PINS #define IOAPIC_NUM_PINS KVM_IOAPIC_NUM_PINS
...@@ -147,6 +146,21 @@ do { \ ...@@ -147,6 +146,21 @@ do { \
#define ASSERT(x) do { } while (0) #define ASSERT(x) do { } while (0)
#endif #endif
static inline struct kvm_pic *pic_irqchip(struct kvm *kvm)
{
return kvm->vpic;
}
static inline struct kvm_ioapic *ioapic_irqchip(struct kvm *kvm)
{
return kvm->vioapic;
}
static inline int irqchip_in_kernel(struct kvm *kvm)
{
return pic_irqchip(kvm) != NULL;
}
void kvm_vcpu_kick(struct kvm_vcpu *vcpu); void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu); int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu);
int kvm_apic_accept_pic_intr(struct kvm_vcpu *vcpu); int kvm_apic_accept_pic_intr(struct kvm_vcpu *vcpu);
......
...@@ -273,21 +273,6 @@ struct kvm { ...@@ -273,21 +273,6 @@ struct kvm {
struct kvm_vm_stat stat; struct kvm_vm_stat stat;
}; };
static inline struct kvm_pic *pic_irqchip(struct kvm *kvm)
{
return kvm->vpic;
}
static inline struct kvm_ioapic *ioapic_irqchip(struct kvm *kvm)
{
return kvm->vioapic;
}
static inline int irqchip_in_kernel(struct kvm *kvm)
{
return pic_irqchip(kvm) != NULL;
}
/* The guest did something we don't support. */ /* The guest did something we don't support. */
#define pr_unimpl(vcpu, fmt, ...) \ #define pr_unimpl(vcpu, fmt, ...) \
do { \ do { \
...@@ -417,6 +402,9 @@ void kvm_free_physmem(struct kvm *kvm); ...@@ -417,6 +402,9 @@ void kvm_free_physmem(struct kvm *kvm);
struct kvm *kvm_arch_create_vm(void); struct kvm *kvm_arch_create_vm(void);
void kvm_arch_destroy_vm(struct kvm *kvm); void kvm_arch_destroy_vm(struct kvm *kvm);
int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
static inline void kvm_guest_enter(void) static inline void kvm_guest_enter(void)
{ {
account_system_vtime(current); account_system_vtime(current);
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#define KVM_X86_H #define KVM_X86_H
#include "kvm.h" #include "kvm.h"
#include "irq.h"
#include <linux/types.h> #include <linux/types.h>
#include <linux/mm.h> #include <linux/mm.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment