From owner-freebsd-current@FreeBSD.ORG Tue Jan 10 21:26:35 2012 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 3D2E51065670 for ; Tue, 10 Jan 2012 21:26:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 84C598FC0C for ; Tue, 10 Jan 2012 21:26:34 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA06756; Tue, 10 Jan 2012 23:26:29 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1RkjDA-0007zG-Th; Tue, 10 Jan 2012 23:26:28 +0200 Message-ID: <4F0CAD03.1090605@FreeBSD.org> Date: Tue, 10 Jan 2012 23:26:27 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: mj@feral.com References: <4F0C9D14.60705@FreeBSD.org> In-Reply-To: X-Enigmail-Version: undefined Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: FreeBSD current Subject: Re: bus dma: a flag/quirk for page zero 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: Tue, 10 Jan 2012 21:26:35 -0000 on 10/01/2012 22:54 Matthew Jacob said the following: > > I think it would be just simpler to disallow page zero usage period. That would be simpler indeed. > Can you > think of any case where physical page 0 is ever a valid DMA address? Not sure if I got your question right. I think that it's possible that an arbitrary virtual page with data could reside at the physical address zero. One particular case that I ran into in practice is that at least amd64 dump code always includes page zero into a dump and the umass+usb code tries to do a direct dma from it. > At the very least, require bounce buffers. Not sure if I got this suggestion in this terse form. Could you please explain? Thank you! > On Tue, 10 Jan 2012, Andriy Gapon wrote: > >> >> >> Some hardware interfaces may reserve a special meaning for a (physical) memory >> address value of zero. One example is the OHCI specification where a zero value >> in CurrentBufferPointer doesn't mean a physical address, but has a reserved >> meaning. To be honest I don't have another example :) but don't preclude its >> existence. >> >> To deal with this peculiarity we could use a special flag/quirk that would >> instruct the bus dma code to never use the page zero for communication with the >> hardware. >> Here's a proof of concept patch that implements the idea: >> http://people.freebsd.org/~avg/usb-dma-pagezero.diff >> >> Some concerns: >> - not sure if BUS_DMA_NO_PAGEZERO is the best name for the flag >> - the patch implements the flag only for x86 at the moment >> - usb code uses the flag regardless of the actual controller type >> >> What do you think? >> >> -- >> Andriy Gapon >> _______________________________________________ >> freebsd-current@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-current >> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" >> -- Andriy Gapon