Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] Make c0_compare_int_usable more bullet proof
@ 2007-10-19 15:54 Atsushi Nemoto
  2007-10-22  9:31 ` Ralf Baechle
  0 siblings, 1 reply; 6+ messages in thread
From: Atsushi Nemoto @ 2007-10-19 15:54 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

Use write_c0_compare(read_c0_count()) to clear interrupt.
And use delta value based on its speed for faster probing.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index a915e56..46a896f 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -179,19 +179,21 @@ static int c0_compare_int_pending(void)
 
 static int c0_compare_int_usable(void)
 {
-	const unsigned int delta = 0x300000;
+	unsigned int delta;
 	unsigned int cnt;
 
 	/*
 	 * IP7 already pending?  Try to clear it by acking the timer.
 	 */
 	if (c0_compare_int_pending()) {
-		write_c0_compare(read_c0_compare());
+		write_c0_compare(read_c0_count());
 		irq_disable_hazard();
 		if (c0_compare_int_pending())
 			return 0;
 	}
 
+	delta = read_c0_count();
+	delta = ((read_c0_count() - delta) ?: 1) << 8;
 	cnt = read_c0_count();
 	cnt += delta;
 	write_c0_compare(cnt);
@@ -202,7 +204,7 @@ static int c0_compare_int_usable(void)
 	if (!c0_compare_int_pending())
 		return 0;
 
-	write_c0_compare(read_c0_compare());
+	write_c0_compare(read_c0_count());
 	irq_disable_hazard();
 	if (c0_compare_int_pending())
 		return 0;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make c0_compare_int_usable more bullet proof
  2007-10-19 15:54 [PATCH] Make c0_compare_int_usable more bullet proof Atsushi Nemoto
@ 2007-10-22  9:31 ` Ralf Baechle
  2007-10-22 14:37   ` Atsushi Nemoto
  0 siblings, 1 reply; 6+ messages in thread
From: Ralf Baechle @ 2007-10-22  9:31 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips, Thiemo Seufer

On Sat, Oct 20, 2007 at 12:54:45AM +0900, Atsushi Nemoto wrote:

> Use write_c0_compare(read_c0_count()) to clear interrupt.
> And use delta value based on its speed for faster probing.

Hmm...  This one makes c0_compare_int_usable() fails when I run a malta
kernel on last week's qemu.

  Ralf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make c0_compare_int_usable more bullet proof
  2007-10-22  9:31 ` Ralf Baechle
@ 2007-10-22 14:37   ` Atsushi Nemoto
  2007-10-22 16:12     ` Atsushi Nemoto
  0 siblings, 1 reply; 6+ messages in thread
From: Atsushi Nemoto @ 2007-10-22 14:37 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, ths

On Mon, 22 Oct 2007 10:31:39 +0100, Ralf Baechle <ralf@linux-mips.org> wrote:
> > Use write_c0_compare(read_c0_count()) to clear interrupt.
> > And use delta value based on its speed for faster probing.
> 
> Hmm...  This one makes c0_compare_int_usable() fails when I run a malta
> kernel on last week's qemu.

Well, with my qemu-system-mips (0.9.0 and cvs),
c0_compare_int_usable() always return 0 with/without my patch.

But if I made c0_compare_int_usable() always return 1, it works fine
with c0 counter interrupt.  Quite strange...

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make c0_compare_int_usable more bullet proof
  2007-10-22 14:37   ` Atsushi Nemoto
@ 2007-10-22 16:12     ` Atsushi Nemoto
  0 siblings, 0 replies; 6+ messages in thread
From: Atsushi Nemoto @ 2007-10-22 16:12 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, ths

On Mon, 22 Oct 2007 23:37:33 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> > Hmm...  This one makes c0_compare_int_usable() fails when I run a malta
> > kernel on last week's qemu.
> 
> Well, with my qemu-system-mips (0.9.0 and cvs),
> c0_compare_int_usable() always return 0 with/without my patch.

Then I will split this patch.  Please try them.

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] Make c0_compare_int_usable more bullet proof
@ 2007-10-22 16:14 Atsushi Nemoto
  2007-10-22 19:26 ` Ralf Baechle
  0 siblings, 1 reply; 6+ messages in thread
From: Atsushi Nemoto @ 2007-10-22 16:14 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

Use write_c0_compare(read_c0_count()) to clear interrupt.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index a915e56..ae2984f 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -186,7 +186,7 @@ static int c0_compare_int_usable(void)
 	 * IP7 already pending?  Try to clear it by acking the timer.
 	 */
 	if (c0_compare_int_pending()) {
-		write_c0_compare(read_c0_compare());
+		write_c0_compare(read_c0_count());
 		irq_disable_hazard();
 		if (c0_compare_int_pending())
 			return 0;
@@ -202,7 +202,7 @@ static int c0_compare_int_usable(void)
 	if (!c0_compare_int_pending())
 		return 0;
 
-	write_c0_compare(read_c0_compare());
+	write_c0_compare(read_c0_count());
 	irq_disable_hazard();
 	if (c0_compare_int_pending())
 		return 0;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make c0_compare_int_usable more bullet proof
  2007-10-22 16:14 Atsushi Nemoto
@ 2007-10-22 19:26 ` Ralf Baechle
  0 siblings, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2007-10-22 19:26 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Tue, Oct 23, 2007 at 01:14:06AM +0900, Atsushi Nemoto wrote:

> Use write_c0_compare(read_c0_count()) to clear interrupt.

Applied, thanks.

  Ralf

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-10-22 19:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-19 15:54 [PATCH] Make c0_compare_int_usable more bullet proof Atsushi Nemoto
2007-10-22  9:31 ` Ralf Baechle
2007-10-22 14:37   ` Atsushi Nemoto
2007-10-22 16:12     ` Atsushi Nemoto
  -- strict thread matches above, loose matches on Subject: below --
2007-10-22 16:14 Atsushi Nemoto
2007-10-22 19:26 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox