From: Joerg Roedel <joerg.roedel@amd.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: Joerg Roedel <joerg.roedel@amd.com>,
Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel <qemu-devel@nongnu.org>,
kvm@vger.kernel.org
Subject: [Qemu-devel] [PATCH 2/2] qemu-x86: Set tsc_khz in kvm when supported
Date: Fri, 17 Jun 2011 16:00:14 +0200 [thread overview]
Message-ID: <1308319214-8474-3-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1308319214-8474-1-git-send-email-joerg.roedel@amd.com>
Make use of the KVM_TSC_CONTROL feature if available.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
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);
--
1.7.4.1
prev parent reply other threads:[~2011-06-17 13:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-17 14:00 [Qemu-devel] [PATCH 0/2] Initial TSC-Scaling support for uq/master Joerg Roedel
2011-06-17 14:00 ` [Qemu-devel] [PATCH 1/2] qemu-x86: Add tsc_khz option to -cpu Joerg Roedel
2011-06-19 11:32 ` Avi Kivity
2011-06-17 14:00 ` Joerg Roedel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1308319214-8474-3-git-send-email-joerg.roedel@amd.com \
--to=joerg.roedel@amd.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).