Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 PR/47967: Jeff Rizzo: Add a probe for QEMU ...



details:   https://anonhg.NetBSD.org/src/rev/e2ccd6044b66
branches:  trunk
changeset: 787621:e2ccd6044b66
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jun 26 20:52:28 2013 +0000

description:
PR/47967: Jeff Rizzo: Add a probe for QEMU to disable it from claiming it
has MSR_TSC. Fixes DTRACE crashing because it returned a frequency of 0.

diffstat:

 sys/arch/x86/x86/identcpu.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (44 lines):

diff -r 75cbd46103fd -r e2ccd6044b66 sys/arch/x86/x86/identcpu.c
--- a/sys/arch/x86/x86/identcpu.c       Wed Jun 26 20:20:36 2013 +0000
+++ b/sys/arch/x86/x86/identcpu.c       Wed Jun 26 20:52:28 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: identcpu.c,v 1.32 2012/06/16 17:30:19 chs Exp $        */
+/*     $NetBSD: identcpu.c,v 1.33 2013/06/26 20:52:28 christos Exp $   */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.32 2012/06/16 17:30:19 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.33 2013/06/26 20:52:28 christos Exp $");
 
 #include "opt_xen.h"
 
@@ -563,6 +563,17 @@
 }
 
 static void
+cpu_probe_qemu(struct cpu_info *ci)
+{
+       if (memcmp("QEMU Virtual CPU", cpu_brand_string, 16) != 0)
+               return;
+
+       /* if QEMU does not implement MSR_TSC, disable the TSC */
+       ci->ci_feat_val[0] &= ~CPUID_MSR;
+       cpu_feature[0] &= ~CPUID_MSR;
+}
+
+static void
 cpu_probe_vortex86(struct cpu_info *ci)
 {
 #define PCI_MODE1_ADDRESS_REG  0x0cf8
@@ -709,6 +720,7 @@
        cpu_probe_c3(ci);
        cpu_probe_geode(ci);
        cpu_probe_vortex86(ci);
+       cpu_probe_qemu(ci);
 
        x86_cpu_topology(ci);
 



Home | Main Index | Thread Index | Old Index