Message ID | 20200204110906.9377-10-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=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.a=rsa-sha256 header.s=dec2015msa header.b=dDUFICnB; 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 48Bhp221bSzB3tL for <incoming@patchwork.ozlabs.org>; Tue, 4 Feb 2020 22:11:06 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8BDC281ACE; Tue, 4 Feb 2020 12:09:59 +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=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="dDUFICnB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5575781ACC; Tue, 4 Feb 2020 12:09:56 +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=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from conuserg-09.nifty.com (conuserg-09.nifty.com [210.131.2.76]) (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 8A84381AC3 for <u-boot@lists.denx.de>; Tue, 4 Feb 2020 12:09:49 +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-09.nifty.com with ESMTP id 014B9BUP007945; Tue, 4 Feb 2020 20:09:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 014B9BUP007945 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1580814560; bh=NHMH6evA7d95S0+Oa1WAnvmpnnhbstMWh7Ob3N1sMbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dDUFICnBjetHf198XYXowokKHSXXmdU+dMMAoquDHLUUB2DdebRodU36+pyMwsKrK uIcEGbuZ18Wvy7zOcgHEw784yqYbdDhVHI23RTpv3q4Eu2wqTOpytcBd5KGGTOvQ+B LyImDfdGRvGEKrv2UCSvd+wBk3HZgSbGsC204mV3K8w5uSP40yXDIXFiqD/PRZH2Ce CxMlyhgFtv5FO6519FqWlZRn5VMsEjn2gNTUcixU4zUGPWrB/eRijpJHAqH1gbWEa8 hpTLQ0XP5mg0Qqf2hc92fXr7yosbt+T+vONsn6HAvspqgG8/Osa9h/cmxgVSTQzqCA zzGpjZHIzAL6Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada <yamada.masahiro@socionext.com> To: u-boot@lists.denx.de Subject: [PATCH 9/9] mmc: sdhci: fix missing cache invalidation after reading by DMA Date: Tue, 4 Feb 2020 20:09:06 +0900 Message-Id: <20200204110906.9377-10-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200204110906.9377-1-yamada.masahiro@socionext.com> References: <20200204110906.9377-1-yamada.masahiro@socionext.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 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.101.4 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 193f402b516f..f31f6628870f 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> --- drivers/mmc/sdhci.c | 4 ++++ 1 file changed, 4 insertions(+)