diff mbox

[GIT,PULL] dmaengine-fixes-3.15-rc5

Message ID 1400799960.18307.4.camel@dwillia2-mobl2.amr.corp.intel.com (mailing list archive)
State Accepted
Delegated to: Dan Williams
Headers show

Pull-request

git://git.kernel.org/pub/scm/linux/kernel/git/djbw/dmaengine tags/dmaengine-fixes-3.15-rc5

Commit Message

Dan Williams May 22, 2014, 11:06 p.m. UTC
Hi Linus,

These have had some soak time in -next for a few weeks.

Please pull, thank you.

--
Dan


The following changes since commit d6d211db37e75de2ddc3a4f979038c40df7cc79c:

  Linux 3.15-rc5 (2014-05-09 13:10:52 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/djbw/dmaengine tags/dmaengine-fixes-3.15-rc5

for you to fetch changes up to c1f43dd9c20d85e66c4d77e284f64ac114abe3f8:

  dmaengine: fix dmaengine_unmap failure (2014-05-21 14:02:37 -0700)

----------------------------------------------------------------
Two fixes for -stable:

1/ async_mult() sometimes maps less buffers than initially requested.
   We end up freeing dmaengine_unmap_data on an invalid pool.

2/ mv_xor: register write ordering fix

----------------------------------------------------------------
Ezequiel Garcia (1):
      dma: mv_xor: Flush descriptors before activating a channel

Xuelin Shi (1):
      dmaengine: fix dmaengine_unmap failure

 drivers/dma/dmaengine.c   | 2 ++
 drivers/dma/mv_xor.c      | 8 +++-----
 include/linux/dmaengine.h | 1 +
 3 files changed, 6 insertions(+), 5 deletions(-)

Full log:

commit c1f43dd9c20d85e66c4d77e284f64ac114abe3f8
Author: Xuelin Shi <xuelin.shi@freescale.com>
Date:   Wed May 21 14:02:37 2014 -0700

    dmaengine: fix dmaengine_unmap failure
    
    The count which is used to get_unmap_data maybe not the same as the
    count computed in dmaengine_unmap which causes to free data in a
    wrong pool.
    
    This patch fixes this issue by keeping the map count with unmap_data
    structure and use this count to get the pool.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Xuelin Shi <xuelin.shi@freescale.com>
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>



--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index a886713..d5d30ed 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -1009,6 +1009,7 @@  static void dmaengine_unmap(struct kref *kref)
 		dma_unmap_page(dev, unmap->addr[i], unmap->len,
 			       DMA_BIDIRECTIONAL);
 	}
+	cnt = unmap->map_cnt;
 	mempool_free(unmap, __get_unmap_pool(cnt)->pool);
 }
 
@@ -1074,6 +1075,7 @@  dmaengine_get_unmap_data(struct device *dev, int nr, gfp_t flags)
 	memset(unmap, 0, sizeof(*unmap));
 	kref_init(&unmap->kref);
 	unmap->dev = dev;
+	unmap->map_cnt = nr;
 
 	return unmap;
 }
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 8300fb8..72cb0dd 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -429,6 +429,7 @@  typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param);
 typedef void (*dma_async_tx_callback)(void *dma_async_param);
 
 struct dmaengine_unmap_data {
+	u8 map_cnt;
 	u8 to_cnt;
 	u8 from_cnt;
 	u8 bidi_cnt;

commit 5a9a55bf9157d3490b0c8c4c81d4708602c26e07
Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Date:   Wed May 21 14:02:35 2014 -0700

    dma: mv_xor: Flush descriptors before activating a channel
    
    We need to use writel() instead of writel_relaxed() when starting
    a channel, to ensure all the descriptors have been flushed before
    the activation.
    
    While at it, remove the unneeded read-modify-write and make the
    code simpler.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Lior Amsalem <alior@marvell.com>
    Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 766b68e..394cbc5 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -191,12 +191,10 @@  static void mv_set_mode(struct mv_xor_chan *chan,
 
 static void mv_chan_activate(struct mv_xor_chan *chan)
 {
-	u32 activation;
-
 	dev_dbg(mv_chan_to_devp(chan), " activate chan.\n");
-	activation = readl_relaxed(XOR_ACTIVATION(chan));
-	activation |= 0x1;
-	writel_relaxed(activation, XOR_ACTIVATION(chan));
+
+	/* writel ensures all descriptors are flushed before activation */
+	writel(BIT(0), XOR_ACTIVATION(chan));
 }
 
 static char mv_chan_is_busy(struct mv_xor_chan *chan)