Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 08 Nov 2008 16:28:08 +0200
From:      Alexander Motin <mav@FreeBSD.org>
To:        Hans Petter Selasky <hselasky@freebsd.org>
Cc:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   Re: PERFORCE change 152649 for review
Message-ID:  <4915A1F8.1010807@FreeBSD.org>
In-Reply-To: <200811081259.08838.hselasky@freebsd.org>
References:  <200811080910.mA89AgTZ048172@repoman.freebsd.org> <49156A0B.4030506@FreeBSD.org> <200811081259.08838.hselasky@freebsd.org>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4915A1F8.1010807>