From owner-p4-projects@FreeBSD.ORG Sat Nov 8 14:38:43 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2469B1065686; Sat, 8 Nov 2008 14:38:43 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBDBB106567D; Sat, 8 Nov 2008 14:38:42 +0000 (UTC) (envelope-from hselasky@freebsd.org) Received: from swip.net (mailfe05.swip.net [212.247.154.129]) by mx1.freebsd.org (Postfix) with ESMTP id 30C308FC14; Sat, 8 Nov 2008 14:38:42 +0000 (UTC) (envelope-from hselasky@freebsd.org) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=K2GdiJWsnm8A:10 a=d6BVkb5LuPPVEe4iNQMLyA==:17 a=6I5d2MoRAAAA:8 a=-dLL6WXLSGgghjb-8aMA:9 a=8qAkhfxfJSH0HIxy3AAlyJSzQ5IA:4 a=LY0hPdMaydYA:10 Received: from [62.113.135.6] (account mc467741@c2i.net [62.113.135.6] verified) by mailfe05.swip.net (CommuniGate Pro SMTP 5.2.6) with ESMTPA id 1042797641; Sat, 08 Nov 2008 15:38:40 +0100 From: Hans Petter Selasky To: Alexander Motin Date: Sat, 8 Nov 2008 15:40:48 +0100 User-Agent: KMail/1.9.7 References: <200811080910.mA89AgTZ048172@repoman.freebsd.org> <200811081259.08838.hselasky@freebsd.org> <4915A1F8.1010807@FreeBSD.org> In-Reply-To: <4915A1F8.1010807@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811081540.50034.hselasky@freebsd.org> Cc: Perforce Change Reviews Subject: Re: PERFORCE change 152649 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Nov 2008 14:38:43 -0000 On Saturday 08 November 2008, Alexander Motin wrote: > Hans Petter Selasky wrote: > > On Saturday 08 November 2008, Alexander Motin wrote: > >> Hans Petter Selasky wrote: > >>> http://perforce.freebsd.org/chv.cgi?CH=152649 > >>> > > > 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! > > This is a change to the one of basic kernel subsystems. Any change there > will affect ton's of drivers and may cause issues with too many of > broken/specific hardware. It should be done with maximum care without > quick fixes! > > > 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 ? > > What is the real reason to do that? If you are saying that you uses > 1-byte alignment then you should be able to accept _any_ address that > busdma will allocate to you! Why original data alignment should so > strictly affect hardware operation? Hi, The real reason is that the EHCI and OHCI only takes the full physical address of the _first_ page, and then for the subsequent pages only stores the upper bits of the physical address, leaving it impossible to program a per-page data start offset. The hardware assumes that the lower part of the physical address wraps modulo PAGE_SIZE, and that's it. Don't ask me why they designed it like that. Currently USB is broken on all architectures where bouncing is used. I see no other way around this than to change busdma. --HPS