From patchwork Fri Oct 23 02:13:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 534707 X-Patchwork-Delegate: sbabic@denx.de 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 EB094141311 for ; Fri, 23 Oct 2015 13:13:37 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 97653A74FE; Fri, 23 Oct 2015 04:13:36 +0200 (CEST) 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 RDwgso8FFoh2; Fri, 23 Oct 2015 04:13:36 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E9536A7519; Fri, 23 Oct 2015 04:13:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C9C87A74FE for ; Fri, 23 Oct 2015 04:13:31 +0200 (CEST) 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 XN3WXcmrpMYT for ; Fri, 23 Oct 2015 04:13:31 +0200 (CEST) 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 na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0148.outbound.protection.outlook.com [157.56.111.148]) by theia.denx.de (Postfix) with ESMTPS id 1E8A5A74CB for ; Fri, 23 Oct 2015 04:13:28 +0200 (CEST) Received: from BLUPR03CA012.namprd03.prod.outlook.com (10.255.124.29) by CY1PR03MB1471.namprd03.prod.outlook.com (10.163.17.156) with Microsoft SMTP Server (TLS) id 15.1.306.13; Fri, 23 Oct 2015 02:13:26 +0000 Received: from BN1BFFO11FD008.protection.gbl (10.255.124.4) by BLUPR03CA012.outlook.office365.com (10.255.124.29) with Microsoft SMTP Server (TLS) id 15.1.306.13 via Frontend Transport; Fri, 23 Oct 2015 02:13:25 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; denx.de; dkim=none (message not signed) header.d=none; denx.de; dmarc=none action=none header.from=freescale.com; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD008.mail.protection.outlook.com (10.58.144.71) with Microsoft SMTP Server (TLS) id 15.1.306.13 via Frontend Transport; Fri, 23 Oct 2015 02:13:25 +0000 Received: from linux-jyl1.ap.freescale.net ([10.193.99.116]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t9N2D7gp022999; Thu, 22 Oct 2015 19:13:21 -0700 From: Peng Fan To: Date: Fri, 23 Oct 2015 10:13:03 +0800 Message-ID: <1445566385-15129-1-git-send-email-Peng.Fan@freescale.com> X-Mailer: git-send-email 1.8.4 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD008; 1:sflsyKRATUdUpFRvcpRHUim1kcRN6FMt6wPb6WMB0KRHVuZAfO2XSKiP1tBYNDNwEiWWEkqzjwcLQ4PelzvA9kraK4gGTjlmk2a4efPivlXagKjMxzn3+pWHogzzZwc/1ku7nCe9VIQM8B/ludAAgPnErL8UAMWLJsnBnHBTxgkmfvI+W46rg3MxnVhjrll58uPvfYjeb0syH3FkSKBELcv5pL9D0K558ECsNpKIILxeyKxwOTw8Iihv6y4DHI2wW9FajpDibRR5R9xjKqrvriKKGfBcjSGNSCnpbSYxzQSx05dtVC1p1F5t23bGQkQi+ZAm+TBlftt5kAuz4+fA+WJ1UXpxTEXei2P7fIPuTRrZlwRrus05UQNr+HKYHUm0yLCD4FTJ/+au3f0elwgXMg== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(85426001)(2351001)(86362001)(229853001)(50226001)(106466001)(5008740100001)(87936001)(92566002)(105606002)(5003940100001)(5007970100001)(5001920100001)(11100500001)(15975445007)(77096005)(81156007)(48376002)(47776003)(50466002)(97736004)(50986999)(36756003)(189998001)(5001960100002)(6806005)(19580395003)(104016004)(19580405001)(110136002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR03MB1471; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1471; 2:tZ0h+I26sr2ul27/eORcJjTZVmtuL16dVetiY2o9IaeV4k9DoUfo4JCp8zxrzwSmxAXk10VWwP5DCJP0a/HE+h4O27RB/cBTh8Isb0tlnbZoix6fwMwrb66Fl1i32+I1+Vta6FHsZAq9RLUlzD4wpefL93hKXBa/LHVFfbi5eJg=; 3:8pLaY2FA6ckVITABhJMUouV4qf9sXYWKc7q5BSIOpKB/BnF33QcsvxxtRAzIiZD7kiVXhRlZ/dRo5UJ7+PMyeYdb3r6R/cYqPutNFULIOGAnRpd+sfMiBO4zS/MuYB2+n4FE9zV3JsNLzetb+6ovrsy9LFoxKf0tf60L/tcp6O3ImYLZcjgMj8n6unxvnBpbfMDd8cF1lPU2GWSUaW2K/ZtBCRR/6DSEMYk3aXh1S94=; 25:LEiCZfSutpI/2p5/9NPJeR5syFR3mzxHAm1QH3P1D6/JAJUTtRWwXLjASRcfZMNejzW/pgrFHsYfkuX9ZPf48yf6XrBMXDKYEQBKT2Ul9pMY+TfRa0sRaJW4yl2pDL1OzwHzqPfPrfjJevMxD9lRBrADAHwfH98jueVSxWAim21e8wycPqOQ5kFObcdvw1RyAC+MYPSqtz23G8q2HhT844X2hwG32mZkHx27X/CqlAcSUw3GZtHjrBI1MB1gxwWuUt+cVvtj9WW+lAKsoOdF4Q== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1471; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1471; 20:yUbW19TqAyhtqtJdPW3FP8OMLAM6l3jDnYDaeTIPrVIXWrlXuMInXkJS9IWizVlHgprBbxN/4ou04+wFw6v+cO3T5oDaJ/4UygmDeezfexna2oIFwbSMug1YT8oD+yfYLPJTd2qBdsTMGsqn1j0Emy7t4W2FwDP3NZN6FrBCQq+46OJqnNYEwNHAppoChep0XbOsUmtu1nrHF2USo3EMCPTjc1auTKersz1ug1LSpQSW+i+idUDJMcJ6zmlXhLVrCqx0oPVEA6GiNNOWF9PZHVbVFvn5DXlqrum9uXOqRVZ0LflnbbPRYOs0yMW5KU5G1Dn76mf1/mTaByemgSNTBEbVtkOmhNq/G8kxEIl3JPA=; 4:o8DG9GpYslF0+1YbCstMxsyBSJC4Tawm2sBmdsA0PsJkISnRFZo3iha2PIKbIXbRtJZw5PwSXL89KnSv2CQ8n1Q4OjCpDiO413OIc4rhQQALGrW7wNZbbcAW5FD0NkkQgnGmKovbj8LyIERodqJXq7MfgpXup5b5yj/j4XjzxG/AkpNAKRHuhL5Tg0RaO8ZHdS6+INytYheCN6zOT5x99lRrr+OghqElxoUab/FWx/17yK94TjHWfCfHWX6VbZEX0QjyBHfKgJ9d7kdGcBkM1EX9PitxLoCdJGSZ59z9OZD77gKgBO/pkWQcZyrMj/an/A5iIOfLaxojUYr4pT9IBm7Hyn0eX50qWdSJW3lSKgGK0rX9ilQcJc4NkU8jrcy4 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(126837547833334)(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001)(102215026); SRVR:CY1PR03MB1471; BCL:0; PCL:0; RULEID:; SRVR:CY1PR03MB1471; X-Forefront-PRVS: 0738AF4208 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB1471; 23:D32ifH1T8iK+NhO4iWax2RN8VFP/EGadGn7pO8Car?= =?us-ascii?Q?7o8Xyxr4wLZTBnxUPzqA9ICA8h/DpTFCpLID/C8LzC16+AdwwFKbaaeRlX/q?= =?us-ascii?Q?8H1tyL3yDVTdHvn5ZSDmMHjAqzSc6k1jIisZHCRqMTAaCobJBgNrlHNmlDv0?= =?us-ascii?Q?ErVDe+Ux8ggcLOgeFpw7mCNFCoKZgE43jkJ5480/ScqcEIqEHeuFs09He3E9?= =?us-ascii?Q?j/euxz1DzgCewwtTkCnP19ALWkiV1zGUEc5OM9ddvyfPHgWxSrkdKiXJn4H1?= =?us-ascii?Q?K5xRSjjNgyt9cqmsQG1c+QJEVvQ97MYfMfpAGi9aYbtMaft4Ylfwx9MBn4is?= =?us-ascii?Q?/UOtddHXD5X+0Mv3m/d6xajeGOfenswRrfPDAZ06feP/qBz9QI4qe4BfUmiR?= =?us-ascii?Q?Zu1lpXutxciF6FU/OABCUdowNxr8d6vr2R0dTc/GaUfGxB7qxuOpHZWnwCH6?= =?us-ascii?Q?1YH8FAaGUMg9s7NLsEArCDTP//gY0Hr1buXnaG2jgNIv/m2o4oq37uRd4Uz1?= =?us-ascii?Q?v1K/nw/fUL/RWUGQEe8HHUB4bz4TrLG0S9ztFYhqY3o+PQ9aQr6CXQx0YLjE?= =?us-ascii?Q?+hikWFQ7lEiOOU1+I3zg83D9IB2jF/bbXLPYvMWvN9o06Ys7AWOvARm4MEsX?= =?us-ascii?Q?rC4dnDBqnkvF3dz2Fi0ND0tUkEL4Vy+WH6ql3oNhwNATzG8nhZedzykGshHh?= =?us-ascii?Q?9Y/qbF6oqo9zkQQUe6mkU1BHRgwVrZ9wypQ9/XBNZo/lmNCTCozGHUHmgDvd?= =?us-ascii?Q?czf5fyZyurLBvCZHw1dGqcGNZNhUk4/A2bFp+5S6g19DCtRjpU1+Ey/cMQPz?= =?us-ascii?Q?v3JTVQMpxmYSmOD9OWKBfjygdsAnELxUzm0E3GnnFlWpvuQiU8lL9/YkI1JX?= =?us-ascii?Q?uIZsgCo99RB62rB1Xazq2kGdFPVYOpp+C0TTyz+t00pBWC7cQzNHt+WId+0+?= =?us-ascii?Q?PyUc9eroN7OF2TnoagUVxg89D5BxjRiMCyqJ+F1jzaVxOUYALNZ7POpEEtxl?= =?us-ascii?Q?ytz2POCAyff2zX3dlDf3ZrP4F0UTYmutlmfX3MqP3ioqw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1471; 5:wTlROo7bBfxnGF+cVwZyiTSYzyaEM+RoIwSpx5Bx9lL3+jXKWoxZIqXOw0K9/oqd/rAvzsSXxnu3YG2qwXasioMjsdfvB+H5AyxrqOldShwHmw1gIbBA/F/jqMyq7SPukm/g63TjxXwiTe9KaVH4QQ==; 24:elFVoaMHtjVv6xLIIfIfrNRDzdvMYiKcasMMwkjklapdaRuI5jAQgDqXVBfDkm9igbcUAtj+NJCQ9Ddlb/wclzylNuWTTZpr+Gw0tx3wDDw=; 20:EurxEOLNeZCJmbswYr+avyDiKeYZ57M9hgH6UsE/HrnFuS07cy2lmD0a97STJVSocg/RLYhKZVxJGjqUpPMNkw== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2015 02:13:25.1046 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB1471 Cc: Tom Rini , Jan Kiszka , Tom Warren , Ian Campbell , York Sun Subject: [U-Boot] [PATCH V4 1/3] arm: discard relocation entries for secure text 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The code such as PSCI in section named secure is bundled with u-boot image, and when bootm, the code will be copied to their runtime address same to compliation/linking address - CONFIG_ARMV7_SECURE_BASE. When compile the PSCI code and link it into the u-boot image, there will be relocation entries in .rel.dyn section for PSCI. Actually, we do not needs these relocation entries. If still keep the relocation entries in .rel.dyn section, r0 at line 103 and 106 in arch/arm/lib/relocate.S may be an invalid address which may not support read/write for one SoC. 102 /* relative fix: increase location by offset */ 103 add r0, r0, r4 104 ldr r1, [r0] 105 add r1, r1, r4 106 str r1, [r0] So discard them to avoid touching the relocation entry in arch/arm/lib/relocate.S. Signed-off-by: Peng Fan Cc: Tom Warren Cc: York Sun Cc: Hans De Goede Cc: Ian Campbell Cc: Albert Aribaud Cc: Tom Rini Cc: Jan Kiszka Cc: Stefano Babic Acked-by: Albert ARIBAUD --- Changes v4: none V2 thread: http://lists.denx.de/pipermail/u-boot/2015-October/230755.html Changes v3: Move the relocation entries to the very begining and discard them. V1 thread: http://lists.denx.de/pipermail/u-boot/2015-October/229426.html Changes V2: Refine commit msg. Discard the relocation entry section for secure text. arch/arm/cpu/u-boot.lds | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index 03cd9f6..d48a905 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -14,6 +14,23 @@ OUTPUT_ARCH(arm) ENTRY(_start) SECTIONS { + /* + * Discard the relocation entries for secure text. + * The secure code is bundled with u-boot image, so there will + * be relocations entries for the secure code, since we use + * "-mword-relocations" to compile and "-pie" to link into the + * final image. We do not need the relocation entries for secure + * code, because secure code will not be relocated, it only needs + * to be copied from loading address to CONFIG_ARMV7_SECURE_BASE, + * which is the linking and running address for secure code. + * If keep the relocation entries in .rel.dyn section, + * "relocation offset + linking address" may locates into an + * address that is reserved by SoC, then will trigger data abort. + * + * The reason that move .rel._secure at the beginning, is to + * avoid hole in the final image. + */ + /DISCARD/ : { *(.rel._secure*) } . = 0x00000000; . = ALIGN(4);