From owner-freebsd-current@FreeBSD.ORG Sun Nov 16 13:06:12 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5430106564A; Sun, 16 Nov 2008 13:06:12 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe06.swip.net [212.247.154.161]) by mx1.freebsd.org (Postfix) with ESMTP id 239708FC17; Sun, 16 Nov 2008 13:06:11 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=OxQIQV-UnBUA:10 a=OldrGD9YyLYA:10 a=aniA1o7mVp4QawOfT9qHqA==:17 a=qSPV2YstbUVUn8ktqM8A:9 a=pk5SlkhxH9hEDXMoxyqZ3BP3mlcA:4 a=50e4U0PicR4A:10 Received: from [62.113.133.1] (account mc467741@c2i.net [62.113.133.1] verified) by mailfe06.swip.net (CommuniGate Pro SMTP 5.2.6) with ESMTPA id 1151017828; Sun, 16 Nov 2008 14:06:09 +0100 From: Hans Petter Selasky To: freebsd-usb@freebsd.org Date: Sun, 16 Nov 2008 14:08:20 +0100 User-Agent: KMail/1.9.7 References: <20081107082740.GA1334@icarus.home.lan> <20081108001128.GA1437@icarus.home.lan> <200811081023.10058.hselasky@freebsd.org> In-Reply-To: <200811081023.10058.hselasky@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811161408.21562.hselasky@c2i.net> Cc: freebsd-current@freebsd.org Subject: Re: [Serious] busdma bug in -current in relation to USB hardware - review wanted X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 13:06:12 -0000 Hi, It turns out my initial patch need to be limited to the use-case only. Before I start any real work, I want to know if anyone will object if I implement the following new BUS_DMA flag into FreeBSD's busdma system? amd64/amd64/busdma_machdep.c i386/i386/busdma_machdep.c arm/arm/busdma_machdep.c ia64/ia64/busdma_machdep.c mips/mips/busdma_machdep.c powerpc/powerpc/busdma_machdep.c sparc64/sparc64/bus_machdep.c sun4v/sun4v/bus_machdep.c sys/bus_dma.h /* * The following flag specifies that no re-alignment of individual * memory pages is allowed when loaded into DMA. It can only be used * when "maxsegsz" is equal to "PAGE_SIZE" and "alignment" is less * than or equal to 1. * * Background: Some kinds of DMA hardware only stores the full * physical address of the first memory page when multiple memory * pages are loaded into DMA. Consequtive memory pages only gets the * non-offset part of the physical address updated. The hardware * computes the amount of data that should be stored in the first * memory page from the minimum of the total transfer length and * PAGE_SIZE minus the initial page offset. When the initial page * offset is not preserved the hardware ends up transferring an * invalid number of bytes to or from the initial memory page. */ #define BUS_DMA_NOREAL 0x400 /* no page re-alignment allowed */ Without this new feature in busdma the USB hardware will not work when the DMA data is placed on bounce pages, for example on 64-bit architectures with more than 4GB of RAM. --HPS