From: Zhang Xiantao <[EMAIL PROTECTED]> Date: Thu, 13 Dec 2007 23:50:52 +0800 Subject: [PATCH] kvm Portability. Add kvm_vcpu_arch support.
In this patch, host_tsc is moved to arch fileds. Signed-off-by: Zhang Xiantao <[EMAIL PROTECTED]> --- drivers/kvm/svm.c | 4 ++-- drivers/kvm/vmx.c | 4 ++-- drivers/kvm/x86.h | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 839a75f..c56e29b 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c @@ -633,7 +633,7 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu) * increasing TSC. */ rdtscll(tsc_this); - delta = vcpu->host_tsc - tsc_this; + delta = vcpu->arch.host_tsc - tsc_this; svm->vmcb->control.tsc_offset += delta; vcpu->cpu = cpu; kvm_migrate_apic_timer(vcpu); @@ -652,7 +652,7 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu) for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++) wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]); - rdtscll(vcpu->host_tsc); + rdtscll(vcpu->arch.host_tsc); } static void svm_vcpu_decache(struct kvm_vcpu *vcpu) diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 548e3a5..7710ba1 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c @@ -247,7 +247,7 @@ static void __vcpu_clear(void *arg) vmcs_clear(vmx->vmcs); if (per_cpu(current_vmcs, cpu) == vmx->vmcs) per_cpu(current_vmcs, cpu) = NULL; - rdtscll(vmx->vcpu.host_tsc); + rdtscll(vmx->vcpu.arch.host_tsc); } static void vcpu_clear(struct vcpu_vmx *vmx) @@ -528,7 +528,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu) * Make sure the time stamp counter is monotonous. */ rdtscll(tsc_this); - delta = vcpu->host_tsc - tsc_this; + delta = vcpu->arch.host_tsc - tsc_this; vmcs_write64(TSC_OFFSET, vmcs_read64(TSC_OFFSET) + delta); } } diff --git a/drivers/kvm/x86.h b/drivers/kvm/x86.h index 0fc7020..5fb2df3 100644 --- a/drivers/kvm/x86.h +++ b/drivers/kvm/x86.h @@ -92,9 +92,12 @@ enum { #include "x86_emulate.h" +struct kvm_vcpu_arch { + u64 host_tsc; +}; + struct kvm_vcpu { KVM_VCPU_COMM; - u64 host_tsc; int interrupt_window_open; unsigned long irq_summary; /* bit vector: 1 per word in irq_pending */ DECLARE_BITMAP(irq_pending, KVM_NR_INTERRUPTS); @@ -163,6 +166,7 @@ struct kvm_vcpu { /* emulate context */ struct x86_emulate_ctxt emulate_ctxt; + struct kvm_vcpu_arch arch; }; struct descriptor_table { -- 1.5.1.2
0001-kvm-Portability.-Add-kvm_vcpu_arch-support.patch
Description: 0001-kvm-Portability.-Add-kvm_vcpu_arch-support.patch
------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel