Re: [Serious] busdma bug in -current in relation to USB hardware - review wanted

From: Hans Petter Selasky <hselasky_at_c2i.net>
Date: Sun, 7 Dec 2008 10:25:58 +0100
On Saturday 06 December 2008, Marcel Moolenaar wrote:
> On Dec 6, 2008, at 4:34 AM, Hans Petter Selasky wrote:
> > Hi,
> >
> > After various feedback from several people I have made a new patch
> > proposal
> > that will fix the busdma problem.
> >
> > See:
> >
> > http://perforce.freebsd.org/chv.cgi?CH=154181
> >
> > Review wanted!
>
> The USB stack has a fixed page size of 4K. On our 64-bit platforms
> PAGE_SIZE is at least 8K. Your change is sloppy in that respect
> and doesn't make the distinction. That makes the patch a kluge.
> The definition of BUS_DMA_NO_REALIGN is based on circumstantial
> evidence only and as such, works as a side-effect. I don't think
> that's a good design.
>
> I don't think there's any reason not to preserve the page offset
> in all cases. So far all hardware worked whether or not their
> DMA pages were bounced and the non-bounced pages would have a
> possible non-zero page offset, whereas the bounced pages would
> always have a zero page offset. In short: it works either way.
> In particular, it works with the page offset preserved. Why not
> preserve it always? What's the downside?

Hi Marcel,

I think you might be right there. There is one case in which I don't 
understand what is the correct busdma behaviour. If the DMA tag has an 
alignment of 4 bytes, and the memory loaded is not aligned to four bytes, 
then should a bounce page be used? If yes, then you will need to clear the 
page offset. Else not. 

NOTE: We are not talking about allocating DMA memory, only loading it.

--HPS
Received on Sun Dec 07 2008 - 08:23:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:38 UTC