lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1327363550-19952-2-git-send-email-john.stultz@linaro.org>
Date:	Mon, 23 Jan 2012 16:05:48 -0800
From:	John Stultz <john.stultz@...aro.org>
To:	lkml <linux-kernel@...r.kernel.org>
Cc:	John Stultz <john.stultz@...aro.org>,
	Martin Schwidefsky <schwidefsky@...ibm.com>,
	linux-s390@...r.kernel.org
Subject: [RFC][PATCH 1/3] clocksource: s390: Convert s390 to use clocksource_register_khz

Converts s390 TOD clock to use clocksource_register_khz

The tod freq I calculated seems a bit fast. Need someone
to double check me here.

CC: Martin Schwidefsky <schwidefsky@...ibm.com>
CC: linux-s390@...r.kernel.org
Signed-off-by: John Stultz <john.stultz@...aro.org>
---
 arch/s390/kernel/time.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index fa02f44..37e8ec5 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -207,8 +207,6 @@ static struct clocksource clocksource_tod = {
 	.rating		= 400,
 	.read		= read_tod_clock,
 	.mask		= -1ULL,
-	.mult		= 1000,
-	.shift		= 12,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -267,7 +265,16 @@ void __init time_init(void)
 	if (register_external_interrupt(0x1406, timing_alert_interrupt))
 		panic("Couldn't request external interrupt 0x1406");
 
-	if (clocksource_register(&clocksource_tod) != 0)
+	/* s390 TOD apparently runs at 4,096,000,000 cycs/sec
+	 * XXX - Brute forced tod freq from:
+	 *    2^shift/mult * NSEC_PER_SEC	= cyc/sec
+	 *    2^12 / 1000  * 1000000000		= cyc/sec
+	 *    2^12 * 1000000			= cyc/sec
+	 *    2^12 * 1000			= kcyc/sec
+	 *    1000<<12				= kcyc/sec
+	 * Could be totally wrong. -johnstul
+	 */
+	if (clocksource_register_khz(&clocksource_tod, (1000<<12) ) != 0)
 		panic("Could not register TOD clock source");
 
 	/* Enable TOD clock interrupts on the boot cpu. */
-- 
1.7.3.2.146.gca209

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ