Commit d7deeeb0 authored by Zhang Xiantao's avatar Zhang Xiantao Committed by Avi Kivity

KVM: Portability: move vpic and vioapic to kvm_arch

This patches moves two fields vpid and vioapic to kvm_arch
Signed-off-by: default avatarZhang Xiantao <xiantao.zhang@intel.com>
Acked-by: default avatarCarsten Otte <cotte@de.ibm.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent f05e70ac
...@@ -271,7 +271,7 @@ static int get_eoi_gsi(struct kvm_ioapic *ioapic, int vector) ...@@ -271,7 +271,7 @@ static int get_eoi_gsi(struct kvm_ioapic *ioapic, int vector)
void kvm_ioapic_update_eoi(struct kvm *kvm, int vector) void kvm_ioapic_update_eoi(struct kvm *kvm, int vector)
{ {
struct kvm_ioapic *ioapic = kvm->vioapic; struct kvm_ioapic *ioapic = kvm->arch.vioapic;
union ioapic_redir_entry *ent; union ioapic_redir_entry *ent;
int gsi; int gsi;
...@@ -390,7 +390,7 @@ int kvm_ioapic_init(struct kvm *kvm) ...@@ -390,7 +390,7 @@ int kvm_ioapic_init(struct kvm *kvm)
ioapic = kzalloc(sizeof(struct kvm_ioapic), GFP_KERNEL); ioapic = kzalloc(sizeof(struct kvm_ioapic), GFP_KERNEL);
if (!ioapic) if (!ioapic)
return -ENOMEM; return -ENOMEM;
kvm->vioapic = ioapic; kvm->arch.vioapic = ioapic;
kvm_ioapic_reset(ioapic); kvm_ioapic_reset(ioapic);
ioapic->dev.read = ioapic_mmio_read; ioapic->dev.read = ioapic_mmio_read;
ioapic->dev.write = ioapic_mmio_write; ioapic->dev.write = ioapic_mmio_write;
......
...@@ -148,12 +148,12 @@ do { \ ...@@ -148,12 +148,12 @@ do { \
static inline struct kvm_pic *pic_irqchip(struct kvm *kvm) static inline struct kvm_pic *pic_irqchip(struct kvm *kvm)
{ {
return kvm->vpic; return kvm->arch.vpic;
} }
static inline struct kvm_ioapic *ioapic_irqchip(struct kvm *kvm) static inline struct kvm_ioapic *ioapic_irqchip(struct kvm *kvm)
{ {
return kvm->vioapic; return kvm->arch.vioapic;
} }
static inline int irqchip_in_kernel(struct kvm *kvm) static inline int irqchip_in_kernel(struct kvm *kvm)
......
...@@ -124,8 +124,6 @@ struct kvm { ...@@ -124,8 +124,6 @@ struct kvm {
struct file *filp; struct file *filp;
struct kvm_io_bus mmio_bus; struct kvm_io_bus mmio_bus;
struct kvm_io_bus pio_bus; struct kvm_io_bus pio_bus;
struct kvm_pic *vpic;
struct kvm_ioapic *vioapic;
int round_robin_prev_vcpu; int round_robin_prev_vcpu;
unsigned int tss_addr; unsigned int tss_addr;
struct page *apic_access_page; struct page *apic_access_page;
......
...@@ -1386,12 +1386,12 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -1386,12 +1386,12 @@ long kvm_arch_vm_ioctl(struct file *filp,
} }
case KVM_CREATE_IRQCHIP: case KVM_CREATE_IRQCHIP:
r = -ENOMEM; r = -ENOMEM;
kvm->vpic = kvm_create_pic(kvm); kvm->arch.vpic = kvm_create_pic(kvm);
if (kvm->vpic) { if (kvm->arch.vpic) {
r = kvm_ioapic_init(kvm); r = kvm_ioapic_init(kvm);
if (r) { if (r) {
kfree(kvm->vpic); kfree(kvm->arch.vpic);
kvm->vpic = NULL; kvm->arch.vpic = NULL;
goto out; goto out;
} }
} else } else
...@@ -1409,7 +1409,7 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -1409,7 +1409,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
kvm_pic_set_irq(pic_irqchip(kvm), kvm_pic_set_irq(pic_irqchip(kvm),
irq_event.irq, irq_event.irq,
irq_event.level); irq_event.level);
kvm_ioapic_set_irq(kvm->vioapic, kvm_ioapic_set_irq(kvm->arch.vioapic,
irq_event.irq, irq_event.irq,
irq_event.level); irq_event.level);
mutex_unlock(&kvm->lock); mutex_unlock(&kvm->lock);
...@@ -3084,8 +3084,8 @@ static void kvm_free_vcpus(struct kvm *kvm) ...@@ -3084,8 +3084,8 @@ static void kvm_free_vcpus(struct kvm *kvm)
void kvm_arch_destroy_vm(struct kvm *kvm) void kvm_arch_destroy_vm(struct kvm *kvm)
{ {
kfree(kvm->vpic); kfree(kvm->arch.vpic);
kfree(kvm->vioapic); kfree(kvm->arch.vioapic);
kvm_free_vcpus(kvm); kvm_free_vcpus(kvm);
kvm_free_physmem(kvm); kvm_free_physmem(kvm);
kfree(kvm); kfree(kvm);
......
...@@ -275,6 +275,8 @@ struct kvm_arch{ ...@@ -275,6 +275,8 @@ struct kvm_arch{
* Hash table of struct kvm_mmu_page. * Hash table of struct kvm_mmu_page.
*/ */
struct list_head active_mmu_pages; struct list_head active_mmu_pages;
struct kvm_pic *vpic;
struct kvm_ioapic *vioapic;
}; };
struct kvm_vcpu_stat { struct kvm_vcpu_stat {
......
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