From patchwork Thu May 22 23:06:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 4226881 X-Patchwork-Delegate: dan.j.williams@gmail.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6B4CEBF90B for ; Thu, 22 May 2014 23:06:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 89102201CE for ; Thu, 22 May 2014 23:06:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5846A201C8 for ; Thu, 22 May 2014 23:06:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752216AbaEVXGC (ORCPT ); Thu, 22 May 2014 19:06:02 -0400 Received: from mga01.intel.com ([192.55.52.88]:53068 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751472AbaEVXGA (ORCPT ); Thu, 22 May 2014 19:06:00 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 22 May 2014 16:06:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,890,1392192000"; d="scan'208";a="543621991" Received: from fmdmzpr01.fm.intel.com (HELO [10.255.12.166]) ([10.1.194.65]) by fmsmga002.fm.intel.com with ESMTP; 22 May 2014 16:05:59 -0700 Message-ID: <1400799960.18307.4.camel@dwillia2-mobl2.amr.corp.intel.com> Subject: [GIT PULL] dmaengine-fixes-3.15-rc5 From: Dan Williams To: "torvalds@linux-foundation.org" Cc: "dmaengine@vger.kernel.org" , Vinod Koul Date: Thu, 22 May 2014 16:06:00 -0700 X-Mailer: Evolution 3.8.5 (3.8.5-2.fc19) Mime-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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: Signed-off-by: Xuelin Shi Signed-off-by: Dan Williams -- 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 --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 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: Signed-off-by: Lior Amsalem Signed-off-by: Ezequiel Garcia Signed-off-by: Dan Williams 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)