From mboxrd@z Thu Jan 1 00:00:00 1970 From: Glauber de Oliveira Costa Subject: [PATCH 2/2] fill cpuid with clocksource information Date: Fri, 11 Jan 2008 11:11:54 -0200 Message-ID: <12000571302971-git-send-email-gcosta@redhat.com> References: <12000571143111-git-send-email-gcosta@redhat.com> <12000571224066-git-send-email-gcosta@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: jeremy-TSDbQ3PG+2Y@public.gmane.org, avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org, Glauber de Oliveira Costa To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Return-path: In-Reply-To: <12000571224066-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.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 --- qemu/qemu-kvm-x86.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c index 21ec112..c008cb7 100644 --- a/qemu/qemu-kvm-x86.c +++ b/qemu/qemu-kvm-x86.c @@ -517,6 +517,10 @@ int kvm_arch_qemu_init_env(CPUState *cenv) int cpuid_nent = 0; CPUState copy; uint32_t i, limit; + int has_clocksource = 0; +#ifdef KVM_CAP_CLOCKSOURCE + has_clocksource = kvm_check_extension(kvm_context, KVM_CAP_CLOCKSOURCE); +#endif copy = *cenv; @@ -534,7 +538,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 = (has_clocksource << KVM_FEATURE_CLOCKSOURCE); #endif copy.regs[R_EAX] = 0; -- 1.5.0.6 ------------------------------------------------------------------------- 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