From patchwork Wed Feb 3 08:53:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 76642 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o138sgFV012008 for ; Wed, 3 Feb 2010 08:54:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756209Ab0BCIyh (ORCPT ); Wed, 3 Feb 2010 03:54:37 -0500 Received: from goliath.siemens.de ([192.35.17.28]:21121 "EHLO goliath.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756091Ab0BCIye (ORCPT ); Wed, 3 Feb 2010 03:54:34 -0500 Received: from mail3.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o138rvst013766; Wed, 3 Feb 2010 09:53:58 +0100 Received: from localhost.localdomain ([139.25.173.28]) by mail3.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o138rkCJ012112; Wed, 3 Feb 2010 09:53:57 +0100 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org, Anthony Liguori , Alexander Graf , Glauber Costa , qemu-devel@nongnu.org Subject: [PATCH v2 18/21] qemu-kvm: Cleanup/fix TSC and PV clock writeback Date: Wed, 3 Feb 2010 09:53:43 +0100 Message-Id: <1b726440011c59d1fdfd7b4ac375ffdb5abefa9f.1265187223.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: References: In-Reply-To: References: Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 03 Feb 2010 08:54:42 +0000 (UTC) diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 23a23eb..e5040c9 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -972,8 +972,11 @@ void kvm_arch_load_regs(CPUState *env, int level) set_msr_entry(&msrs[n++], MSR_LSTAR , env->lstar); } #endif - set_msr_entry(&msrs[n++], MSR_KVM_SYSTEM_TIME, env->system_time_msr); - set_msr_entry(&msrs[n++], MSR_KVM_WALL_CLOCK, env->wall_clock_msr); + if (level == KVM_PUT_FULL_STATE) { + set_msr_entry(&msrs[n++], MSR_IA32_TSC, env->tsc); + set_msr_entry(&msrs[n++], MSR_KVM_SYSTEM_TIME, env->system_time_msr); + set_msr_entry(&msrs[n++], MSR_KVM_WALL_CLOCK, env->wall_clock_msr); + } rc = kvm_set_msrs(env, msrs, n); if (rc == -1) @@ -990,18 +993,6 @@ void kvm_arch_load_regs(CPUState *env, int level) kvm_put_vcpu_events(env, level); } -void kvm_load_tsc(CPUState *env) -{ - int rc; - struct kvm_msr_entry msr; - - set_msr_entry(&msr, MSR_IA32_TSC, env->tsc); - - rc = kvm_set_msrs(env, &msr, 1); - if (rc == -1) - perror("kvm_set_tsc FAILED.\n"); -} - void kvm_arch_save_regs(CPUState *env) { struct kvm_regs regs; diff --git a/qemu-kvm.h b/qemu-kvm.h index ca5c700..4c009c9 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -958,7 +958,6 @@ int handle_tpr_access(void *opaque, CPUState *env, uint64_t rip, #ifdef TARGET_I386 #define qemu_kvm_has_pit_state2() kvm_has_pit_state2(kvm_context) #endif -void kvm_load_tsc(CPUState *env); #else #define kvm_nested 0 #define qemu_kvm_has_gsi_routing() (0) @@ -966,9 +965,6 @@ void kvm_load_tsc(CPUState *env); #define qemu_kvm_has_pit_state2() (0) #endif #define qemu_kvm_cpu_stop(env) do {} while(0) -static inline void kvm_load_tsc(CPUState *env) -{ -} #endif void kvm_mutex_unlock(void); diff --git a/target-i386/machine.c b/target-i386/machine.c index bcc315b..b547e2a 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -354,11 +354,6 @@ static int cpu_post_load(void *opaque, int version_id) hw_breakpoint_insert(env, i); tlb_flush(env, 1); - - if (kvm_enabled()) { - kvm_load_tsc(env); - } - return 0; }