From: Chris Friesen <cfriesen@nortelnetworks.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] (comments requested) adding finer-grained timing to PPC add_timer_randomness()
Date: Wed, 22 Aug 2001 16:57:39 -0400 [thread overview]
Message-ID: <3B841CC3.E7040002@nortelnetworks.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 780 bytes --]
I'd like some comments on the following patch.
This patch is designed to add finer-grained timing (similar to the i386 timing)
to add_timer_randomness(). The only tricky bit is that the PPC601 doesn't
support the timebase registers. Accordingly, I've added a flag to the PPC port
that is used to keep track of whether or not the processor supports the timebase
register.
Is there a better way to keep track of this information? i386 has a struct with
useful information stored, but it doesn't look like PPC does.
Thanks,
Chris
--
Chris Friesen | MailStop: 043/33/F10
Nortel Networks | work: (613) 765-0557
3500 Carling Avenue | fax: (613) 765-2986
Nepean, ON K2H 8E9 Canada | email: cfriesen@nortelnetworks.com
[-- Attachment #2: random.patch --]
[-- Type: text/plain, Size: 2158 bytes --]
diff -ru linux-2.2.19-clean/arch/ppc/kernel/setup.c linux-2.2.19/arch/ppc/kernel/setup.c
--- linux-2.2.19-clean/arch/ppc/kernel/setup.c Sun Mar 25 11:31:49 2001
+++ linux-2.2.19/arch/ppc/kernel/setup.c Wed Aug 22 16:34:51 2001
@@ -103,6 +103,14 @@
unsigned long vgacon_remap_base;
#endif
+/* the PPC601 chip does not support timebase registers,
+ * so this is used to keep track of whether or not we
+ * support them
+ */
+#ifdef CONFIG_6xx
+extern int have_timebase = 1;
+#endif /* CONFIG_6xx */
+
/* copy of the residual data */
#ifndef CONFIG_MBX
unsigned char __res[sizeof(RESIDUAL)] __prepdata = {0,};
@@ -243,6 +251,7 @@
{
case 1:
len += sprintf(len+buffer, "601\n");
+ have_timebase = 0;
break;
case 3:
len += sprintf(len+buffer, "603\n");
diff -ru linux-2.2.19-clean/drivers/char/random.c linux-2.2.19/drivers/char/random.c
--- linux-2.2.19-clean/drivers/char/random.c Sun Mar 25 11:31:25 2001
+++ linux-2.2.19/drivers/char/random.c Wed Aug 22 16:35:34 2001
@@ -699,6 +699,7 @@
* are used for a high-resolution timer.
*
*/
+
static void add_timer_randomness(struct random_bucket *r,
struct timer_rand_state *state, unsigned num)
{
@@ -715,6 +716,16 @@
:"=a" (time), "=d" (high));
num ^= high;
} else {
+ time = jiffies;
+ }
+#elif defined (CONFIG_6xx)
+ if (have_timebase) {
+ __u32 high;
+ __asm__ __volatile__("mftbu %0" : "=r" (high) : );
+ __asm__ __volatile__("mftb %0" : "=r" (time) : );
+ num ^= high;
+ }
+ else {
time = jiffies;
}
#else
diff -ru linux-2.2.19-clean/include/asm-ppc/processor.h linux-2.2.19/include/asm-ppc/processor.h
--- linux-2.2.19-clean/include/asm-ppc/processor.h Sun Mar 25 11:31:08 2001
+++ linux-2.2.19/include/asm-ppc/processor.h Wed Aug 22 16:34:51 2001
@@ -216,6 +216,14 @@
void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
void release_thread(struct task_struct *);
+/* the PPC601 chip does not support timebase registers,
+ * so this is used to keep track of whether or not we
+ * support them
+ */
+#ifdef CONFIG_6xx
+extern int have_timebase;
+#endif /* CONFIG_6xx */
+
/*
* Create a new kernel thread.
*/
next reply other threads:[~2001-08-22 20:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-22 20:57 Chris Friesen [this message]
2001-08-22 21:06 ` [PATCH] (comments requested) adding finer-grained timing to PPC add_timer_randomness() Ignacio Vazquez-Abrams
2001-08-22 21:27 ` Chris Friesen
2001-08-23 1:33 ` Paul Mackerras
2001-08-23 9:46 ` Gabriel Paubert
2001-08-23 13:11 ` Benjamin Herrenschmidt
2001-08-23 12:31 ` Paul Mackerras
2001-08-24 7:32 ` Gabriel Paubert
2001-08-24 13:59 ` Christopher Friesen
2001-08-28 20:50 ` Gabriel Paubert
2001-08-24 17:54 ` [PATCH] (comments requested) adding finer-grained timing to PPC Albert D. Cahalan
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=3B841CC3.E7040002@nortelnetworks.com \
--to=cfriesen@nortelnetworks.com \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).