From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 3 12:02:33 2006 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.ORG Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E7F4116A47E for ; Mon, 3 Jul 2006 12:02:32 +0000 (UTC) (envelope-from CZander@nvidia.com) Received: from HQEMGATE01.nvidia.com (hqemgate01.nvidia.com [216.228.112.170]) by mx1.FreeBSD.org (Postfix) with ESMTP id D6A9D43D46 for ; Mon, 3 Jul 2006 12:02:26 +0000 (GMT) (envelope-from CZander@nvidia.com) Received: from hqemfe02.nvidia.com (Not Verified[172.16.227.92]) by HQEMGATE01.nvidia.com id ; Mon, 03 Jul 2006 05:03:43 -0700 Received: from nvidia.com ([172.16.228.84]) by hqemfe02.nvidia.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 3 Jul 2006 05:02:03 -0700 Date: Mon, 3 Jul 2006 14:02:36 +0200 From: Christian Zander To: "M. Warner Losh" Message-ID: <20060703120236.GS692@wolf.nvidia.com> References: <20060629111231.GA692@wolf.nvidia.com> <20060702.220217.2073896080.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060702.220217.2073896080.imp@bsdimp.com> User-Agent: Mutt/1.4.2.1i X-NVConfidentiality: public X-OriginalArrivalTime: 03 Jul 2006 12:02:04.0038 (UTC) FILETIME=[7FA51260:01C69E98] Cc: freebsd-hackers@FreeBSD.ORG, czander@nvidia.com Subject: Re: NVIDIA FreeBSD kernel feature requests X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Christian Zander List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jul 2006 12:02:33 -0000 On Sun, Jul 02, 2006 at 10:02:17PM -0600, M. Warner Losh wrote: > In message: <20060629111231.GA692@wolf.nvidia.com> > Christian Zander writes: > : This summary makes an attempt to describe the kernel interfaces needed by > : the NVIDIA FreeBSD i386 graphics driver to achieve feature parity with > : the Linux/Solaris graphics drivers, and/or required to make support for > : the FreeBSD amd64 platform feasible. It also describes some of the > : technical difficulties encountered by NVIDIA during the FreeBSD i386 > : graphics driver's development, how these problems have been worked around > : and what could be done to solve them better. > > Thank you for taking the time to let us know how we might make the > system better. > > : The NVIDIA graphics driver needs to be able to create uncached kernel > : and user mappings of I/O memory, such as NVIDIA GPU registers. The > : FreeBSD kernel does not currently provide the interfaces necessary to > : specify the memory type when creating such mappings, which makes it > : difficult for the NVIDIA graphics driver to guarantee that the correct > : memory type is selected. > > Is this via the bus_alloc_resource interface? Is uncached kernel > memory different than non-prefetchable memory? If so, please specify > how it is different. If not, then we have an interface that will do > what you want, except it is only implemented for cardbus and would > need to be implemented for pci pci and pci host bridges. Would having > better functionality here help? I noticed it wasn't on the task list... > The I/O memory in question is non-prefetchable. The NVIDIA FreeBSD graphics driver currently uses the bus_alloc_resource() interface without the RF_ACTIVE flag and then uses pmap_mapdev() to obtain kernel mappings of the I/O memory, which it then updates with the PCD/PWT flags to force them to be uncached. User mappings are created via mmap(); they use the effective memory type derived from the MTRR configuration. If you're interested in taking a look, the FreeBSD kernel specific interface code is included with the NVIDIA graphics driver. John is working on pmap_mapdev_attr(), which is built on top of the PAT support he is adding, and this interface will allow the caller to request a specific memory type to use for the mapping, handling the details transparently (e.g. the direct mapping on FreeBSD amd64). It would probably be useful if the bus_alloc_resource() interface supported this functionality, but the NVIDIA graphics driver would still need to use the pmap_mapdev_attr() interface, e.g. for its AGP GART driver. The current plan is to replace pmap_mapdev() with pmap_mapdev_attr() in the driver when the latter interface becomes available. Thanks, > Warner -- christian zander ch?zander@nvidia.com