mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Franklin S Cooper Jr <fcooper@ti.com>
To: boris.brezillon@free-electrons.com, dwmw2@infradead.org,
	computersforpeace@gmail.com, tony@atomide.com, rogerq@ti.com,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org
Cc: "Cooper Jr., Franklin" <fcooper@ti.com>
Subject: [PATCH 2/2] mtd: nand: omap2: Fix high memory dma prefetch transfer
Date: Fri, 15 Apr 2016 15:28:59 -0500	[thread overview]
Message-ID: <1460752139-12742-3-git-send-email-fcooper@ti.com> (raw)
In-Reply-To: <1460752139-12742-1-git-send-email-fcooper@ti.com>

From: "Cooper Jr., Franklin" <fcooper@ti.com>

Based on DMA documentation and testing using high memory buffer when doing
dma transfers can lead to various issues including kernel panics.

To workaround this simply use cpu copy.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
---
 drivers/mtd/nand/omap2.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 762e0ed..8d0ae3a 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -467,17 +467,8 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr,
 	int ret;
 	u32 val;
 
-	if (addr >= high_memory) {
-		struct page *p1;
-
-		if (((size_t)addr & PAGE_MASK) !=
-			((size_t)(addr + len - 1) & PAGE_MASK))
-			goto out_copy;
-		p1 = vmalloc_to_page(addr);
-		if (!p1)
-			goto out_copy;
-		addr = page_address(p1) + ((size_t)addr & ~PAGE_MASK);
-	}
+	if (!virt_addr_valid(addr))
+		goto out_copy;
 
 	sg_init_one(&sg, addr, len);
 	n = dma_map_sg(info->dma->device->dev, &sg, 1, dir);
-- 
2.7.0

  parent reply	other threads:[~2016-04-15 20:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15 20:28 [PATCH 0/2] mtd: nand: omap2: Fix SDMA support for NAND DMA prefetch Franklin S Cooper Jr
2016-04-15 20:28 ` [PATCH 1/2] mtd: nand: omap2: Start dma request before enabling prefetch Franklin S Cooper Jr
2016-04-15 20:28 ` Franklin S Cooper Jr [this message]
2016-04-22  9:12 ` [PATCH 0/2] mtd: nand: omap2: Fix SDMA support for NAND DMA prefetch Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460752139-12742-3-git-send-email-fcooper@ti.com \
    --to=fcooper@ti.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rogerq@ti.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®