Module Name:    src
Committed By:   thorpej
Date:           Sun Sep 27 23:17:36 UTC 2020

Modified Files:
        src/sys/arch/alpha/alpha: clock.c

Log Message:
Don't use the PCC timecunter on emulated Qemu systems.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/alpha/clock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/alpha/alpha/clock.c
diff -u src/sys/arch/alpha/alpha/clock.c:1.43 src/sys/arch/alpha/alpha/clock.c:1.44
--- src/sys/arch/alpha/alpha/clock.c:1.43	Fri Sep  4 03:41:49 2020
+++ src/sys/arch/alpha/alpha/clock.c	Sun Sep 27 23:17:36 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.43 2020/09/04 03:41:49 thorpej Exp $ */
+/* $NetBSD: clock.c,v 1.44 2020/09/27 23:17:36 thorpej Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.43 2020/09/04 03:41:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.44 2020/09/27 23:17:36 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.
 #include <sys/device.h>
 #include <sys/lwp.h>
 
+#include <machine/alpha.h>
 #include <machine/autoconf.h>
 #include <machine/cpuconf.h>
 #include <machine/cpu_counter.h>
@@ -78,7 +79,6 @@ clockattach(void (*fns)(void *), void *d
 void
 cpu_initclocks(void)
 {
-	uint64_t pcc_freq;
 
 	if (clock_init == NULL)
 		panic("cpu_initclocks: no clock attached");
@@ -99,10 +99,13 @@ cpu_initclocks(void)
 	schedhz = 16;
 
 	/*
-	 * Initialize PCC timecounter.
+	 * Initialize PCC timecounter, unless we're running in Qemu
+	 * (we will use a different timecounter in that case).
 	 */
-	pcc_freq = cpu_frequency(curcpu());
-	cc_init(NULL, pcc_freq, "PCC", PCC_QUAL);
+	if (! alpha_is_qemu) {
+		const uint64_t pcc_freq = cpu_frequency(curcpu());
+		cc_init(NULL, pcc_freq, "PCC", PCC_QUAL);
+	}
 
 	/*
 	 * Get the clock started.

Reply via email to