Bug 53271

Summary: bus_dma(9) fails to document alignment restrictions
Product: Documentation Reporter: Hartmut Brandt <harti>
Component: Manual PagesAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: doc, gonzo
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Hartmut Brandt freebsd_committer freebsd_triage 2003-06-13 10:00:30 UTC
While it is possible to specify an alignment to the bus_dma_tag_create
function this alignment is ignored in many (if not most cases). For i386
it is only effective if the tag is used to allocate memory via
bus_dmamem_alloc() and that memory is larger than PAGE_SIZE. For sparc64
the minimum alignment that may be specified seems to be a IO_PAGE_SIZE.
Other architectures probably have equivalent restrictions.

Many io devices need buffers that are aligned to 4-byte or other boundaries.
In these cases specifying an alignment does NOT help.

This should be documented as an implementation limitation, because it can
cause driver developers much grief searching for the problem.

Fix: 

Add something like the following to either the paragraph about
bus_dma_tag_create or into a BUGS or IMPLEMENTATION NOTES section:

The alignment argument to bus_dma_tag_create cannot be used to enforce
alignments that are lesser than a PAGE_SIZE. Generally it should be assumed that
the argument is ignored by the bus_dma code.
How-To-Repeat: 
look at sys/i386/i386/bus_machdep.c, sys/sparc64/sparc64/{bus_machdep,iommu}.c
Comment 1 Hiten Pandya freebsd_committer freebsd_triage 2003-06-13 19:47:37 UTC
Responsible Changed
From-To: freebsd-doc->hmp

Hmm, interesting. 
I will take care of this issue after discussing it with Justin.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:41 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2018-04-13 23:31:09 UTC
The original report is no longer true. alignment argument is not ignored by bus_dma_tag_create and it can be less than PAGE_SIZE