From patchwork Thu Oct 15 17:37:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Franklin Cooper X-Patchwork-Id: 7408661 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 099C9BEEA4 for ; Thu, 15 Oct 2015 17:38:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 27D78206B8 for ; Thu, 15 Oct 2015 17:38:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D540206AF for ; Thu, 15 Oct 2015 17:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752896AbbJORih (ORCPT ); Thu, 15 Oct 2015 13:38:37 -0400 Received: from mail-ob0-f169.google.com ([209.85.214.169]:34675 "EHLO mail-ob0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752290AbbJORhk (ORCPT ); Thu, 15 Oct 2015 13:37:40 -0400 Received: by obbda8 with SMTP id da8so71292387obb.1; Thu, 15 Oct 2015 10:37:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eRS7aTsLXHQ85q0urPqkqYP/iDg/cCS7uK7c3bZDsVM=; b=XvT7O3JiUMdNntGyYfuQF0WCDgCIOYXeY4w9flR3wY12Ej66YZwe9tLU32yFqTUDih jS3eXkrH00fz9KswKmSB6lNKdFko8kAXbfs4FbvZAP6qPdb4yUHFC5bHfkWm0pGp7E1f ZzJSTO9f3dpuH2qvitDPyj0x1GhdSgktRiVMgbD/FHTH1dgHNiYQtrxD21/OD0W3hWXV PbxivftSJSJDCs7ZawNgqWzDQQiAkm8/xYGu0CsEpBy18oK2O3erqhtInLagpPbZzaQP bB+BTTA4oD1iSVU4UYGzoiNtAM/ii90KvjswAzpolYz1Ptqe2haKrKXz/eYVyS5qLsCs CD0A== X-Received: by 10.60.43.105 with SMTP id v9mr6506245oel.6.1444930659866; Thu, 15 Oct 2015 10:37:39 -0700 (PDT) Received: from localhost.localdomain (pool-71-97-41-79.dllstx.fios.verizon.net. [71.97.41.79]) by smtp.gmail.com with ESMTPSA id l133sm6771574oia.19.2015.10.15.10.37.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Oct 2015 10:37:39 -0700 (PDT) From: Franklin S Cooper Jr To: linux-kernel@vger.kernel.org, rogerq@ti.com, devicetree@vger.kernel.org, linux-omap@vger.kernel.org, linux-mtd@lists.infradead.org, nsekhar@ti.com, computersforpeace@gmail.com, dwmw2@infradead.org, tony@atomide.com Cc: Franklin S Cooper Jr Subject: [PATCH v2 3/5] mtd: nand: omap2: Fix high memory dma prefetch transfer Date: Thu, 15 Oct 2015 12:37:26 -0500 Message-Id: <1444930648-19313-4-git-send-email-fcooper@ti.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1444930648-19313-1-git-send-email-fcooper@ti.com> References: <1444930648-19313-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, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 --- V2 Changes: None 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 1f58420..0d2cbb0 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -479,17 +479,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); @@ -546,6 +537,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; }