From patchwork Thu Jan 26 16:46:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Vadot X-Patchwork-Id: 720300 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3v8SdD19lYz9t8j for ; Fri, 27 Jan 2017 03:52:15 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=bidouilliste.com header.i=@bidouilliste.com header.b="CaI97mnk"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B2AC64AACE; Thu, 26 Jan 2017 17:52:10 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RVLBrmTBgjPp; Thu, 26 Jan 2017 17:52:10 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 07D014A07B; Thu, 26 Jan 2017 17:52:10 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A38C84A07B for ; Thu, 26 Jan 2017 17:51:33 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6JDdBQozNW1O for ; Thu, 26 Jan 2017 17:51:33 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by theia.denx.de (Postfix) with ESMTPS id 5F21F4A06E for ; Thu, 26 Jan 2017 17:51:29 +0100 (CET) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 0be4c1db for ; Thu, 26 Jan 2017 17:51:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=from :to:cc:subject:date:message-id:in-reply-to:references; s=mail; bh=rw+7pW3v6Xi8U+iiDCUqykXP+24=; b=CaI97mnkGXzQslfH1AkzI/+ShNPm PnIFz+wTxoPCTseyQFoS3df1EUmxyPvKpbQhIBoIrKrUVeABH2Tj6z29CKzsQsi1 ywcZQ13pwCSSM3lsKhEn8SvM4ND4zbwkUDW0LKvCR5oWGofw6Fu728OjAnzr1yai hSh9+xNxjMLMaak= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=from:to :cc:subject:date:message-id:in-reply-to:references; q=dns; s= mail; b=m/AD6F8z/seQyGPLijZfQoDnlnMGC3IvL4e5o0LeN/S0JIWQz9tEwfTC JbEmG0xsBC+ruZKhygVgCOphVrverhbmTruzZL1FkoOEUUcViuuRDYZijbd/fg+6 RBh55aRfA6giaktw4PSMdy1dAge1vY5iyJp0Y7ajQlLFcXRJo/M= Received: from knuckles.blih.net (ip-54.net-82-216-203.roubaix.rev.numericable.fr [82.216.203.54]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 5df0ef3b TLS version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO for ; Thu, 26 Jan 2017 17:51:19 +0100 (CET) Received: from elbarto (uid 1001) (envelope-from manu@bidouilliste.com) id 767cd by knuckles.blih.net (DragonFly Mail Agent v0.11); Thu, 26 Jan 2017 17:46:17 +0100 From: Emmanuel Vadot To: sjg@chromium.org, yamada.masahiro@socionext.com, michal.simek@xilinx.com, sr@denx.de, dannenberg@ti.com, rpjday@crashcourse.ca, ravibabu@ti.com, hdegoede@redhat.com, stefan.agner@toradex.com, sgalabov@gmail.com, bmeng.cn@gmail.com, imp@freebsd.org, hs@denx.de, p.marczak@samsung.com, jagan@amarulasolutions.com, grinberg@compulab.co.il, siva.durga.paladugu@xilinx.com, van.freenix@gmail.com, lokeshvutla@ti.com, agraf@suse.de, swarren@nvidia.com, afaerber@suse.de Date: Thu, 26 Jan 2017 17:46:11 +0100 Message-Id: <20170126164612.86684-4-manu@bidouilliste.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170126164612.86684-1-manu@bidouilliste.com> References: <20170126164612.86684-1-manu@bidouilliste.com> X-Mailman-Approved-At: Thu, 26 Jan 2017 17:52:08 +0100 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 3/4] api: FreeBSD: flush cache before starting X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 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" From: Warner Losh FreeBSD loader(8) just loaded code to some random location that may contain stale icache entries. FreeBSD Kernel needs the icache and dcache flushed. Before running either one of them, flush the icache and dcache. Signed-off-by: Emmanuel Vadot Reviewed-by: Tom Rini --- api/api.c | 5 +++++ cmd/boot.c | 4 ++++ cmd/elf.c | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/api/api.c b/api/api.c index c368511704..88b5df77c0 100644 --- a/api/api.c +++ b/api/api.c @@ -290,6 +290,11 @@ static int API_dev_close(va_list ap) if (!err) di->state = DEV_STA_CLOSED; + if (dcache_status()) + flush_dcache_all(); + if (icache_status()) + invalidate_icache_all(); + return err; } diff --git a/cmd/boot.c b/cmd/boot.c index 72f2cf362d..b66ae67fcb 100644 --- a/cmd/boot.c +++ b/cmd/boot.c @@ -19,6 +19,10 @@ __attribute__((weak)) unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc, char * const argv[]) { + if (dcache_status()) + flush_dcache_all(); + if (icache_status()) + invalidate_icache_all(); return entry (argc, argv); } diff --git a/cmd/elf.c b/cmd/elf.c index e4c6535111..e98a798203 100644 --- a/cmd/elf.c +++ b/cmd/elf.c @@ -109,6 +109,11 @@ static unsigned long do_bootelf_exec(ulong (*entry)(int, char * const[]), { unsigned long ret; + if (dcache_status()) + flush_dcache_all(); + if (icache_status()) + invalidate_icache_all(); + /* * pass address parameter as argv[0] (aka command name), * and all remaining args