From owner-freebsd-current@FreeBSD.ORG Sat Nov 8 12:51:01 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 DCB3C1065687; Sat, 8 Nov 2008 12:51:01 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe13.tele2.se [212.247.155.129]) by mx1.freebsd.org (Postfix) with ESMTP id 46F228FC16; Sat, 8 Nov 2008 12:51:01 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=dHLmn-RhnaEA:10 a=d4Qm339WgMUA:10 a=d6BVkb5LuPPVEe4iNQMLyA==:17 a=6I5d2MoRAAAA:8 a=RkScOIeDkh45HGVlyqMA:9 a=yWpb11-SDuv2qki6rvJzrjavSn4A:4 a=LY0hPdMaydYA:10 Received: from [62.113.135.6] (account mc467741@c2i.net [62.113.135.6] verified) by mailfe13.swip.net (CommuniGate Pro SMTP 5.2.6) with ESMTPA id 755393197; Sat, 08 Nov 2008 13:50:59 +0100 From: Hans Petter Selasky To: freebsd-usb@freebsd.org Date: Sat, 8 Nov 2008 13:53:09 +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: <200811081353.09697.hselasky@c2i.net> Cc: freebsd-current@freebsd.org Subject: Re: (FWD) Serious busdma bug in -current in relation to USB harware. 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: Sat, 08 Nov 2008 12:51:02 -0000 On Saturday 08 November 2008, Alexander Motin wrote: > Hans Petter Selasky wrote: > > http://perforce.freebsd.org/chv.cgi?CH=152649 > > > > Change 152649 by hselasky@hselasky_laptop001 on 2008/11/08 09:09:50 > > > > > > Fix a serious BUSDMA bug: The initial virtual page offset is > > not retained on the bounce pages, which is what the EHCI and > > the OHCI expects. > > I'm sorry, but are you sure with this? If bounce page will have the same > page offset as original data, then how bus_dma_tag_create()'s alignment > parameter expected to work? What if data are misaligned, but hardware > require alignment? Hi, I'm not saying that my patch is fully correct for all cases, but at least it solves the USB case. USB uses an alignment of 1-byte for data. Probably someone needs to sit down a think this through. Like it is now, it is very scary with regard to USB! Maybe it is time to create a new busdma tag flag? BUS_DMA_NOREALIGN? If this flag is set, busdma should refuse to load the memory if the memory is not aligned already to the given aligment in the DMA tag ? --HPS