Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jan 2012 23:26:27 +0200
From:      Andriy Gapon <avg@FreeBSD.org>
To:        mj@feral.com
Cc:        FreeBSD current <freebsd-current@FreeBSD.org>
Subject:   Re: bus dma: a flag/quirk for page zero
Message-ID:  <4F0CAD03.1090605@FreeBSD.org>
In-Reply-To: <alpine.BSF.2.00.1201101252530.86261@ns1.feral.com>
References:  <4F0C9D14.60705@FreeBSD.org> <alpine.BSF.2.00.1201101252530.86261@ns1.feral.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F0CAD03.1090605>