From patchwork Fri Jun 17 14:00:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 100813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B983FB6FD5 for ; Sat, 18 Jun 2011 00:46:51 +1000 (EST) Received: from localhost ([::1]:38423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXaJs-0003mh-DA for incoming@patchwork.ozlabs.org; Fri, 17 Jun 2011 10:46:48 -0400 Received: from eggs.gnu.org ([140.186.70.92]:58197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXZaT-0007dX-PZ for qemu-devel@nongnu.org; Fri, 17 Jun 2011 09:59:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXZaO-0007dU-Gw for qemu-devel@nongnu.org; Fri, 17 Jun 2011 09:59:53 -0400 Received: from ch1ehsobe003.messaging.microsoft.com ([216.32.181.183]:29316 helo=CH1EHSOBE002.bigfish.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXZaN-0007ck-8c for qemu-devel@nongnu.org; Fri, 17 Jun 2011 09:59:47 -0400 Received: from mail146-ch1-R.bigfish.com (216.32.181.172) by CH1EHSOBE002.bigfish.com (10.43.70.52) with Microsoft SMTP Server id 14.1.225.22; Fri, 17 Jun 2011 13:59:45 +0000 Received: from mail146-ch1 (localhost.localdomain [127.0.0.1]) by mail146-ch1-R.bigfish.com (Postfix) with ESMTP id 4B931190247; Fri, 17 Jun 2011 13:59:45 +0000 (UTC) X-SpamScore: 1 X-BigFish: VPS1(zzzz1202hzz8275bhz32i668h839h61h) X-Forefront-Antispam-Report: CIP:163.181.249.108; KIP:(null); UIP:(null); IPVD:NLI; H:ausb3twp01.amd.com; RD:none; EFVD:NLI Received: from mail146-ch1 (localhost.localdomain [127.0.0.1]) by mail146-ch1 (MessageSwitch) id 1308319185120633_19271; Fri, 17 Jun 2011 13:59:45 +0000 (UTC) Received: from CH1EHSMHS013.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.253]) by mail146-ch1.bigfish.com (Postfix) with ESMTP id 190C170804D; Fri, 17 Jun 2011 13:59:45 +0000 (UTC) Received: from ausb3twp01.amd.com (163.181.249.108) by CH1EHSMHS013.bigfish.com (10.43.70.13) with Microsoft SMTP Server id 14.1.225.22; Fri, 17 Jun 2011 13:59:44 +0000 X-WSS-ID: 0LMXTJG-01-25Z-02 X-M-MSG: Received: from sausexedgep01.amd.com (sausexedgep01-ext.amd.com [163.181.249.72]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp01.amd.com (Axway MailGate 3.8.1) with ESMTP id 2889D10282AE; Fri, 17 Jun 2011 08:59:39 -0500 (CDT) Received: from sausexhtp02.amd.com (163.181.3.152) by sausexedgep01.amd.com (163.181.36.54) with Microsoft SMTP Server (TLS) id 8.3.106.1; Fri, 17 Jun 2011 09:00:11 -0500 Received: from storexhtp02.amd.com (172.24.4.4) by sausexhtp02.amd.com (163.181.3.152) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 17 Jun 2011 08:59:41 -0500 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp02.amd.com (172.24.4.4) with Microsoft SMTP Server id 8.3.83.0; Fri, 17 Jun 2011 09:59:40 -0400 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id F119449C5EA; Fri, 17 Jun 2011 14:59:39 +0100 (BST) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id 1F756FFEE5; Fri, 17 Jun 2011 16:00:16 +0200 (CEST) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti Date: Fri, 17 Jun 2011 16:00:14 +0200 Message-ID: <1308319214-8474-3-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1308319214-8474-1-git-send-email-joerg.roedel@amd.com> References: <1308319214-8474-1-git-send-email-joerg.roedel@amd.com> MIME-Version: 1.0 X-OriginatorOrg: amd.com X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP2+, XP SP1+ (seldom 98) X-Received-From: 216.32.181.183 Cc: Joerg Roedel , Anthony Liguori , qemu-devel , kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 2/2] qemu-x86: Set tsc_khz in kvm when supported X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Make use of the KVM_TSC_CONTROL feature if available. Signed-off-by: Joerg Roedel --- target-i386/kvm.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 1ae2d61..2d89544 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -528,6 +528,17 @@ int kvm_arch_init_vcpu(CPUState *env) } #endif +#ifdef KVM_CAP_TSC_CONTROL + r = kvm_check_extension(env->kvm_state, KVM_CAP_TSC_CONTROL); + if (r && env->tsc_khz) { + r = kvm_vcpu_ioctl(env, KVM_SET_TSC_KHZ, env->tsc_khz); + if (r < 0) { + fprintf(stderr, "KVM_SET_TSC_KHZ failed\n"); + return r; + } + } +#endif + qemu_add_vm_change_state_handler(cpu_update_state, env); return kvm_vcpu_ioctl(env, KVM_SET_CPUID2, &cpuid_data);