From patchwork Fri Apr 15 20:28:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Franklin Cooper X-Patchwork-Id: 8858261 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C1DE09F1D3 for ; Fri, 15 Apr 2016 20:30:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F273D202A1 for ; Fri, 15 Apr 2016 20:29:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2239B2027D for ; Fri, 15 Apr 2016 20:29:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752466AbcDOU3l (ORCPT ); Fri, 15 Apr 2016 16:29:41 -0400 Received: from mail-ob0-f194.google.com ([209.85.214.194]:35424 "EHLO mail-ob0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752335AbcDOU3Y (ORCPT ); Fri, 15 Apr 2016 16:29:24 -0400 Received: by mail-ob0-f194.google.com with SMTP id 4so7643105obi.2; Fri, 15 Apr 2016 13:29:23 -0700 (PDT) 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=hCaVjrKrS7UXyhGvtHtZcPGsqhUOJvh+4u6MEl4DWus=; b=YlvOQu+nReoPuG/1/XmUaHPLAj2rPoU/8880xVkr6zfC4JWzuqmlhQze0WyH6a6+cs zKOea5h0/0uufekV0NrUTntuHUQRL1shobAx+SQ4Me2YVq0lV3ys1uzGYCDon+oLeqv1 FRgm8ToCEzAgFWZXYLC49Ag4dv1Meprk5Uxum8HAu1fB+ZaDdhYR9yj+5p1Dr/ttIS4k ZthT7rg4V/i5csrb8gPLNRWUnSLCN6zSbuZoN3jusnpGpr2piXqlh+EBcZkCWDSJmtOl Lt3MuZ7RNbGY3h8nd7S1QOkx+fScsqg1s1QCKlhMibBFvUyxwhbfpoAgOC4VhObIZ6TU 3TsQ== X-Gm-Message-State: AOPr4FVHtQZV29VToVAyGgAACeBV0uFnw8vpRZUv5zmjhiOyKoBcbGFfG6J850PZul2Bfg== X-Received: by 10.182.48.37 with SMTP id i5mr1509877obn.55.1460752163099; Fri, 15 Apr 2016 13:29:23 -0700 (PDT) Received: from beast-server.fios-router.home ([173.64.219.161]) by smtp.gmail.com with ESMTPSA id 71sm15279202otj.24.2016.04.15.13.29.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Apr 2016 13:29:22 -0700 (PDT) From: Franklin S Cooper Jr 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" Subject: [PATCH 2/2] mtd: nand: omap2: Fix high memory dma prefetch transfer Date: Fri, 15 Apr 2016 15:28:59 -0500 Message-Id: <1460752139-12742-3-git-send-email-fcooper@ti.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1460752139-12742-1-git-send-email-fcooper@ti.com> References: <1460752139-12742-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=-7.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 From: "Cooper Jr., Franklin" 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 --- 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);