Message ID | 20190708015333.20411-23-peng.fan@nxp.com |
---|---|
State | Rejected |
Delegated to: | Stefano Babic |
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=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=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="T+bSuu/R"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45hpH92C2Mz9s3l for <incoming@patchwork.ozlabs.org>; Mon, 8 Jul 2019 11:47:33 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CF609C21EDE; Mon, 8 Jul 2019 01:43:18 +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=SPF_HELO_PASS, T_DKIM_INVALID 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 19223C21E0B; Mon, 8 Jul 2019 01:40:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 336E5C21E0F; Mon, 8 Jul 2019 01:39:39 +0000 (UTC) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80085.outbound.protection.outlook.com [40.107.8.85]) by lists.denx.de (Postfix) with ESMTPS id 93C84C21DA6 for <u-boot@lists.denx.de>; Mon, 8 Jul 2019 01:39:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OX6dpui6DfnxK7rtGcClKPNhMwuGW8C3VsVh5BqTGIM=; b=T+bSuu/R9FfeBlCQeZ+7lPBJ0LMcSqq0fBkhj5udhv3zZkgwTyjzMVkBOAqzHJfWgQY3/9hL336lG3w3c6sxXUV9+JC8h0bCyCljM8tcDamle8CsQvEfROB7IjNDnGxuqJZOiZZIyyD7WN2R6b/ahYidcvrflJivA9uoi35pwP0= Received: from AM0PR04MB4481.eurprd04.prod.outlook.com (52.135.147.15) by AM0PR04MB4018.eurprd04.prod.outlook.com (52.134.90.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.19; Mon, 8 Jul 2019 01:39:34 +0000 Received: from AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::2023:c0e5:8a63:2e47]) by AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::2023:c0e5:8a63:2e47%5]) with mapi id 15.20.2052.020; Mon, 8 Jul 2019 01:39:34 +0000 From: Peng Fan <peng.fan@nxp.com> To: "sbabic@denx.de" <sbabic@denx.de>, "festevam@gmail.com" <festevam@gmail.com> Thread-Topic: [PATCH V2 22/51] imx8m: Fix MMU table issue for OPTEE memory Thread-Index: AQHVNS3+Ktzb4DTjaUyd6U2MML2Yjg== Date: Mon, 8 Jul 2019 01:39:34 +0000 Message-ID: <20190708015333.20411-23-peng.fan@nxp.com> References: <20190708015333.20411-1-peng.fan@nxp.com> In-Reply-To: <20190708015333.20411-1-peng.fan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.16.4 x-clientproxiedby: HK0PR01CA0059.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::23) To AM0PR04MB4481.eurprd04.prod.outlook.com (2603:10a6:208:70::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 38b78505-8719-41e4-a31a-08d70345212a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:AM0PR04MB4018; x-ms-traffictypediagnostic: AM0PR04MB4018: x-microsoft-antispam-prvs: <AM0PR04MB40187D0901A652AB98DBC17088F60@AM0PR04MB4018.eurprd04.prod.outlook.com> x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 00922518D8 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(396003)(136003)(376002)(366004)(346002)(189003)(199004)(3846002)(6116002)(5660300002)(316002)(71190400001)(71200400001)(54906003)(110136005)(1076003)(66066001)(14454004)(478600001)(2906002)(386003)(6436002)(6486002)(256004)(14444005)(53936002)(25786009)(36756003)(44832011)(486006)(6512007)(8936002)(186003)(52116002)(2501003)(66476007)(99286004)(86362001)(4326008)(476003)(446003)(2616005)(11346002)(8676002)(26005)(66556008)(6506007)(7736002)(76176011)(81156014)(81166006)(50226002)(305945005)(68736007)(102836004)(66446008)(73956011)(66946007)(64756008)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4018; H:AM0PR04MB4481.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: /uvLW/FNMW6Omx8fBO/Kpp4aZXr0+B2XLLmYQaEtk+9+42E76yuwZdXoej5fClelTNOZoEVuKzg/dPq1ooRPIDvTjOgIxKyB/qLY90mSMeQU1U+C+J+dU+KQtlk00amn0jZLDophSFB238ZoFX8g4G9uJtM3t59xcVgzFsczNzJgOSUfHaKBkZuSIB+VPEXhenlP7LYD+pcyYU2BGcny5ZMP+csnRlMeKMYYplD9MFDpKQQJKkLgIdeQRPKjt1MtmNjNruG8Hbgpy9sd7rXnt4Sbcnbmvl+nlP9JSJ7kq0+3Z+eoFAMsVGsVKkEelpZAF4uWGQoXsHF4bJiO24F37cuQJcl3sldJSlSicIqSP6DXq+eBIg86+x6uJZyqWi8nan4Shq63P77Ip9JkOJJfSvWXOI2MGdsGLyKtPcqbNYs= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38b78505-8719-41e4-a31a-08d70345212a X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jul 2019 01:39:34.2432 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: peng.fan@nxp.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4018 Cc: "u-boot@lists.denx.de" <u-boot@lists.denx.de>, dl-uboot-imx <uboot-imx@nxp.com> Subject: [U-Boot] [PATCH V2 22/51] imx8m: Fix MMU table issue for OPTEE memory X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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: <http://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> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> |
Series |
Support i.MX8MM/N
|
expand
|
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index 8d40ca0229..5bbc3f4f1d 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -116,16 +116,18 @@ static struct mm_region imx8m_mem_map[] = { /* DRAM1 */ .virt = 0x40000000UL, .phys = 0x40000000UL, - .size = 0xC0000000UL, + .size = PHYS_SDRAM_SIZE, .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE +#ifdef PHYS_SDRAM_2_SIZE }, { /* DRAM2 */ .virt = 0x100000000UL, .phys = 0x100000000UL, - .size = 0x040000000UL, + .size = PHYS_SDRAM_2_SIZE, .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE +#endif }, { /* List terminator */ 0, @@ -134,6 +136,20 @@ static struct mm_region imx8m_mem_map[] = { struct mm_region *mem_map = imx8m_mem_map; +void enable_caches(void) +{ + /* + * If OPTEE runs, remove OPTEE memory from MMU table to + * avoid speculative prefetch. OPTEE runs at the top of + * the first memory bank + */ + if (rom_pointer[1]) + imx8m_mem_map[5].size -= rom_pointer[1]; + + icache_enable(); + dcache_enable(); +} + static u32 get_cpu_variant_type(u32 type) { struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
When running with OPTEE, the MMU table in u-boot does not remove the OPTEE memory from its settings. So ARM speculative prefetch in u-boot may access that OPTEE memory. Due to trust zone is enabled by OPTEE and that memory is set to secure access, then the speculative prefetch will fail and cause various memory issue in u-boot. The fail address register and int_status register in trustzone has logged that speculative access from u-boot. Signed-off-by: Peng Fan <peng.fan@nxp.com> --- arch/arm/mach-imx/imx8m/soc.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)