Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F175839436
D21777.id62543.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
D21777.id62543.diff
View Options
Index: head/sys/x86/x86/tsc.c
===================================================================
--- head/sys/x86/x86/tsc.c
+++ head/sys/x86/x86/tsc.c
@@ -134,7 +134,11 @@
/*
* Calculate TSC frequency using information from the CPUID leaf 0x15
- * 'Time Stamp Counter and Nominal Core Crystal Clock'. It should be
+ * 'Time Stamp Counter and Nominal Core Crystal Clock'. If leaf 0x15
+ * is not functional, as it is on Skylake/Kabylake, try 0x16 'Processor
+ * Frequency Information'. Leaf 0x16 is described in the SDM as
+ * informational only, but if 0x15 did not work, and TSC calibration
+ * is disabled, it is the best we can get at all. It should still be
* an improvement over the parsing of the CPU model name in
* tsc_freq_intel(), when available.
*/
@@ -146,10 +150,20 @@
if (cpu_high < 0x15)
return (false);
do_cpuid(0x15, regs);
- if (regs[0] == 0 || regs[1] == 0 || regs[2] == 0)
+ if (regs[0] != 0 && regs[1] != 0 && regs[2] != 0) {
+ tsc_freq = (uint64_t)regs[2] * regs[1] / regs[0];
+ return (true);
+ }
+
+ if (cpu_high < 0x16)
return (false);
- tsc_freq = (uint64_t)regs[2] * regs[1] / regs[0];
- return (true);
+ do_cpuid(0x16, regs);
+ if (regs[0] != 0) {
+ tsc_freq = (uint64_t)regs[0] * 1000000;
+ return (true);
+ }
+
+ return (false);
}
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 14, 7:16 PM (4 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40815227
Default Alt Text
D21777.id62543.diff (1 KB)
Attached To
Mode
D21777: x86: Fall back to leaf 0x16 if TSC frequency is obtained by CPUID and leaf 0x15 is not functional.
Attached
Detach File
Event Timeline
Log In to Comment