Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Mon, 10 Dec 2001 19:35:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Mon, 10 Dec 2001 19:35:03 -0500 Received: from atlrel8.hp.com ([156.153.255.206]:3849 "HELO atlrel8.hp.com") by vger.kernel.org with SMTP id ; Mon, 10 Dec 2001 19:34:50 -0500 From: Bjorn Helgaas To: linux-kernel@vger.kernel.org, dri-devel@lists.sourceforge.net Subject: [PATCH] agpgart chipset knowledge encapsulation Date: Mon, 10 Dec 2001 17:38:40 -0700 X-Mailer: KMail [version 1.3.2] MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="------------Boundary-00=_GSL5KQYFN7XXNVTHNIT1" Message-Id: <20011211003445.2E63B403C@ldl.fc.hp.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org --------------Boundary-00=_GSL5KQYFN7XXNVTHNIT1 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit 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 --------------Boundary-00=_GSL5KQYFN7XXNVTHNIT1 Content-Type: application/x-gzip; name="pagemask.diff.gz" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="pagemask.diff.gz" H4sICC9RFTwAA3BhZ2VtYXNrLmRpZmYA5Vppc+JIEv2Mf0Vud7hDGGF0cAgzdpi2ZTczNnZg3DHH bihkVMLqBomVBG3P7sxv38wqARLm8tGxH5qwEVJlprJe5csqZcnxXBeKY/wLYeD544finR2xkhN6 ExZGpd69HZbs/oj++3YYW3dsvycE18vsFIvFrQ3mzkIP2sEE1Cqo6gH+aRpoiqLuFAqFbe6Wuwx8 OGU9UBW0caDWDrSaMHB8DEVNqck1KNChCsfHO5D7C/89F6TeOAyLRyO7z6xeMPZj+MchKHn4Dzbn 3CAEyQO80AAPfoJFWbxaKJBsMZfLicYhGwbh4x/ev+DDIfwtKQ8KfVzXzTfIYg5dtu5Cz+mzffrp sCgOg0eLbErS2I+8vs8cGAR+P8/lczkY3T9GVhxYEy+MpYW75IXZv0Qnq4qMvS9olTp2lvdS3NAN GbOEjuSzb4krIYvHoQ/t24uLxAh2A5vTnTika4CflN9DO/o6tcZ7TgLkHDlJzkrSJPAc2MtD1lpe FuKkED+OGPpReHrH7Uxxj/m1+XAUCg0xsBwNXQy5rujJkO8At0U96QWjR8vz3UCis68s9PkZ7AEd EHka0sxoAL8NdZ2HAwUPxorXILM5dCtisUS6MigyRN6fLHC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f3jvM pX1hzATnzU53FhKXzZ+vOqCsEWi1UaBeR6wLpb2dAhKpm5BIZG96ZA9du8fAi5A+/x57ITI/DiCZ YgHHB9wwGMIoZEVtv7yvVrkZeqUAA2afTkoYCokDS7bBASHZAYYLR+jdeyMcR7HQpIzWvupaN7fX 11edrnkq4wXSurDOzbbZaZ3IYkOXP4fUjfmLCjHMX0do5HKlPWj5IDYQOMtJIvu+wfRViRWLsVUb +IsLv+WLrswbFo1kQ3/nfxFsJXnRJAAA --------------Boundary-00=_GSL5KQYFN7XXNVTHNIT1-- - 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/