diff options
author | Zhang Xiantao <xiantao.zhang@intel.com> | 2007-12-13 21:20:16 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:58:10 -0500 |
commit | bfc6d222bdb1123d12c1193bcd7c755e6617b405 (patch) | |
tree | 72fb596179845648c3a050669f6f8ab16a834d3b /drivers/kvm | |
parent | d7deeeb02cf73fd98cb71a6a0a5dffab9ef79556 (diff) |
KVM: Portability: Move round_robin_prev_vcpu and tss_addr to kvm_arch
This patches moves two fields round_robin_prev_vcpu and tss 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>
Diffstat (limited to 'drivers/kvm')
-rw-r--r-- | drivers/kvm/kvm.h | 3 | ||||
-rw-r--r-- | drivers/kvm/lapic.c | 4 | ||||
-rw-r--r-- | drivers/kvm/vmx.c | 12 | ||||
-rw-r--r-- | drivers/kvm/x86.h | 4 |
4 files changed, 12 insertions, 11 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index d9ce916e98ab..ab9657a6f0ce 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -124,9 +124,6 @@ struct kvm { | |||
124 | struct file *filp; | 124 | struct file *filp; |
125 | struct kvm_io_bus mmio_bus; | 125 | struct kvm_io_bus mmio_bus; |
126 | struct kvm_io_bus pio_bus; | 126 | struct kvm_io_bus pio_bus; |
127 | int round_robin_prev_vcpu; | ||
128 | unsigned int tss_addr; | ||
129 | struct page *apic_access_page; | ||
130 | struct kvm_vm_stat stat; | 127 | struct kvm_vm_stat stat; |
131 | struct kvm_arch arch; | 128 | struct kvm_arch arch; |
132 | }; | 129 | }; |
diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c index 5c9f46784c26..8c74bf184a07 100644 --- a/drivers/kvm/lapic.c +++ b/drivers/kvm/lapic.c | |||
@@ -404,7 +404,7 @@ static struct kvm_lapic *kvm_apic_round_robin(struct kvm *kvm, u8 vector, | |||
404 | int next; | 404 | int next; |
405 | struct kvm_lapic *apic = NULL; | 405 | struct kvm_lapic *apic = NULL; |
406 | 406 | ||
407 | last = kvm->round_robin_prev_vcpu; | 407 | last = kvm->arch.round_robin_prev_vcpu; |
408 | next = last; | 408 | next = last; |
409 | 409 | ||
410 | do { | 410 | do { |
@@ -417,7 +417,7 @@ static struct kvm_lapic *kvm_apic_round_robin(struct kvm *kvm, u8 vector, | |||
417 | break; | 417 | break; |
418 | apic = NULL; | 418 | apic = NULL; |
419 | } while (next != last); | 419 | } while (next != last); |
420 | kvm->round_robin_prev_vcpu = next; | 420 | kvm->arch.round_robin_prev_vcpu = next; |
421 | 421 | ||
422 | if (!apic) | 422 | if (!apic) |
423 | printk(KERN_DEBUG "vcpu not ready for apic_round_robin\n"); | 423 | printk(KERN_DEBUG "vcpu not ready for apic_round_robin\n"); |
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index d0f431d4fe4d..7e61a560aab5 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -1143,12 +1143,12 @@ static void enter_pmode(struct kvm_vcpu *vcpu) | |||
1143 | 1143 | ||
1144 | static gva_t rmode_tss_base(struct kvm *kvm) | 1144 | static gva_t rmode_tss_base(struct kvm *kvm) |
1145 | { | 1145 | { |
1146 | if (!kvm->tss_addr) { | 1146 | if (!kvm->arch.tss_addr) { |
1147 | gfn_t base_gfn = kvm->memslots[0].base_gfn + | 1147 | gfn_t base_gfn = kvm->memslots[0].base_gfn + |
1148 | kvm->memslots[0].npages - 3; | 1148 | kvm->memslots[0].npages - 3; |
1149 | return base_gfn << PAGE_SHIFT; | 1149 | return base_gfn << PAGE_SHIFT; |
1150 | } | 1150 | } |
1151 | return kvm->tss_addr; | 1151 | return kvm->arch.tss_addr; |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | static void fix_rmode_seg(int seg, struct kvm_save_segment *save) | 1154 | static void fix_rmode_seg(int seg, struct kvm_save_segment *save) |
@@ -1473,7 +1473,7 @@ static int alloc_apic_access_page(struct kvm *kvm) | |||
1473 | int r = 0; | 1473 | int r = 0; |
1474 | 1474 | ||
1475 | mutex_lock(&kvm->lock); | 1475 | mutex_lock(&kvm->lock); |
1476 | if (kvm->apic_access_page) | 1476 | if (kvm->arch.apic_access_page) |
1477 | goto out; | 1477 | goto out; |
1478 | kvm_userspace_mem.slot = APIC_ACCESS_PAGE_PRIVATE_MEMSLOT; | 1478 | kvm_userspace_mem.slot = APIC_ACCESS_PAGE_PRIVATE_MEMSLOT; |
1479 | kvm_userspace_mem.flags = 0; | 1479 | kvm_userspace_mem.flags = 0; |
@@ -1482,7 +1482,7 @@ static int alloc_apic_access_page(struct kvm *kvm) | |||
1482 | r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0); | 1482 | r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0); |
1483 | if (r) | 1483 | if (r) |
1484 | goto out; | 1484 | goto out; |
1485 | kvm->apic_access_page = gfn_to_page(kvm, 0xfee00); | 1485 | kvm->arch.apic_access_page = gfn_to_page(kvm, 0xfee00); |
1486 | out: | 1486 | out: |
1487 | mutex_unlock(&kvm->lock); | 1487 | mutex_unlock(&kvm->lock); |
1488 | return r; | 1488 | return r; |
@@ -1699,7 +1699,7 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) | |||
1699 | 1699 | ||
1700 | if (vm_need_virtualize_apic_accesses(vmx->vcpu.kvm)) | 1700 | if (vm_need_virtualize_apic_accesses(vmx->vcpu.kvm)) |
1701 | vmcs_write64(APIC_ACCESS_ADDR, | 1701 | vmcs_write64(APIC_ACCESS_ADDR, |
1702 | page_to_phys(vmx->vcpu.kvm->apic_access_page)); | 1702 | page_to_phys(vmx->vcpu.kvm->arch.apic_access_page)); |
1703 | 1703 | ||
1704 | vmx->vcpu.arch.cr0 = 0x60000010; | 1704 | vmx->vcpu.arch.cr0 = 0x60000010; |
1705 | vmx_set_cr0(&vmx->vcpu, vmx->vcpu.arch.cr0); /* enter rmode */ | 1705 | vmx_set_cr0(&vmx->vcpu, vmx->vcpu.arch.cr0); /* enter rmode */ |
@@ -1789,7 +1789,7 @@ static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr) | |||
1789 | ret = kvm_set_memory_region(kvm, &tss_mem, 0); | 1789 | ret = kvm_set_memory_region(kvm, &tss_mem, 0); |
1790 | if (ret) | 1790 | if (ret) |
1791 | return ret; | 1791 | return ret; |
1792 | kvm->tss_addr = addr; | 1792 | kvm->arch.tss_addr = addr; |
1793 | return 0; | 1793 | return 0; |
1794 | } | 1794 | } |
1795 | 1795 | ||
diff --git a/drivers/kvm/x86.h b/drivers/kvm/x86.h index ef23a30bf048..945583934853 100644 --- a/drivers/kvm/x86.h +++ b/drivers/kvm/x86.h | |||
@@ -277,6 +277,10 @@ struct kvm_arch{ | |||
277 | struct list_head active_mmu_pages; | 277 | struct list_head active_mmu_pages; |
278 | struct kvm_pic *vpic; | 278 | struct kvm_pic *vpic; |
279 | struct kvm_ioapic *vioapic; | 279 | struct kvm_ioapic *vioapic; |
280 | |||
281 | int round_robin_prev_vcpu; | ||
282 | unsigned int tss_addr; | ||
283 | struct page *apic_access_page; | ||
280 | }; | 284 | }; |
281 | 285 | ||
282 | struct kvm_vcpu_stat { | 286 | struct kvm_vcpu_stat { |