public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: jeremy-TSDbQ3PG+2Y@public.gmane.org,
	avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org,
	Glauber de Oliveira Costa
	<gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH 2/2] fill cpuid with clocksource information
Date: Tue, 15 Jan 2008 13:10:52 -0200	[thread overview]
Message-ID: <1200409866869-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <12004098602108-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

In this patch, we probe the host checking for clocksource capabilities.
In case it is found, it is advertised to the guest through the appropriate
cpuid mechanism

Signed-off-by: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 qemu/qemu-kvm-x86.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 21ec112..6b11f02 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -517,6 +517,11 @@ int kvm_arch_qemu_init_env(CPUState *cenv)
     int cpuid_nent = 0;
     CPUState copy;
     uint32_t i, limit;
+    int clocksource_feature = 0;
+#ifdef KVM_CAP_CLOCKSOURCE
+    clocksource_feature = kvm_check_extension(kvm_context, KVM_CAP_CLOCKSOURCE);
+    clocksource_feature <<= KVM_FEATURE_CLOCKSOURCE; 
+#endif
 
     copy = *cenv;
 
@@ -534,7 +539,7 @@ int kvm_arch_qemu_init_env(CPUState *cenv)
     pv_ent = &cpuid_ent[cpuid_nent++];
     memset(pv_ent, 0, sizeof(*pv_ent));
     pv_ent->function = KVM_CPUID_FEATURES;
-    pv_ent->eax = 0;
+    pv_ent->eax = clocksource_feature;
 #endif
 
     copy.regs[R_EAX] = 0;
-- 
1.5.0.6


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

  parent reply	other threads:[~2008-01-15 15:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-15 15:10 [PATCH 0/2] kvm clock - userspace with patches Glauber de Oliveira Costa
     [not found] ` <12004098521016-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-15 15:10   ` [PATCH 1/2] include kvm_para.h Glauber de Oliveira Costa
     [not found]     ` <12004098602108-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-15 15:10       ` Glauber de Oliveira Costa [this message]
     [not found]         ` <1200409866869-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-20 15:41           ` [PATCH 2/2] fill cpuid with clocksource information Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2008-01-11 13:11 [PATCH 0/2] KVM clock - userspace part Glauber de Oliveira Costa
2008-01-11 13:11 ` [PATCH 1/2] include kvm_para.h Glauber de Oliveira Costa
     [not found]   ` <12000571224066-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-11 13:11     ` [PATCH 2/2] fill cpuid with clocksource information Glauber de Oliveira Costa

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=1200409866869-git-send-email-gcosta@redhat.com \
    --to=gcosta-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=jeremy-TSDbQ3PG+2Y@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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