From owner-freebsd-arm@FreeBSD.ORG Sun Aug 11 15:43:09 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DDD04A5F; Sun, 11 Aug 2013 15:43:09 +0000 (UTC) (envelope-from cognet@ci0.Org) Received: from kanar.ci0.org (unknown [IPv6:2a01:e0b:1:150:ca0a:a9ff:fef1:a4c9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 62ED62A1A; Sun, 11 Aug 2013 15:43:09 +0000 (UTC) Received: from kanar.ci0.org (pluxor@localhost [127.0.0.1]) by kanar.ci0.org (8.14.5/8.14.5) with ESMTP id r7BFgiYZ092853; Sun, 11 Aug 2013 17:42:44 +0200 (CEST) (envelope-from cognet@ci0.Org) Received: (from doginou@localhost) by kanar.ci0.org (8.14.5/8.14.5/Submit) id r7BFgisa092852; Sun, 11 Aug 2013 17:42:44 +0200 (CEST) (envelope-from cognet@ci0.Org) X-Authentication-Warning: kanar.ci0.org: doginou set sender to cognet@ci0.Org using -f Date: Sun, 11 Aug 2013 17:42:44 +0200 From: Olivier Houchard To: Zbigniew Bodek Subject: Re: svn commit: r254061 - head/sys/arm/arm Message-ID: <20130811154244.GA92775@ci0.org> References: <201308071544.r77FiwMK072982@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="r5Pyd7+fXNt84Ff3" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-all@freebsd.org, "freebsd-arm@freebsd.org" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Aug 2013 15:43:09 -0000 --r5Pyd7+fXNt84Ff3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Aug 10, 2013 at 04:50:36PM +0200, Zbigniew Bodek wrote: > 2013/8/7 Olivier Houchard > > > Author: cognet > > Date: Wed Aug 7 15:44:58 2013 > > New Revision: 254061 > > URL: http://svnweb.freebsd.org/changeset/base/254061 > > > > Log: > > Don't bother trying to work around buffers which are not aligned on a > > cache > > line boundary. It has never been 100% correct, and it can't work on SMP, > > because nothing prevents another core from accessing data from an > > unrelated > > buffer in the same cache line while we invalidated it. Just use bounce > > pages > > instead. > > > > Reviewed by: ian > > Approved by: mux (mentor) (implicit) > > > > Modified: > > head/sys/arm/arm/busdma_machdep-v6.c > > > > > Hello Olivier, > > While continuing rebase of my work to the current HEAD I encountered > another problem regarding the PCIe NIC this time. > > I'm using Realtek card and starting from this revision Rx buffers cannot be > allocated for my device. > Please check out the message below: Hi Zbigniew, Can you test the attached patch (largely untested, I'm afraid I'm on vacations, far away from my arm boards), to see if it helps ? Regards, Olivier --r5Pyd7+fXNt84Ff3 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="busdmap_bz.patch" Index: busdma_machdep-v6.c =================================================================== --- busdma_machdep-v6.c (revision 254221) +++ busdma_machdep-v6.c (working copy) @@ -425,6 +425,8 @@ if (_bus_dma_can_bounce(newtag->lowaddr, newtag->highaddr) || newtag->alignment > 1) newtag->flags |= BUS_DMA_COULD_BOUNCE; + else + maxsize = 2; /* Need at most 2 bounce pages for unaligned acces */ if ((flags & BUS_DMA_ALLOCNOW) != 0) { struct bounce_zone *bz; @@ -519,7 +521,10 @@ * Attempt to add pages to our pool on a per-instance * basis up to a sane limit. */ - maxpages = MAX_BPAGES; + if (dmat->flags & BUS_DMA_COULD_BOUNCE) + maxpages = MAX_BPAGES; + else + maxpages = 2 * bz->map_count; /* Only need at most 2 pages for unaligned access */ if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 || (bz->map_count > 0 && bz->total_bpages < maxpages)) { int pages; --r5Pyd7+fXNt84Ff3--