From: "Joachim Deguara" <joachim.deguara@amd.com>
To: "LKML" <linux-kernel@vger.kernel.org>,
"Ingo Molnar" <mingo@elte.hu>,
"Thomas Gleixner" <tglx@linutronix.de>
Subject: [PATCH] -rt fix TSC calibration from PM Timer
Date: Mon, 21 May 2007 17:43:09 +0200 [thread overview]
Message-ID: <200705211743.10402.joachim.deguara@amd.com> (raw)
The code to calibrate TSC frequency from the PM timer does not work on my
laptop with the 2.6.21-rt5.
[ 0.247815] time.c: Detected 62117.606 MHz processor.
The code looks to be copied from the calibration from HPET but unfortunately
it reports frequency instead of period in femtoseconds as the HPET does. I
also rearranged the math to make the femtoseconds and kHz clearer but it does
loose a negligible amount of precision.
Signed-off-by: Joachim Deguara <joachim.deguara@amd.com>
Index: 2.6-rt/arch/x86_64/kernel/tsc.c
===================================================================
--- 2.6-rt.orig/arch/x86_64/kernel/tsc.c
+++ 2.6-rt/arch/x86_64/kernel/tsc.c
@@ -187,14 +187,14 @@ void __init tsc_calibrate(void)
return;
}
- tsc2 = (tsc2 - tsc1) * 1000000000L;
+ tsc2 = tsc2 - tsc1;
if (hpet) {
hpet2 = (hpet2 - hpet1) & 0xFFFFFFFF;
- tsc1 = (hpet2 * hpet_readl(HPET_PERIOD)) / 1000;
+ tsc1 = hpet2 * hpet_readl(HPET_PERIOD) / 1e12;
} else {
pm2 = (pm2 -pm1) & ACPI_PM_MASK;
- tsc1 = (pm2 * PMTMR_TICKS_PER_SEC) / 1000;
+ tsc1 = (pm2 * 1e3) / PMTMR_TICKS_PER_SEC;
}
tsc_khz = tsc2 / tsc1;
next reply other threads:[~2007-05-21 15:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-21 15:43 Joachim Deguara [this message]
2007-05-21 16:01 ` [PATCH] -rt fix TSC calibration from PM Timer Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200705211743.10402.joachim.deguara@amd.com \
--to=joachim.deguara@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox