From patchwork Thu Mar 10 23:56:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Franklin Cooper X-Patchwork-Id: 8560731 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6C385C0553 for ; Thu, 10 Mar 2016 23:57:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36AA920381 for ; Thu, 10 Mar 2016 23:57:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B6FA20376 for ; Thu, 10 Mar 2016 23:57:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933278AbcCJX5A (ORCPT ); Thu, 10 Mar 2016 18:57:00 -0500 Received: from mail-ob0-f196.google.com ([209.85.214.196]:34231 "EHLO mail-ob0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933246AbcCJX44 (ORCPT ); Thu, 10 Mar 2016 18:56:56 -0500 Received: by mail-ob0-f196.google.com with SMTP id wz1so7587700obc.1; Thu, 10 Mar 2016 15:56:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DOspyrtcT1+JVVPO6JkoCyKY+aZuh6W7vs9JHsyJTKM=; b=E575mHL9oqe80H8Pbi5w3EJBXcTMInEqxEabolUX4xvR6BQ9BpeJ/KJ3DLBuPERnCz rJ8utaIc8yzNDEtWaXem6prCjlR8mlRRYMJjdq772dZrji99ETTf0vjkFUIM27w3usbU Vazou/UbcfFVJ54TCTuzJQB8WkHUgCu7WgHIWzu2MqAK2ywji5yc6sCjrCQV5avBGJLi Edki9wOvPkcuHTtTCevJeivGszks0izwVg+eof9D1Lx+VmNtp81BXxSkZAoGoSEhlOmt sHRPrHeVi2wJ/uU6sIZMK1+du9uRslVxzrM47cGNp9jvWBE8ZjRucBNptJGfUstQ8Nnt Jykg== X-Gm-Message-State: AD7BkJKCE9h1X3VgjHP7ye7KQPlZSkZreJ1QH65G8/yAOWrh47QZcjGl0ig2xd9ZWI8POw== X-Received: by 10.182.230.40 with SMTP id sv8mr3839175obc.22.1457654215224; Thu, 10 Mar 2016 15:56:55 -0800 (PST) Received: from beast-server.fios-router.home (pool-173-57-21-86.dllstx.fios.verizon.net. [173.57.21.86]) by smtp.gmail.com with ESMTPSA id d1sm2907073oby.16.2016.03.10.15.56.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Mar 2016 15:56:54 -0800 (PST) From: Franklin S Cooper Jr To: nsekhar@ti.com, dwmw2@infradead.org, computersforpeace@gmail.com, rogerq@ti.com, tony@atomide.com, devicetree@vger.kernel.org, linux-omap@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Franklin S Cooper Jr Subject: [PATCH v4 6/7] mtd: nand: omap2: Fix high memory dma prefetch transfer Date: Thu, 10 Mar 2016 17:56:42 -0600 Message-Id: <1457654203-20856-7-git-send-email-fcooper@ti.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457654203-20856-1-git-send-email-fcooper@ti.com> References: <1457654203-20856-1-git-send-email-fcooper@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 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 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. The amount of high memory buffers used are very uncommon so no noticeable performance hit should be seen. Signed-off-by: Franklin S Cooper Jr --- drivers/mtd/nand/omap2.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 0863a83..22b0112 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 (addr >= high_memory) + goto out_copy; sg_init_one(&sg, addr, len); n = dma_map_sg(info->dma->device->dev, &sg, 1, dir); @@ -534,6 +525,7 @@ out_copy: else is_write == 0 ? omap_read_buf8(mtd, (u_char *) addr, len) : omap_write_buf8(mtd, (u_char *) addr, len); + return 0; }