]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[PATCH] AGPGART: Fix serverworks TLB flush.
authorDave Jones <davej@redhat.com>
Mon, 7 Nov 2005 22:02:58 +0000 (14:02 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 14 Dec 2005 23:42:58 +0000 (15:42 -0800)
[AGPGART] Fix serverworks TLB flush.
Go back to what 2.4 kernels used to do here, as if this hits,
the kernel just hangs indefinitly.

Actually an improvement over 2.4 - we now break; out of the loop
instead of just printing messages on timeouts.

Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/char/agp/sworks-agp.c

index a9fb12c20eb72e92aa343413094270022a159e47..53968973f8900df3e5ff9c4b4060bef9a833d901 100644 (file)
@@ -242,13 +242,27 @@ static int serverworks_fetch_size(void)
  */
 static void serverworks_tlbflush(struct agp_memory *temp)
 {
+       unsigned long timeout;
+
        writeb(1, serverworks_private.registers+SVWRKS_POSTFLUSH);
-       while (readb(serverworks_private.registers+SVWRKS_POSTFLUSH) == 1)
+       timeout = jiffies + 3*HZ;
+       while (readb(serverworks_private.registers+SVWRKS_POSTFLUSH) == 1) {
                cpu_relax();
+               if (time_after(jiffies, timeout)) {
+                       printk(KERN_ERR PFX "TLB post flush took more than 3 seconds\n");
+                       break;
+               }
+       }
 
        writel(1, serverworks_private.registers+SVWRKS_DIRFLUSH);
-       while(readl(serverworks_private.registers+SVWRKS_DIRFLUSH) == 1)
+       timeout = jiffies + 3*HZ;
+       while (readl(serverworks_private.registers+SVWRKS_DIRFLUSH) == 1) {
                cpu_relax();
+               if (time_after(jiffies, timeout)) {
+                       printk(KERN_ERR PFX "TLB Dir flush took more than 3 seconds\n");
+                       break;
+               }
+       }
 }
 
 static int serverworks_configure(void)