Message ID | 20200214054144.18315-12-yamada.masahiro@socionext.com |
---|---|
State | Superseded |
Delegated to: | Peng Fan |
Headers | show
Return-Path: <u-boot-bounces@lists.denx.de> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.a=rsa-sha256 header.s=dec2015msa header.b=yiOh1i3A; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Jj3R2jZXz9sRN for <incoming@patchwork.ozlabs.org>; Fri, 14 Feb 2020 16:43:31 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1E4FB81274; Fri, 14 Feb 2020 06:42:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="yiOh1i3A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9B9B981286; Fri, 14 Feb 2020 06:42:33 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from conuserg-11.nifty.com (conuserg-11.nifty.com [210.131.2.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 838C581274 for <u-boot@lists.denx.de>; Fri, 14 Feb 2020 06:42:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=yamada.masahiro@socionext.com Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id 01E5fpBg001312; Fri, 14 Feb 2020 14:41:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 01E5fpBg001312 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1581658917; bh=v6xEc63syL09BMgcAj0CepVR1mjiM5VZfgoyj6hWNRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yiOh1i3AU7awlvrRpVabf8/QBbfMViokk1OIcUScjAuduDExJngPhSG3TkyjH9nfK 9VuZkd+G6mbcbDuTLWo07bWLQWGqdPrUEudurk1DlPABmtNlRiDfHD1leYJVMuyh4D c3fJa0Zp53gMHAZmxj3Z//1WUXN+CD1X4HzNE+PMyxdTd9hoLwA/iZ9prsbI6bqxyf fu+NB13Nwg5i/pRAJGSMV45jv2lGEU/VLpHAIbuT6jgZZzWJeIiPshkq+mDbrIlP5O Po5E4hYmgeEuc74sF5ZTowEvndmEcPBKiFdokMLlACkFi+6FA/4340KtJkXY8v9ZLl X7B1wmx8PRcJQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada <yamada.masahiro@socionext.com> To: u-boot@lists.denx.de Cc: Peng Fan <peng.fan@nxp.com>, Masahiro Yamada <yamada.masahiro@socionext.com> Subject: [PATCH v2 11/11] mmc: sdhci: fix missing cache invalidation after reading by DMA Date: Fri, 14 Feb 2020 14:41:44 +0900 Message-Id: <20200214054144.18315-12-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200214054144.18315-1-yamada.masahiro@socionext.com> References: <20200214054144.18315-1-yamada.masahiro@socionext.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.102.1 at phobos.denx.de X-Virus-Status: Clean |
Series |
mmc: sdhci: code clean-up and fix cache coherency problem
|
expand
|
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 77a88bc043e4..9b7c5f8f684f 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -215,6 +215,10 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data) return -ETIMEDOUT; } } while (!(stat & SDHCI_INT_DATA_END)); + + dma_unmap_single(host->start_addr, data->blocks * data->blocksize, + mmc_get_dma_dir(data)); + return 0; }
This driver currently performs cache operation before the DMA start, but does nothing after the DMA completion. When reading data by DMA, the cache invalidation is needed also after finishing the DMA transfer. Otherwise, the CPU might read data from the cache instead of from the main memory when speculative memory read or memory prefetch occurs. Instead of calling the cache operation directly, this commit adds dma_unmap_single(), which performs cache invalidation internally, but drivers do not need which operation is being run. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- Changes in v2: None drivers/mmc/sdhci.c | 4 ++++ 1 file changed, 4 insertions(+)