From owner-freebsd-hackers Mon Aug 27 10:22:31 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from bingnet2.cc.binghamton.edu (bingnet2.cc.binghamton.edu [128.226.1.18]) by hub.freebsd.org (Postfix) with ESMTP id 679FA37B405 for ; Mon, 27 Aug 2001 10:22:28 -0700 (PDT) (envelope-from zzhang@cs.binghamton.edu) Received: from onyx (onyx.cs.binghamton.edu [128.226.140.171]) by bingnet2.cc.binghamton.edu (8.11.4/8.11.4) with ESMTP id f7RHMKo09821; Mon, 27 Aug 2001 13:22:20 -0400 (EDT) Date: Mon, 27 Aug 2001 13:21:17 -0400 (EDT) From: Zhihui Zhang X-Sender: zzhang@onyx To: Julian Elischer Cc: freebsd-hackers@freebsd.org Subject: Re: ata0-master: non aligned DMA transfer attempted In-Reply-To: <3B8A78CA.A888C9BC@elischer.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 27 Aug 2001, Julian Elischer wrote: > Zhihui Zhang wrote: > > > I believe that message is from ata_dmasetup(): > > > > if (((uintptr_t)data & scp->alignment) || (count & scp->alignment)) { > > ata_printf(scp, device, "non aligned DMA transfer attempted\n"); > > return -1; > > } > > > > The user address obtained by static allocation is not 16-byte aligned. The > > kernel routine physio() grabs a physical buffer to do DMA, but it still > > uses the user's address. The KVA associated with the buffer is not used. > > > > -Zhihui > > > the physical address of a buffer will have the same allignment as the KVA > address. But how can you explain the following statement in physio(): bp->b_dev = dev; bp->b_iodone = physwakeup; ----> bp->b_data = uio->uio_iov[i].iov_base; bp->b_bcount = uio->uio_iov[i].iov_len; bp->b_offset = uio->uio_offset; bp->b_saveaddr = sa; The bp->b_data is set to point to the user address. And later on, it is passed to the data argument of ata_dmasetup(), where the alignment is checked. -Zhihui To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message