From patchwork Thu Jul 18 12:34:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Matheus Lima X-Patchwork-Id: 1133720 X-Patchwork-Delegate: sbabic@denx.de 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=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="fYLWEqV9"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45qDBR1vp2z9sBt for ; Thu, 18 Jul 2019 22:35:43 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E5114C21C8B; Thu, 18 Jul 2019 12:34: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=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 609AAC21EF1; Thu, 18 Jul 2019 12:34:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1D9D9C22011; Thu, 18 Jul 2019 12:34:29 +0000 (UTC) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50048.outbound.protection.outlook.com [40.107.5.48]) by lists.denx.de (Postfix) with ESMTPS id 06FAAC21F21 for ; Thu, 18 Jul 2019 12:34:25 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OMQde0VBv6jcoHIhZ/GuLL2sDxGC4XSY75LjG2sFLiBl9pT0VFlofrxY9G5PPIbSk3ATIisz0k8thcoZHoK0uvide+uKHWNq35Pz2JnJbjzcO8UGr6vLb/YFNrbStYRTz5EP92XFN2RO+eXrs7N25mgJQc2rSIFp7s3R5eQlYM2CbPpKjHW6RESDAlMxboY3ThS4MYZeSflnVxhVY/xWGK745lOmlVBJmhtfkELPfWZBs9NF1VJVWuQXLXVvgsTv5aZwyAMACCOyzkhUCUdYu6xm1xoVQZsZ2sMxTYe2ep5XdjlsWzHkF2km6/uVY0V4wxb/CMMBTTwNPPdLj+KlCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lWfb9gKRGM5t1W1LRN2YL7oYXNKgoSUb7A6TTlY+Gvs=; b=El5+DInFNdBbe45W+l8kzcM+P24UiirqjNQaeUs+OkXk8Usoxt0qbz1ChT2DKZCA/gfds95zcewSI3Z3N9+pxlapcloKGrrw7Q/I0bvCFTP3VD3Lq6WY6u8OECvxhiMnLOZvy4dUoqCcE87tI/qmVQ1w2yen7v29ShI+K+kkKdjAqew4Z9gnaLoRGsVHoh7utCoeLvwhwecC0STSm8lnSCtzmlWdlyR9WDstydjR9T5BTIGnuy9TS274ifMhi1Hr3t4DDq5WWd0hF1j1nYsA20dHvOuejQZcNqDCamx3QsctDG6IBsuqfu3LNNWLjWMSUR7/LnRw3ZIB3N9Tk5W2LQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com;arc=none 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=lWfb9gKRGM5t1W1LRN2YL7oYXNKgoSUb7A6TTlY+Gvs=; b=fYLWEqV9Gn6xS3n/DJkB2XHMegjR4S3bxwGxbhjiDD1uA2K+WjPrAkUN5N5WgHw7hVjEza8NGuM28Qw5merTpe2Umdh8KuQ2BZ7ek50HhOJUN3U+/wIwQvEgvJfd/rdcP/rZwPFOAqS5xMolEZ0eGYPjPF3+V2hVrGgJh8J1oLc= Received: from DB7PR04MB4636.eurprd04.prod.outlook.com (52.135.134.158) by DB7PR04MB3993.eurprd04.prod.outlook.com (52.134.108.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.12; Thu, 18 Jul 2019 12:34:24 +0000 Received: from DB7PR04MB4636.eurprd04.prod.outlook.com ([fe80::ed41:1ceb:290b:7fa4]) by DB7PR04MB4636.eurprd04.prod.outlook.com ([fe80::ed41:1ceb:290b:7fa4%6]) with mapi id 15.20.2094.011; Thu, 18 Jul 2019 12:34:23 +0000 From: Breno Matheus Lima To: "sbabic@denx.de" , "festevam@gmail.com" Thread-Topic: [PATCH 3/4] imx6: spl: Reduce SPL limit size in case CONFIG_SECURE_BOOT is enabled Thread-Index: AQHVPWUhWULFEQ4JlUGXvvw/fTOhow== Date: Thu, 18 Jul 2019 12:34:23 +0000 Message-ID: <1563453220-248-4-git-send-email-breno.lima@nxp.com> References: <1563453220-248-1-git-send-email-breno.lima@nxp.com> In-Reply-To: <1563453220-248-1-git-send-email-breno.lima@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [82.144.34.2] x-clientproxiedby: LO2P265CA0334.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a4::34) To DB7PR04MB4636.eurprd04.prod.outlook.com (2603:10a6:5:2e::30) authentication-results: spf=none (sender IP is ) smtp.mailfrom=breno.lima@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 570c574b-4c4e-406b-6486-08d70b7c434d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DB7PR04MB3993; x-ms-traffictypediagnostic: DB7PR04MB3993: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 01026E1310 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(136003)(366004)(39860400002)(376002)(346002)(396003)(189003)(199004)(256004)(50226002)(8936002)(26005)(52116002)(68736007)(8676002)(86362001)(186003)(76176011)(14444005)(6506007)(386003)(25786009)(102836004)(478600001)(81156014)(2501003)(81166006)(2616005)(14454004)(7736002)(476003)(305945005)(66066001)(446003)(486006)(11346002)(53936002)(3846002)(2906002)(4326008)(6512007)(316002)(36756003)(6116002)(5660300002)(54906003)(110136005)(66556008)(66946007)(64756008)(66446008)(66476007)(71190400001)(71200400001)(99286004)(6486002)(6436002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR04MB3993; H:DB7PR04MB4636.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: KxHaqv/qLtxNbyKY0Q3sw1RtJyjirrFAjOm0w+rSmgluiYkq93vcbJzYcRRur8TGofcHixwh4WfWUrIonW/bYizAw9ePB/fB+gLuRbsJTEQItmQsI7s/4iwsIR6EobjrQVFjasaJ3hyuDkUwiX9cQCPoQpzbu1sdHy3mRDHYcyScvbw5qStoLhO36LY/zXj1jMpsRJfkZsCwSIJ5qhj5KWBWSTyDNzIqu6JZ41bTuTz3YS1skG2ZzhulpjBnFZJCo4Oo9FpFOL2hW+urbNstW9l1ByKN1KgTao1g2cOxBx0h+4H8H+sYoHgKH2uR87QSKtA7jnk9psMSA+ChKh9IUL7qgkFEhRXg0P2JIX9iUhUDP2KySRTu/IlSdEpYwGR39WAE63RuEFIQvWJ3GLHxmF/JWjJke+3JriOTtpRiJTc= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 570c574b-4c4e-406b-6486-08d70b7c434d X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jul 2019 12:34:23.2908 (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: breno.lima@nxp.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB3993 Cc: "sven.ebenfeld@gmail.com" , Breno Matheus Lima , "u-boot@lists.denx.de" , dl-uboot-imx Subject: [U-Boot] [PATCH 3/4] imx6: spl: Reduce SPL limit size in case CONFIG_SECURE_BOOT is enabled 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" In case CONFIG_SECURE_BOOT is enabled we need to limit the SPL size to avoid a possible HAB failure event: --------- HAB Event 1 ----------------- event data: 0xdb 0x00 0x14 0x42 0x33 0x22 0x33 0x00 0x00 0x00 0x00 0x0f 0x00 0x90 0x70 0x00 0x00 0x01 0x10 0x00 STS = HAB_FAILURE (0x33) RSN = HAB_INV_ADDRESS (0x22) CTX = HAB_CTX_TARGET (0x33) ENG = HAB_ENG_ANY (0x00) As explained in Commit 23612534fe0f ("spl: imx6: Provide a SPL_SIZE_LIMIT default") the i.MX6 SPL size limit is 68KB. The ROM code is copying the image size defined in boot data to its respective load address, in case we exceed the OCRAM free region a HAB invalid address failure event is generated. The maximum CSF size is defined in CONFIG_CSF_SIZE, reduce SPL size limit based on this configuration. Signed-off-by: Breno Lima Reviewed-by: Fabio Estevam --- tools/spl_size_limit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/spl_size_limit.c b/tools/spl_size_limit.c index 98ff491867..8902e30129 100644 --- a/tools/spl_size_limit.c +++ b/tools/spl_size_limit.c @@ -14,6 +14,9 @@ int main(int argc, char *argv[]) #ifdef CONFIG_SPL_SIZE_LIMIT spl_size_limit = CONFIG_SPL_SIZE_LIMIT; +#if defined(CONFIG_SECURE_BOOT) && defined(CONFIG_CSF_SIZE) + spl_size_limit -= CONFIG_CSF_SIZE; +#endif #ifdef CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD spl_size_limit -= GENERATED_GBL_DATA_SIZE; #endif