From owner-freebsd-current@FreeBSD.ORG Sun Jan 27 18:01:26 2008 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2725516A417 for ; Sun, 27 Jan 2008 18:01:26 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.swip.net [212.247.154.33]) by mx1.freebsd.org (Postfix) with ESMTP id B2DDB13C468 for ; Sun, 27 Jan 2008 18:01:25 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] Received: from [193.217.102.3] (account mc467741@c2i.net HELO [10.0.0.249]) by mailfe02.swip.net (CommuniGate Pro SMTP 5.1.13) with ESMTPA id 783739218 for current@freebsd.org; Sun, 27 Jan 2008 18:01:22 +0100 From: Hans Petter Selasky To: current@freebsd.org Date: Sun, 27 Jan 2008 18:02:13 +0100 User-Agent: KMail/1.9.7 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200801271802.14312.hselasky@c2i.net> Cc: Subject: BUS-DMA alignment check - false positives X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2008 18:01:26 -0000 Hi, When allocating DMA'able memory sometimes the virtual address can end up non-aligned, while the physical address is correctly aligned. The question is whether it is correct to mask the virtual address and not the physical address: i386/i386/busdma_machdep.c } else if ((uintptr_t)*vaddr & (dmat->alignment - 1)) { printf("bus_dmamem_alloc failed to align memory properly.\n"); } When allocating 1<<15 bytes aligned at 1<<15 bytes. bus_dmamem_alloc failed to align memory properly. Physaddr=0x3e030000 rem=0x00000000 --HPS