From patchwork Thu Mar 10 04:07:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Franklin Cooper X-Patchwork-Id: 8553701 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 C86E8C0553 for ; Thu, 10 Mar 2016 04:08:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E60FB202EB for ; Thu, 10 Mar 2016 04:08:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0DE37202DD for ; Thu, 10 Mar 2016 04:08:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965378AbcCJEH7 (ORCPT ); Wed, 9 Mar 2016 23:07:59 -0500 Received: from mail-oi0-f68.google.com ([209.85.218.68]:34547 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965351AbcCJEH5 (ORCPT ); Wed, 9 Mar 2016 23:07:57 -0500 Received: by mail-oi0-f68.google.com with SMTP id m82so4056466oif.1; Wed, 09 Mar 2016 20:07:56 -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=IgruVL8wZ9LSjDjwsGgllXEQ0RNaFZ9cq5mK3fO1yxM=; b=jKcDJxCfojtVU2PABRMm0dYnesvIARX8F1wmSShYCK9fO7Xw6ecPvb0b9HnynG3y3k GGs0P6efUb8+H20Ox9lyx6AXTVA6xWkB9Ym38ZpaMzFqmUXP7qU1wrVrpgQkVslLzFBi 7LKKye1TPWsZVCTtP5mX670//4T493I802NnRhr9sHwUktb+TxOEROz+ZGmoc8oAxZLt CO5SonaGZw1WwOe+l1ow1qb2cuDbdRVzR7gSx9/hIR26Gd2VPd2QlWHCmvhHPK/EaSF4 zTNZChD1Hx8bQk1ptbICuzuMRw9hwYwvH/5XhHTMQKyMIPNPKy95XdjTthSlRh38BAUo d5eQ== X-Gm-Message-State: AD7BkJLFdvP9OPjmDiR9sAD1VxZqFc3WN7uuYOyUV9nXaz1b6EyR3ndRpvoyE0N7M25bxg== X-Received: by 10.202.227.12 with SMTP id a12mr765705oih.49.1457582876312; Wed, 09 Mar 2016 20:07:56 -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 u8sm1043390obf.5.2016.03.09.20.07.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Mar 2016 20:07:55 -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 v3 5/6] mtd: nand: omap2: Fix high memory dma prefetch transfer Date: Wed, 9 Mar 2016 22:07:40 -0600 Message-Id: <1457582861-20619-6-git-send-email-fcooper@ti.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457582861-20619-1-git-send-email-fcooper@ti.com> References: <1457582861-20619-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 f7110d1..a174376 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; }