KVM: Portability: move vpic and vioapic to kvm_arch
authorZhang Xiantao <xiantao.zhang@intel.com>
Fri, 14 Dec 2007 02:17:34 +0000 (10:17 +0800)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 15:58:10 +0000 (17:58 +0200)
This patches moves two fields vpid and vioapic to kvm_arch

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Acked-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/ioapic.c
drivers/kvm/irq.h
drivers/kvm/kvm.h
drivers/kvm/x86.c
drivers/kvm/x86.h

index 04910368c251596ca7766e7008be573bdb83ab8a..f8236774c1b44353661e027a4c09bc41e9bf19fe 100644 (file)
@@ -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)
 {
-       struct kvm_ioapic *ioapic = kvm->vioapic;
+       struct kvm_ioapic *ioapic = kvm->arch.vioapic;
        union ioapic_redir_entry *ent;
        int gsi;
 
@@ -390,7 +390,7 @@ int kvm_ioapic_init(struct kvm *kvm)
        ioapic = kzalloc(sizeof(struct kvm_ioapic), GFP_KERNEL);
        if (!ioapic)
                return -ENOMEM;
-       kvm->vioapic = ioapic;
+       kvm->arch.vioapic = ioapic;
        kvm_ioapic_reset(ioapic);
        ioapic->dev.read = ioapic_mmio_read;
        ioapic->dev.write = ioapic_mmio_write;
index a688c51d0a395ea32a0306ec78208b82742e9e4f..6e023dc3f848273495e02cca4f5ae6fa82d94fdd 100644 (file)
@@ -148,12 +148,12 @@ do {                                                                      \
 
 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)
 {
-       return kvm->vioapic;
+       return kvm->arch.vioapic;
 }
 
 static inline int irqchip_in_kernel(struct kvm *kvm)
index 65de5e4225f70c7b8bb20bf4dc45e5bd56577054..d9ce916e98ab8c704106a2a7a3a10984aa48b33b 100644 (file)
@@ -124,8 +124,6 @@ struct kvm {
        struct file *filp;
        struct kvm_io_bus mmio_bus;
        struct kvm_io_bus pio_bus;
-       struct kvm_pic *vpic;
-       struct kvm_ioapic *vioapic;
        int round_robin_prev_vcpu;
        unsigned int tss_addr;
        struct page *apic_access_page;
index c0e95fb9f46c5df2195fcb24e753e2721715ee25..b37c0093d728996efd694c766febb60938b554e4 100644 (file)
@@ -1386,12 +1386,12 @@ long kvm_arch_vm_ioctl(struct file *filp,
        }
        case KVM_CREATE_IRQCHIP:
                r = -ENOMEM;
-               kvm->vpic = kvm_create_pic(kvm);
-               if (kvm->vpic) {
+               kvm->arch.vpic = kvm_create_pic(kvm);
+               if (kvm->arch.vpic) {
                        r = kvm_ioapic_init(kvm);
                        if (r) {
-                               kfree(kvm->vpic);
-                               kvm->vpic = NULL;
+                               kfree(kvm->arch.vpic);
+                               kvm->arch.vpic = NULL;
                                goto out;
                        }
                } else
@@ -1409,7 +1409,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
                                kvm_pic_set_irq(pic_irqchip(kvm),
                                        irq_event.irq,
                                        irq_event.level);
-                       kvm_ioapic_set_irq(kvm->vioapic,
+                       kvm_ioapic_set_irq(kvm->arch.vioapic,
                                        irq_event.irq,
                                        irq_event.level);
                        mutex_unlock(&kvm->lock);
@@ -3084,8 +3084,8 @@ static void kvm_free_vcpus(struct kvm *kvm)
 
 void kvm_arch_destroy_vm(struct kvm *kvm)
 {
-       kfree(kvm->vpic);
-       kfree(kvm->vioapic);
+       kfree(kvm->arch.vpic);
+       kfree(kvm->arch.vioapic);
        kvm_free_vcpus(kvm);
        kvm_free_physmem(kvm);
        kfree(kvm);
index 5cdc3666e21226c2c930110fea9f164aa47be6e5..ef23a30bf0480c96d999e7ea0dc145e5efad97b7 100644 (file)
@@ -275,6 +275,8 @@ struct kvm_arch{
         * Hash table of struct kvm_mmu_page.
         */
        struct list_head active_mmu_pages;
+       struct kvm_pic *vpic;
+       struct kvm_ioapic *vioapic;
 };
 
 struct kvm_vcpu_stat {