diff options
author | Zhang Xiantao <xiantao.zhang@intel.com> | 2007-12-13 23:50:52 +0800 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 17:58:09 +0200 |
commit | ad312c7c79f781c822e37effe41307503a2bb85b (patch) | |
tree | d979bfb70e76ada58b79b456c61a0507a8f0847d /drivers/kvm/x86.h | |
parent | 682c59a3f3f211ed555b17144f2d82eb8286a1db (diff) | |
download | lwn-ad312c7c79f781c822e37effe41307503a2bb85b.tar.gz lwn-ad312c7c79f781c822e37effe41307503a2bb85b.zip |
KVM: Portability: Introduce kvm_vcpu_arch
Move all the architecture-specific fields in kvm_vcpu into a new struct
kvm_vcpu_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/x86.h')
-rw-r--r-- | drivers/kvm/x86.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/kvm/x86.h b/drivers/kvm/x86.h index 0fc7020aa1a5..0e01ac75268c 100644 --- a/drivers/kvm/x86.h +++ b/drivers/kvm/x86.h @@ -92,8 +92,7 @@ enum { #include "x86_emulate.h" -struct kvm_vcpu { - KVM_VCPU_COMM; +struct kvm_vcpu_arch { u64 host_tsc; int interrupt_window_open; unsigned long irq_summary; /* bit vector: 1 per word in irq_pending */ @@ -130,7 +129,6 @@ struct kvm_vcpu { int last_pt_write_count; u64 *last_pte_updated; - struct i387_fxsave_struct host_fx_image; struct i387_fxsave_struct guest_fx_image; @@ -159,12 +157,17 @@ struct kvm_vcpu { int cpuid_nent; struct kvm_cpuid_entry2 cpuid_entries[KVM_MAX_CPUID_ENTRIES]; - /* emulate context */ struct x86_emulate_ctxt emulate_ctxt; }; +struct kvm_vcpu { + KVM_VCPU_COMM; + + struct kvm_vcpu_arch arch; +}; + struct descriptor_table { u16 limit; unsigned long base; @@ -339,7 +342,7 @@ static inline void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) static inline int kvm_mmu_reload(struct kvm_vcpu *vcpu) { - if (likely(vcpu->mmu.root_hpa != INVALID_PAGE)) + if (likely(vcpu->arch.mmu.root_hpa != INVALID_PAGE)) return 0; return kvm_mmu_load(vcpu); @@ -348,7 +351,7 @@ static inline int kvm_mmu_reload(struct kvm_vcpu *vcpu) static inline int is_long_mode(struct kvm_vcpu *vcpu) { #ifdef CONFIG_X86_64 - return vcpu->shadow_efer & EFER_LME; + return vcpu->arch.shadow_efer & EFER_LME; #else return 0; #endif @@ -356,17 +359,17 @@ static inline int is_long_mode(struct kvm_vcpu *vcpu) static inline int is_pae(struct kvm_vcpu *vcpu) { - return vcpu->cr4 & X86_CR4_PAE; + return vcpu->arch.cr4 & X86_CR4_PAE; } static inline int is_pse(struct kvm_vcpu *vcpu) { - return vcpu->cr4 & X86_CR4_PSE; + return vcpu->arch.cr4 & X86_CR4_PSE; } static inline int is_paging(struct kvm_vcpu *vcpu) { - return vcpu->cr0 & X86_CR0_PG; + return vcpu->arch.cr0 & X86_CR0_PG; } int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3); @@ -489,8 +492,8 @@ static inline void kvm_inject_gp(struct kvm_vcpu *vcpu, u32 error_code) static inline int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) { - return vcpu->mp_state == VCPU_MP_STATE_RUNNABLE - || vcpu->mp_state == VCPU_MP_STATE_SIPI_RECEIVED; + return vcpu->arch.mp_state == VCPU_MP_STATE_RUNNABLE + || vcpu->arch.mp_state == VCPU_MP_STATE_SIPI_RECEIVED; } #endif |