From owner-p4-projects@FreeBSD.ORG Sat Nov 8 14:28:11 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 00948106568C; Sat, 8 Nov 2008 14:28:11 +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 AD43C1065678; Sat, 8 Nov 2008 14:28:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id 0390F8FC18; Sat, 8 Nov 2008 14:28:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) X-Spam-Flag: SKIP X-Spam-Yversion: Spamooborona-2.1.0 Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 227345202; Sat, 08 Nov 2008 16:28:09 +0200 Message-ID: <4915A1F8.1010807@FreeBSD.org> Date: Sat, 08 Nov 2008 16:28:08 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.17 (X11/20081029) MIME-Version: 1.0 To: Hans Petter Selasky References: <200811080910.mA89AgTZ048172@repoman.freebsd.org> <49156A0B.4030506@FreeBSD.org> <200811081259.08838.hselasky@freebsd.org> In-Reply-To: <200811081259.08838.hselasky@freebsd.org> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit 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:28:11 -0000 Hans Petter Selasky wrote: > 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? > > 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? I am sure then there is not so good with alignment in busdma now. I was trying to get 4K alignment and instead got some strange effects. But this change looks like hides the truth even deeper. -- Alexander Motin