lkml.org 
[lkml]   [2000]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectFIX: Nice oops from agpgart - 2.2 kernels and Alpha
I complained few days ago that 'agpgart.o' module from 2.2.18pre
is causing a kernel oops. The problem turned out to be an apparent
assumption that PCI memory <-> memory mapping is an identity and
this is not always the case.

Here is a patch applicable to all 2.2.18pre kernels with agpgart
support:

--- linux-2.2.18px/drivers/char/agp/agp.h~ Tue Oct 3 16:03:13 2000
+++ linux-2.2.18px/drivers/char/agp/agp.h Tue Oct 17 10:23:14 2000
@@ -27,6 +27,8 @@
#ifndef _AGP_BACKEND_PRIV_H
#define _AGP_BACKEND_PRIV_H 1

+#include <asm/io.h>
+
enum aper_size_type {
U8_APER_SIZE,
U16_APER_SIZE,
@@ -119,13 +121,13 @@
void (*free_by_type) (agp_memory *);
};

-#define OUTREG32(mmap, addr, val) *(volatile u32 *)(mmap + (addr)) = (val)
-#define OUTREG16(mmap, addr, val) *(volatile u16 *)(mmap + (addr)) = (val)
-#define OUTREG8 (mmap, addr, val) *(volatile u8 *) (mmap + (addr)) = (val)
-
-#define INREG32(mmap, addr) *(volatile u32 *)(mmap + (addr))
-#define INREG16(mmap, addr) *(volatile u16 *)(mmap + (addr))
-#define INREG8 (mmap, addr) *(volatile u8 *) (mmap + (addr))
+#define OUTREG32(mmap, addr, val) writel((val),(mmap + (addr)))
+#define OUTREG16(mmap, addr, val) writew((val),(mmap + (addr)))
+#define OUTREG8 (mmap, addr, val) writeb((val),(mmap + (addr)))
+
+#define INREG32(mmap, addr) readl(mmap + (addr))
+#define INREG16(mmap, addr) readw(mmap + (addr))
+#define INREG8 (mmap, addr) readb(mmap + (addr))

#define CACHE_FLUSH agp_bridge.cache_flush
#define A_SIZE_8(x) ((aper_size_info_8 *) x)
With this patch 'agpgart.o' module compiled on x86 machine is
byte-by-byte identical as the one without it. OTOH on UP1100 Alpha
with an Irongate after the fixed module is inserted instead of
crashing prints this in dmesg:

Linux agpgart interface v0.99 (c) Jeff Hartmann
agpgart: Maximum main memory to use for agp memory: 204M
agpgart: Detected AMD Irongate chipset
agpgart: AGP aperture is 512M @ 0x40000000
I have no idea if this is really useful on Alpha and if there are no
other address mapping problems still there but the patch above should
at least be a start. :-)

A peek at agpgart sources from 2.4 reveals that this mapping problem
is absent there as INREG... and OUTREG... macros are defined with
a help of __raw_read... and __raw_write... which function the same
like the stuff above from 2.2.

On x86 machines 'agpgart' appears to be really doing something. :-)
A small test program 'testgart' (got in mail from somebody) reports
a memory benchmark speed in 580-590 mb/s range before I started my
X server and some 720+ mb/s after X was started and exited. Don't
ask me why. :-)

The same 'testgart' on Alpha, after obviously x86 specific or not
applicable stuff was edited out, is causing a spectacular crash
with mulitple oopses, a total lockup and zilch in log files. So
not everything is healthy yet but not bombing out for a start
seems like a good beginning.

Michal
michal@harddata.com

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

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.034 / U:3.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site