From brandt@fokus.fraunhofer.de  Fri Jun 13 01:55:42 2003
Return-Path: <brandt@fokus.fraunhofer.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 212EA37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 13 Jun 2003 01:55:42 -0700 (PDT)
Received: from mailhub.fokus.fraunhofer.de (mailhub.fokus.fraunhofer.de [193.174.154.14])
	by mx1.FreeBSD.org (Postfix) with ESMTP id BBCE243FB1
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 13 Jun 2003 01:55:40 -0700 (PDT)
	(envelope-from brandt@fokus.fraunhofer.de)
Received: from beagle.fokus.fraunhofer.de (beagle [193.175.132.100])
	by mailhub.fokus.fraunhofer.de (8.11.6p2/8.11.6) with ESMTP id h5D8tXd10837
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 13 Jun 2003 10:55:38 +0200 (MEST)
Received: from beagle.fokus.fraunhofer.de (localhost [127.0.0.1])
	by beagle.fokus.fraunhofer.de (8.12.9/8.12.9) with ESMTP id h5D8tI3j006678
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 13 Jun 2003 10:55:33 +0200 (CEST)
	(envelope-from hbb@beagle.fokus.fraunhofer.de)
Received: (from hbb@localhost)
	by beagle.fokus.fraunhofer.de (8.12.9/8.12.9/Submit) id h5D8t7SY006677;
	Fri, 13 Jun 2003 10:55:07 +0200 (CEST)
	(envelope-from hbb)
Message-Id: <200306130855.h5D8t7SY006677@beagle.fokus.fraunhofer.de>
Date: Fri, 13 Jun 2003 10:55:07 +0200 (CEST)
From: harti@freebsd.org
Reply-To: harti@freebsd.org
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: the bus_dma man page fails to document alignment restrictions
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         53271
>Category:       docs
>Synopsis:       bus_dma(9) fails to document alignment restrictions
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 13 02:00:30 PDT 2003
>Closed-Date:    
>Last-Modified:  Sat Dec 24 03:02:24 GMT 2005
>Originator:     Hartmut Brandt
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Fraunhofer Fokus
>Environment:
System: FreeBSD beagle.fokus.fraunhofer.de 5.1-CURRENT FreeBSD 5.1-CURRENT #0: Thu Jun 12 11:30:16 CEST 2003 hbb@beagle.fokus.fraunhofer.de:/opt/obj/usr/src/sys/BEAGLE i386


	
>Description:

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.

	
>How-To-Repeat:

look at sys/i386/i386/bus_machdep.c, sys/sparc64/sparc64/{bus_machdep,iommu}.c

	
>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.
	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-doc->hmp 
Responsible-Changed-By: hmp 
Responsible-Changed-When: Fri Jun 13 11:47:37 PDT 2003 
Responsible-Changed-Why:  
Hmm, interesting. 
I will take care of this issue after discussing it with Justin. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=53271 
>Unformatted:
