From patchwork Thu Feb 23 18:02:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frode Isaksen X-Patchwork-Id: 9588755 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7773C60210 for ; Thu, 23 Feb 2017 18:03:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CD5C2877E for ; Thu, 23 Feb 2017 18:03:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61B9C2878B; Thu, 23 Feb 2017 18:03:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B8AD2877E for ; Thu, 23 Feb 2017 18:03:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751282AbdBWSDO (ORCPT ); Thu, 23 Feb 2017 13:03:14 -0500 Received: from mail-wr0-f170.google.com ([209.85.128.170]:32938 "EHLO mail-wr0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751213AbdBWSDO (ORCPT ); Thu, 23 Feb 2017 13:03:14 -0500 Received: by mail-wr0-f170.google.com with SMTP id 97so26678457wrb.0 for ; Thu, 23 Feb 2017 10:03:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4tqqRZZKxw6JLGy6BC63p49tiXRY7L9N9xzmKf9QyWw=; b=rW1UDtzS+GaGWm3wO5SUMSQol9xW3ws/SkmNsdPSZGK4DopYCv77k3qvLDlrRqQSvD W8HkGliJ1316Sm+Hj9BiagnwYH7UNERXDX2OX1H6fXI2hMxFbMYBegxfDs48QS/zReXR lAsfjneP9jIbzC/DFPymlmoLSI0UpatT8/MyjSYUEQGv6L5Kw9xNcBuR14NRHRr53NkJ sgNT2WRklqDU8a2XsYyMroIO6y3ui6gEotL6N9ltEk3BkgxfZjb0wSZtG9d1G6MlSKNH icVSDarJWJr8E4/fEukv8823Xd7P0Cpa413Ewxp+VX46G0dyDmEd7jTMl1zkuu/A3S9i ijGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4tqqRZZKxw6JLGy6BC63p49tiXRY7L9N9xzmKf9QyWw=; b=tCQh74UHQQdYmakfxiKNhhczV3hFjz1hLuLy3kMqX+t16NPI6TWBsUQriS+61KODHr 9Q69BHeDyIHT/rSqiRJw9br443MLJLOyvT5XACU6Yn1mmtzg9Ps1E4a3jTRVbTZYDrg9 LqJz4SlK1vhyFpEAOwBla020yuMSyj8Caw2f+cP60tewd/ML7cwmhlOd6s41PNpkP1cU J4oWQ0+U9UJsvgsqxo6vQIxQdp8NDdXG7jepTPUR2rc5v9dSVs3kpJYHxTas6LjBbZ0g 1DryY9HoL9ijHAI50MMapAyNMtCQ0ek1mmOURJaj1rYRnJnjuN07lp0+fbHszJQfKwuX A5TQ== X-Gm-Message-State: AMke39m7Uu+7RA9jVL2UzlYj7jBKfwmbfz1x6N1kRQhYrlhi1165UkuwLIyYedNSe1VTbLB1 X-Received: by 10.223.171.17 with SMTP id q17mr12919719wrc.179.1487872992586; Thu, 23 Feb 2017 10:03:12 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id z134sm7739182wmc.20.2017.02.23.10.03.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Feb 2017 10:03:12 -0800 (PST) From: Frode Isaksen To: nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, linux-arm-kernel@lists.infradead.org Cc: broonie@kernel.org, linux-spi@vger.kernel.org, Frode Isaksen Subject: [PATCH v3 5/6] spi: davinci: do not use DMA for vmalloc'ed buffers Date: Thu, 23 Feb 2017 19:02:00 +0100 Message-Id: <1487872921-26628-6-git-send-email-fisaksen@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487872921-26628-1-git-send-email-fisaksen@baylibre.com> References: <1487872921-26628-1-git-send-email-fisaksen@baylibre.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Using vmalloc'ed buffers will fail since daVinci has VIVT cache and only the kernel lowmem virtual address is invalidated/flushed when performing DMA. The virtual address returned from vmalloc() is not invalidated/flushed and may contain stale data when returning from spi_sync(). Fixes errors when running UBIFS over SPI NOR. Revert this when all upper layer users of vmalloc'ed buffers sent to SPI handles cache flushing/invalidating. Signed-off-by: Frode Isaksen --- drivers/spi/spi-davinci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 75c658e..f37bbdd 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -482,7 +482,9 @@ static bool davinci_spi_can_dma(struct spi_master *master, if (spicfg) can_dma = (spicfg->io_type == SPI_IO_TYPE_DMA) && - (xfer->len >= DMA_MIN_BYTES); + (xfer->len >= DMA_MIN_BYTES) && + !is_vmalloc_addr(xfer->rx_buf) && + !is_vmalloc_addr(xfer->tx_buf); return can_dma; }