Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Aug 2013 17:42:44 +0200
From:      Olivier Houchard <cognet@ci0.Org>
To:        Zbigniew Bodek <zbb@semihalf.com>
Cc:        svn-src-all@freebsd.org, "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   Re: svn commit: r254061 - head/sys/arm/arm
Message-ID:  <20130811154244.GA92775@ci0.org>
In-Reply-To: <CAG7dG%2BzmvQ0BcnnOfeQaLv9q7BEKEWLhJeXm1Q6yL2djH3fwZA@mail.gmail.com>
References:  <201308071544.r77FiwMK072982@svn.freebsd.org> <CAG7dG%2BzmvQ0BcnnOfeQaLv9q7BEKEWLhJeXm1Q6yL2djH3fwZA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <cognet@freebsd.org>
> 
> > 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130811154244.GA92775>