Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F101984761
D34581.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D34581.diff
View Options
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1167,7 +1167,6 @@
native_clock_source_init(void)
{
i8254_init();
- tsc_init();
}
static void
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -208,7 +208,6 @@
i386_clock_source_init(void)
{
i8254_init();
- tsc_init();
}
static void
diff --git a/sys/x86/isa/clock.c b/sys/x86/isa/clock.c
--- a/sys/x86/isa/clock.c
+++ b/sys/x86/isa/clock.c
@@ -129,6 +129,7 @@
mtx_init(&clock_lock, "clk", NULL, MTX_SPIN | MTX_NOPROFILE);
/* Init the clock in order to use DELAY */
init_ops.early_clock_source_init();
+ tsc_init();
}
static int
diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c
--- a/sys/x86/x86/tsc.c
+++ b/sys/x86/x86/tsc.c
@@ -147,6 +147,21 @@
tsc_early_calib_exact = 1;
}
+static void
+tsc_freq_xen(void)
+{
+ u_int regs[4];
+
+ /*
+ * Must run *after* generic tsc_freq_cpuid_vm, so that when Xen is
+ * emulating Viridian support the Viridian leaf is used instead.
+ */
+ KASSERT(hv_high >= 0x40000003, ("Invalid max hypervisor leaf on Xen"));
+ cpuid_count(0x40000003, 0, regs);
+ tsc_freq = (uint64_t)(regs[2]) * 1000;
+ tsc_early_calib_exact = 1;
+}
+
/*
* Calculate TSC frequency using information from the CPUID leaf 0x15 'Time
* Stamp Counter and Nominal Core Crystal Clock'. If leaf 0x15 is not
@@ -358,6 +373,12 @@
printf(
"Early TSC frequency %juHz derived from VMWare hypercall\n",
(uintmax_t)tsc_freq);
+ } else if (vm_guest == VM_GUEST_XEN) {
+ tsc_freq_xen();
+ if (bootverbose)
+ printf(
+ "Early TSC frequency %juHz derived from Xen CPUID\n",
+ (uintmax_t)tsc_freq);
} else if (tsc_freq_cpuid(&tsc_freq)) {
/*
* If possible, use the value obtained from CPUID as the initial
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 7, 4:37 AM (22 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14504722
Default Alt Text
D34581.diff (1 KB)
Attached To
Mode
D34581: x86/tsc: fetch frequency from CPUID when running on Xen
Attached
Detach File
Event Timeline
Log In to Comment