From owner-svn-src-all@freebsd.org Mon Nov 9 15:42:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BECEA29276; Mon, 9 Nov 2015 15:42:01 +0000 (UTC) (envelope-from royger@gmail.com) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C58FC17F8; Mon, 9 Nov 2015 15:42:00 +0000 (UTC) (envelope-from royger@gmail.com) Received: by wmww144 with SMTP id w144so37672541wmw.0; Mon, 09 Nov 2015 07:41:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=3v21H7d8rPxBhlu+rqc+SMvr9FcBxI8oHalgBci+aGk=; b=rGOs1arAoWNJJAunbxOqiYzc1NheJ9YS5tZV9trAMQ5je1aCr8wOfREq/xu2p0mzvd VEg6bWCyZo8z6rVbDc2c5ZiA43ydXauQK17P1X4bKCAX/2K0E1heSa71HS+CBqFzBR32 yTzFDwodpoyCJyvZkqL5y0XZU/2zyEd5fVav15krPoqEjDvqD9YKkzv1bSsaB04aTajY X9VKLFt4IabXrgMB80ZajdfU8uFL11FmXIeqC3S9g4o70Cn19uiyXK6kUhiGDi6mvU8l EtiB/8WOTfWsu/xrhBmfm6CUQ2KsJkmpPRuFxW3BdluiI2mqrQEZzMdKgA1NBzqYMyGb /IRA== X-Received: by 10.28.139.208 with SMTP id n199mr27532699wmd.82.1447083718048; Mon, 09 Nov 2015 07:41:58 -0800 (PST) Received: from [172.16.1.30] (15.Red-83-50-122.dynamicIP.rima-tde.net. [83.50.122.15]) by smtp.gmail.com with ESMTPSA id l78sm14926550wmb.5.2015.11.09.07.41.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2015 07:41:57 -0800 (PST) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Subject: Re: svn commit: r290610 - head/sys/x86/x86 To: Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201511091219.tA9CJwe7067036@repo.freebsd.org> <564091FF.8090605@selasky.org> From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= X-Enigmail-Draft-Status: N1110 Message-ID: <5640BEBE.3070805@FreeBSD.org> Date: Mon, 9 Nov 2015 16:41:50 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <564091FF.8090605@selasky.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2015 15:42:01 -0000 Hello, El 09/11/15 a les 13.30, Hans Petter Selasky ha escrit: > On 11/09/15 13:19, Roger Pau Monné wrote: >> + if (dmat->common.flags & BUS_DMA_KEEP_PG_OFFSET) { >> + /* >> + * If we have to keep the offset of each page this function >> + * is not suitable, switch back to bus_dmamap_load_ma_triv >> + * which is going to do the right thing in this case. >> + */ >> + error = bus_dmamap_load_ma_triv(dmat, map, ma, buflen, ma_offs, >> + flags, segs, segp); >> + return (error); >> + } > > Hi, > > There has been an update made to the USB stack, which is currently the > only client of "BUS_DMA_KEEP_PG_OFFSET", which means this check can The only in-tree client. We don't know if there are other clients out of the tree. > probably be skipped or relaxed a bit. The condition which must be > fullfilled is: So you basically want a contiguous bounce buffer. I don't think we can just change BUS_DMA_KEEP_PG_OFFSET to mean "use a contiguous bounce buffer". Maybe a new flag could be introduced to describe this new requirement and the old one deprecated. > #ifdef USB_DEBUG > if (nseg > 1 && > ((segs->ds_addr + segs->ds_len) & (USB_PAGE_SIZE - 1)) != > ((segs + 1)->ds_addr & (USB_PAGE_SIZE - 1))) { > /* > * This check verifies there is no page offset hole > * between the first and second segment. See the > * BUS_DMA_KEEP_PG_OFFSET flag. > */ > DPRINTFN(0, "Page offset was not preserved\n"); > error = 1; > goto done; > } > #endif AFAICT with the current bounce implementation on x86 you would have to specify an alignment of PAGE_SIZE in order to have this guarantee without specifying BUS_DMA_KEEP_PG_OFFSET. IMHO, we should change all the current bounce buffer code and switch to use memdescs for everything (ie: bios and mbufs should use a memdesc internally). Then each arch should provide functions to copy from the different kinds of memdescs (either memdescs containing physical or virtual memory), so the bounce code could be unified between all arches. Of course that's easier said than done... Roger.