From patchwork Mon Apr 30 08:34:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Vadot X-Patchwork-Id: 906567 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=freebsd.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40ZJ961y3Rz9s06 for ; Mon, 30 Apr 2018 18:48:26 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CED56C21F3D; Mon, 30 Apr 2018 08:46:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4FCC4C21E36; Mon, 30 Apr 2018 08:39:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 77FD3C21F92; Mon, 30 Apr 2018 08:34:50 +0000 (UTC) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by lists.denx.de (Postfix) with ESMTPS id 0F8FAC21F4E for ; Mon, 30 Apr 2018 08:34:46 +0000 (UTC) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 9dd58c77 for ; Mon, 30 Apr 2018 10:34:45 +0200 (CEST) Received: from wopr.blih.net (62-210-199-19.rev.poneytelecom.eu [62.210.199.19]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 0fea6cbf TLS version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO for ; Mon, 30 Apr 2018 10:34:38 +0200 (CEST) Received: from elbarto (uid 1001) (envelope-from manu@bidouilliste.com) id 7c9ae by wopr.blih.net (DragonFly Mail Agent v0.11); Mon, 30 Apr 2018 10:34:37 +0200 From: Emmanuel Vadot To: sjg@chromium.org, bmeng.cn@gmail.com, andriy.shevchenko@linux.intel.com, rick@andestech.com, philipp.tomsich@theobroma-systems.com, albert.u.boot@aribaud.net, xypron.glpk@gmx.de Date: Mon, 30 Apr 2018 10:34:36 +0200 Message-Id: <20180430083436.72659-1-manu@freebsd.org> X-Mailer: git-send-email 2.16.3 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 4/5] cmd: go: Flush cache before starting X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Some application might load some code at location that contain stale cache entries. Before running a elf or raw binary, flush the caches if they are enabled. Signed-off-by: Emmanuel Vadot --- cmd/boot.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/boot.c b/cmd/boot.c index 72f2cf362d..0b3979f6a5 100644 --- a/cmd/boot.c +++ b/cmd/boot.c @@ -19,6 +19,16 @@ __attribute__((weak)) unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc, char * const argv[]) { +#if defined(CONFIG_SYS_HAVE_DCACHE_MAINTENANCE) && \ + !defined(CONFIG_SYS_DCACHE_OFF) + if (dcache_status()) + flush_dcache_all(); +#endif +#if defined(CONFIG_SYS_HAVE_ICACHE_MAINTENANCE) && \ + !defined(CONFIG_SYS_ICACHE_OFF) + if (icache_status()) + invalidate_icache_all(); +#endif return entry (argc, argv); }