From patchwork Tue Oct 30 12:55:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990826 X-Patchwork-Delegate: uboot@andestech.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=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksKP5vztz9s2P for ; Wed, 31 Oct 2018 00:10:48 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 4E3BCC22108; Tue, 30 Oct 2018 13:03:14 +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=RCVD_IN_DNSWL_BLOCKED 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 1FCA0C2215D; Tue, 30 Oct 2018 12:58:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 66FE6C22132; Tue, 30 Oct 2018 12:57:23 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 1A2ABC22105 for ; Tue, 30 Oct 2018 12:57:20 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2H0AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBZYIFgg2MbaZgDYRsAoMlIjgWAQMBAQIBAQICAmkohTwGJ1IQUVcGDgWDIYIBAal6M4omCQGHN4QmgVg/gRABiF2FDgKKZ5QpBwKBDoEEBI5mCxiJOocOlyaBWiKBVTMaJIM7giYXjhtuAYt3AQE X-IPAS-Result: A2H0AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBZYIFgg2MbaZgDYRsAoMlIjgWAQMBAQIBAQICAmkohTwGJ1IQUVcGDgWDIYIBAal6M4omCQGHN4QmgVg/gRABiF2FDgKKZ5QpBwKBDoEEBI5mCxiJOocOlyaBWiKBVTMaJIM7giYXjhtuAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904642" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:20 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0C5AgCMVNhb/xBhWMBkHAEBAQQBAQcEAQGBZYNYOoxtpmANhGwCg0Y4FgEDAQECAQECbSiFOwYnUhBRVwYOBYMhggKpezOKJgkBhzeFfj+BEAGIXYUOAopnlCkHAoEOgQQEjmYLGIk6hw6XJoFaIYFVMxokgzuCJheOGz4wAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525672" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:19 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:18 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:39 +0100 Message-ID: <20181030125553.5230-17-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--0.136300-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Alexander Graf , Greentime Hu Subject: [U-Boot] [PATCH v2 16/29] riscv: invalidate the instruction cache before jumping to Linux 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" RISC-V does not guarantee that stores to instruction memory are visible to instruction fetches (i.e. incoherent instruction caches). Invalidate the instruction cache to ensure the kernel function pointer points to the correct memory location. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng --- Changes in v2: - Clarify reasoning behind patch in commit message arch/riscv/lib/bootm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index 2b5ccce933..c1cf618806 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -40,6 +40,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) return 1; kernel = (void (*)(ulong, void *))images->ep; + invalidate_icache_all(); bootstage_mark(BOOTSTAGE_ID_RUN_OS);