Jan Mikkelsen wrote:

Hi,

Doug White wrote:

On Fri, 22 Sep 2006, Jan Mikkelsen wrote:


Quick summary: sym(4) assumes on amd64 that virtual

addresses provided by

bus_dmamem_alloc() have the same alignment as the physical

addresses (in

this case, 2*PAGE_SIZE). They don't, and stuff breaks.

This patch works

around that.

Why is this? busdma supports alignment constraints; why not just set the alignment to what you need it set at? I realize sym has its own hand rolled DMA management craziness but alignment is something busdma can take care of easily.


sym has the alignment requirement on the virtual address because of the
buddy memory allocation algorithm; changing how sym allocates memory
internally would remove the requirement.  The buddy algorithm with 2^13
bytes aligned on a 2^12 byte (but not a 2^13 byte) boundary can provide two
chunks of 2^12 bytes but nothing greater than 2^12 bytes.

The VTOBUS failure is caused by the buddy implementation making alignment
assumptions which aren't true, and then getting the virtual addresses wrong.

Perhaps I'm just doing something wrong with bus_dma.  I believe I set the
alignment requirements to be 2*PAGE_SIZE, and this is what I see for the
physical address.  However the virtual address seems to only be page
aligned.

I can't see any mention of virtual address alignment in the bus_dma man
page.  Can it take care of virtual address alignment?  If so, how?

busdma makes no guarantees on virtual addresses.

Sigh, sorry I never got this fixed.  The custom memory allocator made me
unhappy, and I never had time to dig into it.  Do real docs on sym exist
somewhere?  I'm not against sitting down and re-writing the physical
memory handling to both work and conform to the FreeBSD APIs.

Scott

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to