From patchwork Mon Nov 5 18:44:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10668915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A977B1709 for ; Mon, 5 Nov 2018 18:45:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95F63295E2 for ; Mon, 5 Nov 2018 18:45:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A33429973; Mon, 5 Nov 2018 18:45:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 26E7B295E2 for ; Mon, 5 Nov 2018 18:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nlSsbdTLNqcC4MZ27QuWpgFKOjdQntK1dlmos2GU+L0=; b=rxroHCveDgivvU vc/QzOg0fFFnjAdpqRVOIT39Io3wmMnjRcbfuThcrdgpPa1c5PtVtMfmpISHNc1/zTRzm7kDZi4V5 Wku18p+TNlq/J2uOUEE079fIJJV7y09QRILwEd3wd1Vg+nEyW6Kt1u1KdOjaNcWwFB8Gl3AkVJUVv jkTNIUCG4Mk8T6Y0Wb8EJp2Zs8u8EegES2GH3TEg9zOK9qHn9AkY21eZ3zqYV3a/Irn4moOZ/u3JP 8csWYfad3jN7i/7y/mZ3ETWjpQ7hhNctjj0SdUM/M6aCYLytQe0FTHMuof84ekbv+YZT6o5+vWwL0 YqN6J980n6/pYBDPha1A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjsE-0003JO-6O; Mon, 05 Nov 2018 18:45:18 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjs2-0001uB-CI for linux-arm-kernel@lists.infradead.org; Mon, 05 Nov 2018 18:45:08 +0000 Received: by mail-wr1-x443.google.com with SMTP id 74-v6so10670251wrb.13 for ; Mon, 05 Nov 2018 10:44:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IpWvbXdcdrM8X9iK+uhwxv0ZJoRb9Mwa9uub3GYMOFY=; b=Mi426MLo9p0TncrToFHcsMt2qrduEGY5v9tvo3CmGnLa7bdJoul9/dzj8ek/+3A/1m HK37JSpb9KPmyzdPr5JSphpQIY74unN71rWLtfSNVhnx7HaiwIN367u/pLI1wMNPk3wJ GDamGhp0LAgrcmmOOslaagupN5fpH6S5+bufU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IpWvbXdcdrM8X9iK+uhwxv0ZJoRb9Mwa9uub3GYMOFY=; b=paa16T1Q9x5NhbnidZ6Wp3PN9lJHTa6RX30/7UiPQIWWq8vfZcUKo1aho1q342hS08 e9dCt3hqK543C0ePO4bE13aUTqFB4qdXOYAa+aUVWH8FXEj0hW/W13YedKIFFV4+h/F9 ZFomwtSU5IMqDg1Ag9urArnJzcFLYLGjD1JpAXj910apBWvota63W/6mhi8R9NndpFQE toWxOVYnLUaLfU/Bu8lwjZK85SIrGnbg4C7FAzai09kWJxEw2IN6Elh2HhlT9ukv/2+g xhrsBkRNAAe17TUtXgYYWMWzuRzhZG/udPGGI8NyyPH5ctBfP+EM9G+Lfg4X5ygpGVE0 lCTA== X-Gm-Message-State: AGRZ1gImhh2GhA+4bqEBY/OGrTPLGyPbGS+p8bZ9P5eWZwood6ZSpOBZ t0r/1gm1KHEdngBFvdUTxv0fp9piX5Y= X-Google-Smtp-Source: AJdET5frD3sMesnsEtneERUnMdLic+9nnvG2wRmyn/38s+V9iKvAE8ZYx4RN2kqAIx/G7vw+Acg2nw== X-Received: by 2002:a5d:46ce:: with SMTP id g14-v6mr20144283wrs.263.1541443493196; Mon, 05 Nov 2018 10:44:53 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:3117:2b29:5ef7:a9e5]) by smtp.gmail.com with ESMTPSA id y21-v6sm19329761wma.36.2018.11.05.10.44.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 10:44:52 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/6] ARM: compressed: move sharpsl startup code into subroutine Date: Mon, 5 Nov 2018 19:44:33 +0100 Message-Id: <20181105184438.19494-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181105184438.19494-1-ard.biesheuvel@linaro.org> References: <20181105184438.19494-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181105_104506_516341_97274EBD X-CRM114-Status: GOOD ( 13.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nicolas.pitre@linaro.org, linux@armlinux.org.uk, Ard Biesheuvel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of relying on unspecified linker behavior, move the SharpSL startup code into a subroutine and call it from the location we expect the linker to put the code. Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/head-sharpsl.S | 24 ++++++++++---------- arch/arm/boot/compressed/head.S | 3 +++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/arch/arm/boot/compressed/head-sharpsl.S b/arch/arm/boot/compressed/head-sharpsl.S index 992e784500fa..f4e6ad318376 100644 --- a/arch/arm/boot/compressed/head-sharpsl.S +++ b/arch/arm/boot/compressed/head-sharpsl.S @@ -20,9 +20,10 @@ #error What am I doing here... #endif - .section ".start", "ax" + .text -__SharpSL_start: +ENTRY(__SharpSL_start) + mov ip, lr @ preserve lr /* Check for TC6393 - if found we have a Tosa */ ldr r7, .TOSAID @@ -30,7 +31,7 @@ __SharpSL_start: mov r6, #0x03 ldrh r3, [r1, #8] @ Load TC6393XB Revison: This is 0x0003 cmp r6, r3 - beq .SHARPEND @ Success -> tosa + moveq pc, ip @ Success -> tosa /* Check for pxa270 - if found, branch */ mrc p15, 0, r4, c0, c0 @ Get Processor ID @@ -55,30 +56,30 @@ __SharpSL_start: ldr r3, .W100ID ldr r7, .POODLEID cmp r6, r3 - bne .SHARPEND @ We have no w100 - Poodle + movne pc, ip @ We have no w100 - Poodle /* Check for pxa250 - if found we have a Corgi */ ldr r7, .CORGIID ldr r3, .PXA255ID cmp r4, r3 - blo .SHARPEND @ We have a PXA250 - Corgi + movlo pc, ip @ We have a PXA250 - Corgi /* Check for 64MiB flash - if found we have a Shepherd */ bl get_flash_ids ldr r7, .SHEPHERDID cmp r3, #0x76 @ 64MiB flash - beq .SHARPEND @ We have Shepherd + moveq pc, ip @ We have Shepherd /* Must be a Husky */ ldr r7, .HUSKYID @ Must be Husky - b .SHARPEND + mov pc, ip @ return .PXA270: /* Check for 16MiB flash - if found we have Spitz */ bl get_flash_ids ldr r7, .SPITZID cmp r3, #0x73 @ 16MiB flash - beq .SHARPEND @ We have Spitz + moveq pc, ip @ We have Spitz /* Check for a second SCOOP chip - if found we have Borzoi */ ldr r1, .SCOOP2ADDR @@ -87,11 +88,12 @@ __SharpSL_start: strh r6, [r1] ldrh r6, [r1] cmp r6, #0x0140 - beq .SHARPEND @ We have Borzoi + moveq pc, ip @ We have Borzoi /* Must be Akita */ ldr r7, .AKITAID - b .SHARPEND @ We have Borzoi + mov pc, ip @ We have Borzoi +ENDPROC(__SharpSL_start) .PXA255ID: .word 0x69052d00 @ PXA255 Processor ID @@ -147,5 +149,3 @@ get_flash_ids: ldrb r2, [r1, #20] @ NAND Manufacturer ID ldrb r3, [r1, #20] @ NAND Chip ID mov pc, lr - -.SHARPEND: diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 6c7ccb428c07..5067f287fa5a 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -213,6 +213,9 @@ not_angel: */ .text +#ifdef CONFIG_PXA_SHARPSL_DETECT_MACH_ID + bl __SharpSL_start +#endif #ifdef CONFIG_AUTO_ZRELADDR /* From patchwork Mon Nov 5 18:44:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10668925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 648E61709 for ; Mon, 5 Nov 2018 18:46:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 553D6295E2 for ; Mon, 5 Nov 2018 18:46:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 494DE29976; Mon, 5 Nov 2018 18:46:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E9A01295E2 for ; Mon, 5 Nov 2018 18:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8Ot/7X6BZh1gIbYkXPDISEknkurA5uVZ55KSYr17TG8=; b=t4pACfrsuCFQLu LLyuUkpAVrUtgNT3tDm1JeYGP+01cRMrNG/N0jT8dRpDxtd2vfZ36l6kW+mpgxnGpxNkqp2i2Lwys 0apqPhHAFlYZFh2+HLt+vxOw6nviruat1wkvvA4JXXxIQey3BZGLU5JRkP0pk2QZCyj2pTd5mZGkS VOS0tRrJfR4Hm3tJLNiqbyGyLTCF/qhEYkv36CeIDG3C/UdjU6mZtCdO1wo+QD1w+fcL7ajkunr8R MXqwN5xDeijb4VeQhzvea3QU3nsAHScnYLowvKV+0rBZ5JswGi4pkrK8Tg9C5SHZwmtiPu45tlw0G mT+n9V3hR4P4oi1Yi75g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjsz-0004Mp-Fn; Mon, 05 Nov 2018 18:46:05 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjs4-0001uV-Hk for linux-arm-kernel@lists.infradead.org; Mon, 05 Nov 2018 18:45:13 +0000 Received: by mail-wr1-x444.google.com with SMTP id i17-v6so10683759wre.7 for ; Mon, 05 Nov 2018 10:44:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ng0pTj3s6z1mmU5r9dmpBe9Kz+JLJ5SPM+CBRaGljR8=; b=IfXIxgQgtRcYTvdOpEMKL7UFSdOgc9PnkwlXj1KqTHbsKKkIGFpgDlvruVwGjubQJN RNVN+KvXJj9GSecoyNQKeRdguDTCY9KTXxY8XPqzrKbl49Gy07tZ6aXwDZ2cgxSWxDY8 6Bm9u5Hh4bdJEauRr6nKM9fIAYDQaE2TjkhSw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ng0pTj3s6z1mmU5r9dmpBe9Kz+JLJ5SPM+CBRaGljR8=; b=RYpnHYgAlJs3rniA+kFJT8QMufjqgS6TSoWtSq0amYdDURKlR3dwb2g9Ijqf0eJ+2W SR/dAmHY/rAMq2SQi+b77Kvq3DNEmbWCyQrh4FA98YcPwic7qJkJ8P34mqdW33+MI25y 40XxyXAJM4EmbkFp3q2ayFYrIzhyTxyNY1ww4D2dON6RgVO7+tQL0CCECAsNAQCKL5o2 0fpiLQxQkjShixshSffZMWZKC+D3dg+LfDz8VSJsKUD5/vXY7fFBBLj9ULNDVWbzGk0n FXr8BbF81Uy8fv/g6/r7Tg4W0kuLyGTKHYxI7XQwVLVv2DRPOkEw/ElSJnDi21PZtqXp SdQQ== X-Gm-Message-State: AGRZ1gJ0NjmbqBcSAlGNYeGS20CstzSk/YAQ+N2vH6kOF6lVNJB9McGm F4dFrh9Wgp9bIIqYzgkADP0fdXP+7Kk= X-Google-Smtp-Source: AJdET5dLjiY6rd1mgkOv5LhSOovj1JA+SwJ181iD4Cn9orMVbmyNXtnPwm6WHVmjsn6+/wOGXc9Usw== X-Received: by 2002:adf:f748:: with SMTP id z8-v6mr11896362wrp.237.1541443494638; Mon, 05 Nov 2018 10:44:54 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:3117:2b29:5ef7:a9e5]) by smtp.gmail.com with ESMTPSA id y21-v6sm19329761wma.36.2018.11.05.10.44.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 10:44:53 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/6] ARM: compressed: move sa1100 startup code into subroutine Date: Mon, 5 Nov 2018 19:44:34 +0100 Message-Id: <20181105184438.19494-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181105184438.19494-1-ard.biesheuvel@linaro.org> References: <20181105184438.19494-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181105_104508_704319_81F26651 X-CRM114-Status: GOOD ( 12.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nicolas.pitre@linaro.org, linux@armlinux.org.uk, Ard Biesheuvel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of relying on unspecified linker behavior, move the SA1100 startup code into a subroutine and call it from the location we expect the linker to put the code. Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/head-sa1100.S | 9 +++++---- arch/arm/boot/compressed/head.S | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/compressed/head-sa1100.S b/arch/arm/boot/compressed/head-sa1100.S index 95abdd850fe3..89a7e9dfd5c0 100644 --- a/arch/arm/boot/compressed/head-sa1100.S +++ b/arch/arm/boot/compressed/head-sa1100.S @@ -4,18 +4,17 @@ * * Copyright (C) 1999 Nicolas Pitre * - * SA1100 specific tweaks. This is merged into head.S by the linker. + * SA1100 specific tweaks. * */ #include #include - .section ".start", "ax" + .text .arch armv4 -__SA1100_start: - +ENTRY(__SA1100_start) @ Preserve r8/r7 i.e. kernel entry values #ifdef CONFIG_SA1100_COLLIE mov r7, #MACH_TYPE_COLLIE @@ -47,3 +46,5 @@ __SA1100_start: bic r0, r0, #0x1000 @ clear Icache mcr p15, 0, r0, c1, c0, 0 99: + mov pc, lr +ENDPROC(__SA1100_start) diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 5067f287fa5a..c5355f929cee 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -216,6 +216,9 @@ not_angel: #ifdef CONFIG_PXA_SHARPSL_DETECT_MACH_ID bl __SharpSL_start #endif +#ifdef CONFIG_ARCH_SA1100 + bl __SA1100_start +#endif #ifdef CONFIG_AUTO_ZRELADDR /* From patchwork Mon Nov 5 18:44:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10668919 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9DF81709 for ; Mon, 5 Nov 2018 18:45:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 991DD295E2 for ; Mon, 5 Nov 2018 18:45:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D89329973; Mon, 5 Nov 2018 18:45:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3FE34295E2 for ; Mon, 5 Nov 2018 18:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RCz57gFobXAi0Pevp4l4Hx0yYk1/vTBh+ixncepLXyY=; b=LWXv5VQnWAjFI4 db74aQ8mBNSfa4xZfJyVWFUGh/aTXRMTyGF8m8i6H/KMgWTBtLMpEhwwjgZ3liq6rx7ji1TKwEUtZ vWftvv/nmmHAhsMhKAaucYyQ4zqL8zpzz1RudFWgVibFg+Dmsf2WlrrGnXSxC7HaATOYtEeYujCEe f9hBA8N6wcwZDcI02tw/JRUIDLdarkf+LCWO+5n1JFbucAlaWDE2P49R+G2YERWjwy6C3RbcnTuj9 QuRkc/s+EQXf//QorGMVbCd9t7GwiuVCtWlompAOeTPumefiaeHpdIa1xAluoXt7Tp0dWMWaro727 j+xi+kJoyowBMUi/EusQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjsO-0003YN-6l; Mon, 05 Nov 2018 18:45:28 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjs4-0001uZ-Hc for linux-arm-kernel@lists.infradead.org; Mon, 05 Nov 2018 18:45:10 +0000 Received: by mail-wr1-x444.google.com with SMTP id j17-v6so5548372wrq.11 for ; Mon, 05 Nov 2018 10:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zSc4Z+cUenUAMqLndKl90IevD7cykKhwFHq9EcH5sUg=; b=Rbc+zcvzlJMQitQmtkc5cCn5TtPpe15RuTeVop4CVVx0KEkyEzEQKOVibjV9htUz/U Zm69Bnapf5hA/diNceT7QKotASTg1gGjBQKutkyagiKrDwPvUkupi91LatMB9agzFotq vt+r0kVm21QgZ13f6Jlm2waBkZ/c1MWEv4emE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zSc4Z+cUenUAMqLndKl90IevD7cykKhwFHq9EcH5sUg=; b=fBXh3BD2CMGQlNySItc+253+9YeMwBokY4K2uF1lgVR3gvFStxF500mH+2Vg/C53ac X8CgFXAdLs3ZWtJd25w36ht+G5WfTtPtA3i74sx225blhi+HDLciZNZeMfRCWGK6xgO/ sIqF/9xkV/MZfLxwk6XHruxehamjlQfRFGbm64ab2XjeVZJMApbaTT+8xo890rpUxMhb 0AzlArDLPVjLnNn5ZSiUDllMCx8oaqoGJEF0uU2l3OUHgqjSnGW7yEncRK4/Hkw86RO6 2bg8k8hqZa9fWllpRNMdzj9qyGnRb68yefTf4cVimB3MbY8EzCO0N8BXFyXQeqGcnx55 TwZw== X-Gm-Message-State: AGRZ1gI4/x3mpM/EOL5pOQpRplvMDO1uPR8pP+LmfxoiIH6hPVvoNaEC Y0k1RSUCv84NKniJBDyLc+2HHYabedo= X-Google-Smtp-Source: AJdET5eKuItDH1h9OKMbZ1/ZEPixnCWuA+u4dxaOeBB7aAsByP9Atsge8UHMFrR2r7v6TVIVSoIYIw== X-Received: by 2002:a5d:4ec4:: with SMTP id s4-v6mr13746803wrv.32.1541443496012; Mon, 05 Nov 2018 10:44:56 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:3117:2b29:5ef7:a9e5]) by smtp.gmail.com with ESMTPSA id y21-v6sm19329761wma.36.2018.11.05.10.44.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 10:44:54 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/6] ARM: compressed: move xscale startup code into subroutine Date: Mon, 5 Nov 2018 19:44:35 +0100 Message-Id: <20181105184438.19494-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181105184438.19494-1-ard.biesheuvel@linaro.org> References: <20181105184438.19494-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181105_104508_692106_85BEBBEC X-CRM114-Status: GOOD ( 11.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nicolas.pitre@linaro.org, linux@armlinux.org.uk, Ard Biesheuvel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of relying on unspecified linker behavior, move the XScale startup code into a subroutine and call it from the location we expect the linker to put the code. Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/head-xscale.S | 7 ++++--- arch/arm/boot/compressed/head.S | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/compressed/head-xscale.S b/arch/arm/boot/compressed/head-xscale.S index 20fa44d59f82..89e14a55ec3d 100644 --- a/arch/arm/boot/compressed/head-xscale.S +++ b/arch/arm/boot/compressed/head-xscale.S @@ -8,10 +8,9 @@ #include - .section ".start", "ax" - -__XScale_start: + .text +ENTRY(__XScale_start) @ Preserve r8/r7 i.e. kernel entry values @ Data cache might be active. @@ -33,3 +32,5 @@ __XScale_start: bic r0, r0, #0x1000 @ clear Icache mcr p15, 0, r0, c1, c0, 0 + mov pc, lr +ENDPROC(__XScale_start) diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index c5355f929cee..da93f419d1f4 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -219,6 +219,9 @@ not_angel: #ifdef CONFIG_ARCH_SA1100 bl __SA1100_start #endif +#ifdef CONFIG_CPU_XSCALE + bl __XScale_start +#endif #ifdef CONFIG_AUTO_ZRELADDR /* From patchwork Mon Nov 5 18:44:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10668927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D61A17D4 for ; Mon, 5 Nov 2018 18:46:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CCAE295E2 for ; Mon, 5 Nov 2018 18:46:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7016429976; Mon, 5 Nov 2018 18:46:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 128BF295E2 for ; Mon, 5 Nov 2018 18:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QAfkliqxL1907TZvm+0cxybo3MRlM2OmFdCSGOGYIxY=; b=hmp9MX7+RDWjyy 6V5vvAZj6WRG5H5ekbTr4vW11cNLZYgHM/2OKe2Q4iW87NP3gLU6zY8Q4uDFeKWfyb/jZ3CU46rqy dP5WM4gPgah9TI1rY6KBXA8QSyv6xejuM9nw+aLzu0drJ/Vdxx9Yr6vP+gjyQASearjt0iPU1enAs jbq2nx0PFqXWu44eioeUHj2OYcZ+cCQwKuQnv2cW1LoaNvlSx72KxFMw+PTkayV1Ff52rvXcqxKPH UmNSNiNaxQAT1SR7oKBN+mjNp5A0qplV/QTPSe8GfGJbhebJm2ujsP0vNl4tWq0b1Ctd7jVU4w30A CdqC+++XWW+trC0VuqUQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjtB-0004dy-M7; Mon, 05 Nov 2018 18:46:17 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjs4-0001ua-IQ for linux-arm-kernel@lists.infradead.org; Mon, 05 Nov 2018 18:45:12 +0000 Received: by mail-wr1-x444.google.com with SMTP id x12-v6so10675882wrw.8 for ; Mon, 05 Nov 2018 10:44:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PYg30jRIAGhKV63GvYOKs0JdVcasVaM+u6SZsv8/Py4=; b=GwpjsoHdkJl1G4HsdIS7JwO+HOL4jxDvLarijFdrES29umN9cOEdVuoHO1g4BS61mR nHUjGf72cG8BsILVxmOr3V25OwBPNBUN/0IqjtJI+vE7swR+BpJS6nx7aA7nt0w8gmwj bzutoSNzTDlIZTlfoWqnwMYAvPTz4/lFfP6J4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PYg30jRIAGhKV63GvYOKs0JdVcasVaM+u6SZsv8/Py4=; b=NF+fLJ6DkEP/ErtOgd+gTIOOvd/90BCScUtAjFMU0IX3reCG2/HfKmVR92gM6CyG37 uLbwAHt31ih/6+kG5ehEbjModwQYfqEjFk51WSAOn3jOpY7clXjUGLN9PGXqz541ZISA 5B/iGhp0QqO9TqHY0H301K6a5OESjwcNJnhNuJAshQ2U0zO1VN2mH0r+OSz7GF72pqZW GHGjoJy3blvy5LnujZxnaIoU9HYpLM+TvqO0VOx/TdRDqpvJXbrxfIPhlQllCgc8VDfQ S9dw4uJN2sOLpCZYuZccheIbClLj7QNRXaNEetrYUqOdvpXlUT5LLkxkidQNlyGfOAAH r+kw== X-Gm-Message-State: AGRZ1gKbCO5UpEufS/qIpqk7C3lRuGzRgiLHFiIyoADWJPZi32AmmrYJ JYED8+jKWm4gr9KO2Wxr8CiDnj0dTNI= X-Google-Smtp-Source: AJdET5eLsaxyn/ylvkDR0xUuGgvx+oVEtqJ+PIAu1u/7oExF+zLbdi59VliolV5O+zHLKuJre7cntA== X-Received: by 2002:a5d:5544:: with SMTP id g4-v6mr19994048wrw.222.1541443497679; Mon, 05 Nov 2018 10:44:57 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:3117:2b29:5ef7:a9e5]) by smtp.gmail.com with ESMTPSA id y21-v6sm19329761wma.36.2018.11.05.10.44.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 10:44:56 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/6] ARM: compressed: move BE32 handling into head.S Date: Mon, 5 Nov 2018 19:44:36 +0100 Message-Id: <20181105184438.19494-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181105184438.19494-1-ard.biesheuvel@linaro.org> References: <20181105184438.19494-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181105_104508_697438_BB8CD6FB X-CRM114-Status: GOOD ( 13.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nicolas.pitre@linaro.org, linux@armlinux.org.uk, Ard Biesheuvel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The BE switch only takes 3 instructions, and is currently pulled into the main startup code by the linker, which is not the nicest way to do this. Let's just pull the code into head.S and enable it using preprocessor conditionals. Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/Makefile | 8 -------- arch/arm/boot/compressed/big-endian.S | 14 -------------- arch/arm/boot/compressed/head.S | 5 +++++ 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 01bf2585a0fa..d1862621556f 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -47,14 +47,6 @@ ifeq ($(CONFIG_PXA_SHARPSL_DETECT_MACH_ID),y) OBJS += head-sharpsl.o endif -ifeq ($(CONFIG_CPU_ENDIAN_BE32),y) -ifeq ($(CONFIG_CPU_CP15),y) -OBJS += big-endian.o -else -# The endian should be set by h/w design. -endif -endif - # # We now have a PIC decompressor implementation. Decompressors running # from RAM should not define ZTEXTADDR. Decompressors running directly diff --git a/arch/arm/boot/compressed/big-endian.S b/arch/arm/boot/compressed/big-endian.S deleted file mode 100644 index 88e2a88d324b..000000000000 --- a/arch/arm/boot/compressed/big-endian.S +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/arch/arm/boot/compressed/big-endian.S - * - * Switch CPU into big endian mode. - * Author: Nicolas Pitre - */ - - .section ".start", #alloc, #execinstr - - mrc p15, 0, r0, c1, c0, 0 @ read control reg - orr r0, r0, #(1 << 7) @ enable big endian mode - mcr p15, 0, r0, c1, c0, 0 @ write control reg - diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index da93f419d1f4..55c227077207 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -222,6 +222,11 @@ not_angel: #ifdef CONFIG_CPU_XSCALE bl __XScale_start #endif +#if defined(CONFIG_CPU_ENDIAN_BE32) && defined(CONFIG_CPU_CP15) + mrc p15, 0, r0, c1, c0, 0 @ read control reg + orr r0, r0, #(1 << 7) @ enable big endian mode + mcr p15, 0, r0, c1, c0, 0 @ write control reg +#endif #ifdef CONFIG_AUTO_ZRELADDR /* From patchwork Mon Nov 5 18:44:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10668921 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3F6817D4 for ; Mon, 5 Nov 2018 18:45:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 912A529973 for ; Mon, 5 Nov 2018 18:45:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82B25295E2; Mon, 5 Nov 2018 18:45:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1A6F9295E2 for ; Mon, 5 Nov 2018 18:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kj04jH6NRe/I9701ytcGsXbKPu4WV5gxm2ugXTJVqyU=; b=S+jJ+E3eOWO9Rk S4kz6Y8sv7z95+FAsQe8X3UD1VEuFVOu22yRePcHvjUK21jLaMeMpyXpuDoxGlBrcWiZHjrnWDQq8 eoxRsN8LC366cWbHL7f810YVd4HLk/o3DVPlEutDpUJIeWRx3rThlIrd9viLUGVrEejWtRjuCD7JL Q35zQIcXg3K3cRw24m1CNDKoUfUL/AlZrRq8gzVAohl2Wl84A+3NJB1rTdvcpQipMwHfEMu7JEuL4 /2WjnYQMwOskvX9WCBxlX/Sfwuqy1G9bYlLbqmkq5VVHvUp4BN0CPGRFaNH8ZLPkBDvEs/wbp1B6m Nux7xptFTUhLi1W9ZByQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjsb-0003rQ-Ht; Mon, 05 Nov 2018 18:45:41 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjs4-0001ub-HU for linux-arm-kernel@lists.infradead.org; Mon, 05 Nov 2018 18:45:10 +0000 Received: by mail-wr1-x444.google.com with SMTP id j26-v6so10709022wre.1 for ; Mon, 05 Nov 2018 10:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9y8+g96hCUUZ6vKnBMo6NYhR9zdxtsgrLZRQMdgKz9w=; b=N/J+IS+OqjqYsH7xyTMDiE5kYmGolSL3zVnTquXR43uvDF5suKtbxoUSNryzZ/enUh GJbDVkjoVpl7bpQs4qTGMg4P6A5782exF1Vd3YXlXxVoqt4ncAiseDkRWBiRLUEkAUDJ 0GbeRMcnN7Nt6drNVMfeZuc5oetyUnES0nDNo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9y8+g96hCUUZ6vKnBMo6NYhR9zdxtsgrLZRQMdgKz9w=; b=grw2HTo+uZzMLKUY1QQpak4EkFcL75imO67DQqeiKVtefETGArVi+yqSoFhIBFUpLB XOWs3NKN4pxGLCSvG0GmNMVE8q2ry4J+SLdvt43EMQKyr+//87hc71d6pTzVGHT5321b ShBjgPjK2qRIsAoutt+Xxh74BZZRFnMtrUu8lII2dx0FFJ70EdWJ/6kFdXZGRei7Lhbe WBrEj/aPJ9ENvozVYIj5B6siLK3iQJSOHKuSA79A+YpbJsUZkwyt/1R2FjHtqHdTcJ9b ZZATbO0teGNlZZQsom65yUbO2C7Eip6OpAjvgWS6wze4sy3IyLGQKrlgOdDPuzmB5exr cxIA== X-Gm-Message-State: AGRZ1gLYz+6N84mJ6hlwhRNcYlVO2EDtFBjL4wB8RjQexPbwKLkomjVc tnAKP+HcLehFv5J3nFeM/jiXkDI2TFQ= X-Google-Smtp-Source: AJdET5e9YP5djycjkIY/0/qQ4JKJFiwarskffeH7LAy4dV8U1Cqp2f6k4CD86IquvAMonnAF2O/Ahw== X-Received: by 2002:a5d:6585:: with SMTP id q5-v6mr20057101wru.141.1541443498961; Mon, 05 Nov 2018 10:44:58 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:3117:2b29:5ef7:a9e5]) by smtp.gmail.com with ESMTPSA id y21-v6sm19329761wma.36.2018.11.05.10.44.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 10:44:58 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/6] ARM: compressed: put zImage header and EFI header in dedicated section Date: Mon, 5 Nov 2018 19:44:37 +0100 Message-Id: <20181105184438.19494-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181105184438.19494-1-ard.biesheuvel@linaro.org> References: <20181105184438.19494-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181105_104508_672553_9E86B4FD X-CRM114-Status: GOOD ( 14.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nicolas.pitre@linaro.org, linux@armlinux.org.uk, Ard Biesheuvel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP To align the PE/COFF and the ELF headers of the decompressor binary, put the zImage header and the EFI header in a separate .start section, and emit it at the start of the Image. This change is necessary for UEFI based debug tooling to be able to use the vmlinux ELF binary, since it gets confused if the PE/COFF .text section and the ELF .text section live at different offsets. With this change, we also stop relying on the code to flow from one section to the next simply because the order in which the linker emits the sections happens to be what we expect. Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/head.S | 6 +++--- arch/arm/boot/compressed/vmlinux.lds.S | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 55c227077207..e3c43fdb6371 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -176,6 +176,8 @@ start: .word _magic_table @ additional data table __EFI_HEADER + + .text 1: ARM_BE8( setend be ) @ go BE8 if compiled for BE8 AR_CLASS( mrs r9, cpsr ) @@ -209,10 +211,8 @@ not_angel: /* * some architecture specific code can be inserted - * by the linker here, but it should preserve r7, r8, and r9. + * here, but it should preserve r7, r8, and r9. */ - - .text #ifdef CONFIG_PXA_SHARPSL_DETECT_MACH_ID bl __SharpSL_start #endif diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S index 2b963d8e76dd..ad9921490034 100644 --- a/arch/arm/boot/compressed/vmlinux.lds.S +++ b/arch/arm/boot/compressed/vmlinux.lds.S @@ -34,9 +34,11 @@ SECTIONS . = TEXT_START; _text = .; - .text : { + .start : { _start = .; *(.start) + } + .text : { *(.text) *(.text.*) *(.fixup) From patchwork Mon Nov 5 18:44:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10668923 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E63EF17D4 for ; Mon, 5 Nov 2018 18:45:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5E6E295E2 for ; Mon, 5 Nov 2018 18:45:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9EF729976; Mon, 5 Nov 2018 18:45:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 626CE295E2 for ; Mon, 5 Nov 2018 18:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Uy0GrpgpU2ZYzFNASiITsfWBWLv7nZb41me14O7jVFs=; b=DFqxmWsdPNjSpa ulQ5EzM/HJeWsgaH2UzD9BdcnCnyC5O60bKre/z8nsC7F1E1euSNufh8Uqs4pXmbxPRqLzLWMpKgv tzgHVtbRbMN3FlCJkp7gaCdmNiYBVutBSG3SvTHNMXf8MjV5Ura9s7LwbZli/wbDCq5ZMu71yY1FR CHHgdQqb3iGaX2KE/rXbvbqCOcyAowf/x+DxInyBwUrHwJxPqr6TRCoy+lQMqn4HUCv5txsSRt9gg s0qMZC2jhxfM5f5U0mJSL7H06YR+kpOvMLgxT2GPzGSu16XEJG6fgv5vLn1l9lRe/pIBGjN1jSUql zT0vd2U3N3hdlJRgk3og==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjsn-000485-LZ; Mon, 05 Nov 2018 18:45:53 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjs4-0001ur-Hp for linux-arm-kernel@lists.infradead.org; Mon, 05 Nov 2018 18:45:12 +0000 Received: by mail-wr1-x444.google.com with SMTP id o15-v6so7048059wrv.4 for ; Mon, 05 Nov 2018 10:45:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7syzrrpvzhMrE0+EM0swCFRh5FwJREr5Lqqb/OiR/qU=; b=Gc4Amew/4OUrzbZb0R+JnA260MYVHu0pktxPzZMJsrcUxKnZn4oTBiHG8DUjDQLGp1 YrUma0+lYKxDVcZnE4iT8oo9Tamt7Rs4Qr/4RQVkTpqC9v8pHL7Y4qOa1h5u5UxNoYyO XPDeMZk7YXkQWqCe7p5XQH56j/yGV6bI3/L5E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7syzrrpvzhMrE0+EM0swCFRh5FwJREr5Lqqb/OiR/qU=; b=RZdB6Ve7Gg8+zIBymyWH/jVdMa0AIrfeQfgaPZstIL3wXcoFffJv+yMCav3cJtbEZC 6zIfyj/k+ZWu+Pbm1nOGaVtqy47wQdh0nyYNOng6xnzXkrD2+g7wo/9AyamHhsZOZj+P 4IuOjmKWX3MB3imPi1Vz1Sbu/d4/K6TplOYijPsvA0nb/GaVb0oTVVTjGyjRJGv98Pq+ KpnuKCRlV+Pni1GiSOIA022V5N3nPuxZuoZYE4L+zsOYVAUFWao2Nd/H+p8sSPovdh0d 1f4bzT/QO6v13HfE8hfv3CMk4mTTHNMaZpp1zv+gB+szUt/K++aP9FpY5ig6nPMe5ug2 mvKQ== X-Gm-Message-State: AGRZ1gJIXkSknTYvnvJhOQwyt0qzHTIbDw/Rv1tqqCLP92DLjwT/17Tl uimkTL5A1DYCdRDTw5/gs/PvaO1u7lk= X-Google-Smtp-Source: AJdET5c9kJdHwGp5NtdsCk87gkULKBFDqJmLgkIVh2+8OLhUYg7hUNfiLGwHNjnZHO+Ska6vfEN2gA== X-Received: by 2002:adf:bd0f:: with SMTP id j15-v6mr19563031wrh.267.1541443500251; Mon, 05 Nov 2018 10:45:00 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:3117:2b29:5ef7:a9e5]) by smtp.gmail.com with ESMTPSA id y21-v6sm19329761wma.36.2018.11.05.10.44.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 10:44:59 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/6] ARM: efi: add PE/COFF debug table to EFI header Date: Mon, 5 Nov 2018 19:44:38 +0100 Message-Id: <20181105184438.19494-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181105184438.19494-1-ard.biesheuvel@linaro.org> References: <20181105184438.19494-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181105_104508_695752_60D5E8BB X-CRM114-Status: GOOD ( 13.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nicolas.pitre@linaro.org, linux@armlinux.org.uk, Ard Biesheuvel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This updates the PE/COFF header to emit the absolute path to the decompressor vmlinux ELF file into a so-called NB10 Codeview entry. On DEBUG builds of EDK2 for ARM, this will result in output to be printed as follows add-symbol-file /home/ard/linux-build-arm/arch/arm/boot/compressed/vmlinux 0x43889000 which can be consumed by GDB directly, and load the decompressor ELF symbols at the correct offset in the UEFI address space. With both the decompressor and the firmware's ELF symbols loaded, we can do single step debugging of calls made from the EFI stub into the firmware and back, which is *really* helpful when debugging the handover from UEFI to the decompressor. Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/Makefile | 4 ++ arch/arm/boot/compressed/efi-header.S | 47 ++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index d1862621556f..b3c7aff96b92 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -194,3 +194,7 @@ AFLAGS_hyp-stub.o := -Wa,-march=armv7-a $(obj)/hyp-stub.S: $(srctree)/arch/$(SRCARCH)/kernel/hyp-stub.S $(call cmd,shipped) + +ifeq ($(CONFIG_EFI)$(CONFIG_DEBUG_INFO),yy) +AFLAGS_head.o += -DVMLINUX_PATH="\"$(realpath $(obj)/vmlinux)\"" +endif diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compressed/efi-header.S index c94a88ae834d..5c29b31e7080 100644 --- a/arch/arm/boot/compressed/efi-header.S +++ b/arch/arm/boot/compressed/efi-header.S @@ -98,6 +98,11 @@ extra_header_fields: .quad 0 @ CertificationTable .quad 0 @ BaseRelocationTable +#ifdef CONFIG_DEBUG_INFO + .long efi_debug_table - start @ DebugTable + .long efi_debug_table_size +#endif + section_table: .ascii ".text\0\0\0" .long __pecoff_code_size @ VirtualSize @@ -127,6 +132,48 @@ section_table: .set section_count, (. - section_table) / 40 +#ifdef CONFIG_DEBUG_INFO + /* + * The debug table is referenced via its Relative Virtual + * Address (RVA), which is only defined for those parts of + * the image that are covered by a section declaration. Since + * this header is not covered by any section, the debug table + * must be emitted elsewhere. So stick it in the .rodata + * section instead. + * + * Note that the EFI debug entry itself may legally have a + * zero RVA, which means we can simply put it right after the + * section headers. + */ + .section ".rodata", #alloc + + .align 2 +efi_debug_table: + // EFI_IMAGE_DEBUG_DIRECTORY_ENTRY + .long 0 @ Characteristics + .long 0 @ TimeDateStamp + .short 0 @ MajorVersion + .short 0 @ MinorVersion + .long IMAGE_DEBUG_TYPE_CODEVIEW @ Type + .long efi_debug_entry_size @ SizeOfData + .long 0 @ RVA + .long efi_debug_entry - start @ FileOffset + + .set efi_debug_table_size, . - efi_debug_table + .previous + +efi_debug_entry: + // EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY + .ascii "NB10" @ Signature + .long 0 @ Unknown + .long 0 @ Unknown2 + .long 0 @ Unknown3 + + .asciz VMLINUX_PATH + + .set efi_debug_entry_size, . - efi_debug_entry +#endif + .align 12 __efi_start: #endif