[PATCH] agpgart chipset knowledge encapsulation

From: Bjorn Helgaas (bjorn_helgaas@hp.com)
Date: Mon Dec 10 2001 - 19:38:40 EST


The point of this patch is to remove a chipset dependency from DRM so it
can cleanly support both the Intel 460GX and an HP IA64 chipset. I would
normally send this to Jeff Hartmann, but he seems to have disappeared,
leaving agpgart without an obvious maintainer.

DRM needs to know the physical addresses of pages bound into the AGP
aperture, and today that information is communicated from agpgart to DRM
in the memory[] array of the agp_memory structure. The problem is that
the values in the array are not simple physical addresses. Rather, they
are the physical addresses mangled to be suitable for direct insertion
into the GATT (the hardware-visible translation table).

Hence, DRM needs a way to unmangle these values to get the physical
address back. Today, agpgart exports a "page_mask" value, so DRM does the
equivalent of this:

    paddr = agpmem->memory->memory[offset] & dev->agp->page_mask;

This isn't sufficient for the 460GX, because its mangling function
requires a shift as well as a mask. The 460GX code (which is still in the
ia64 patch, not in the mainstream kernel) looks like this:

    paddr = (agpmem->memory->memory[offset] & 0xffffff) << 12;

So DRM currently has this chipset-specific code in it to unmangle the
values in memory[], while there's no reason I know of for the mangled
values to ever be exported from agpgart.

The attached patch against 2.4.16 remedies this by leaving the plain
physical addresses in memory[]. The chipset-specific mangling is then
done at the point where it is needed, when those values are inserted into
the GATT.

It's a little tricky because the DRM code is distributed with XFree86 as
well as with the kernel. All the combinations (old DRM + new kernel; new
DRM + old kernel; new DRM + new kernel) should still work, but DRM has to
check the kernel version it's compiled against, so there are three
KERNEL_VERSION(...) instances in the patch that need to be adjusted to
reflect the first version containing these changes.

Any feedback is welcome, especially if you can test it. I've been able to
test 460GX & ATI Radeon, HP & ATI Radeon, and Serverworks HE & MGA G400,
but obviously that's not exhaustive.

Bjorn Helgaas

--
Linux Systems Operation R&D
Hewlett-Packard Company
Fort Collins, CO


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



This archive was generated by hypermail 2b29 : Sat Dec 15 2001 - 21:00:19 EST