From patchwork Fri Dec 2 11:51:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Harkin X-Patchwork-Id: 86280 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp215834qgi; Fri, 2 Dec 2016 03:51:46 -0800 (PST) X-Received: by 10.194.171.104 with SMTP id at8mr38212469wjc.159.1480679506582; Fri, 02 Dec 2016 03:51:46 -0800 (PST) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id w3si4801581wjd.161.2016.12.02.03.51.46; Fri, 02 Dec 2016 03:51:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 170C0A75AC; Fri, 2 Dec 2016 12:51:41 +0100 (CET) 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 zugo94argM3N; Fri, 2 Dec 2016 12:51:40 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D4937B384A; Fri, 2 Dec 2016 12:51:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 65A70A7581 for ; Fri, 2 Dec 2016 12:51:28 +0100 (CET) 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 Cox8g7k3Vnt5 for ; Fri, 2 Dec 2016 12:51:28 +0100 (CET) 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 mail-wj0-f181.google.com (mail-wj0-f181.google.com [209.85.210.181]) by theia.denx.de (Postfix) with ESMTPS id 39571A7580 for ; Fri, 2 Dec 2016 12:51:23 +0100 (CET) Received: by mail-wj0-f181.google.com with SMTP id xy5so229870213wjc.0 for ; Fri, 02 Dec 2016 03:51:23 -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; bh=hr9XN6zAQlNF70TcGTan26uC2VOF1E3pWsN4dgRW904=; b=XNvsfPfAUrrip0IgW41ax+1LoLZpHBkDK2IIuzderN7fuZjIJSk7gOxHVgvsp2JwCU X2QQt3hQOyNT+EVgu+laj/lUzyFKKh2ge48kHEtJhT/86Vz1FDGfmDCfgheVBcJGsm8S 1Ylyce0p93KYYcCCrillUQscXrFf9CF+QbmbU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hr9XN6zAQlNF70TcGTan26uC2VOF1E3pWsN4dgRW904=; b=e0yizkTx3rj3PmICB5LCB8PduZVdX+phIQyBAbfT4i/vCpDlvUyJxUuWfq+gXdfNlt HaYl+capQsDXAC8SpB8MsTsyb6HPiQOTjjj4EygWx8hNF8Ga0w4HIKMRT2DNjfZ3CYu1 zM/ukVE9IHSWJaRKEqO2PlCFDgREN1kKq4DQ+NiRH66xFkz7IEKrtsZ40FjySDA0wavN R2J38mK4X4dwrjRUIODC79zeSigHLCtBHhFnu3s71pM2bZA81u9G0Z0KqwkPJadGwiWn 40eA9y2ZWLRvgGj8LcpiB8J+rToQbDaKvK7WP4oeZVmf7K0fvXZfCdLHQ7UywhPnI+xz 5IRA== X-Gm-Message-State: AKaTC020smxOWtmsCuzKPv1q732bnVBpjnT9fyTm4RWL2fBr3t6ZbH3R6iXnvkA2VL11wVio X-Received: by 10.194.86.165 with SMTP id q5mr37408420wjz.178.1480679483286; Fri, 02 Dec 2016 03:51:23 -0800 (PST) Received: from vbox.cambridge.arm.com (82-69-54-187.dsl.in-addr.zen.co.uk. [82.69.54.187]) by smtp.gmail.com with ESMTPSA id gk6sm5128068wjc.46.2016.12.02.03.51.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Dec 2016 03:51:22 -0800 (PST) From: Ryan Harkin To: u-boot@lists.denx.de Date: Fri, 2 Dec 2016 11:51:08 +0000 Message-Id: <1480679469-27065-2-git-send-email-ryan.harkin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1480679469-27065-1-git-send-email-ryan.harkin@linaro.org> References: <1480679469-27065-1-git-send-email-ryan.harkin@linaro.org> Cc: Tom Rini , David Feng , Albert Aribaud , Marc Zyngier , Andre Przywara , Soby Mathew Subject: [U-Boot] [RFC PATCH 1/2] Add Aarch32 option for ARMv8 CPUs 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This patch hacks some generic code used to allow the ARMv8 platform to specify if it is booting in Aarch32 mode. Some ARMv8 CPUs can be run in Aarch32 mode as well as Aarch64. A good example of this is ARM's AEMv8 FVP model which models the ARMv8 architecture rather than a specific CPU core. This patch is co-authored with Soby Mathew . Signed-off-by: Ryan Harkin --- Makefile | 5 +++++ arch/arm/Kconfig | 6 ++++++ arch/arm/cpu/armv7/virt-v7.c | 2 ++ arch/arm/cpu/armv8/u-boot-spl.lds | 5 +++++ arch/arm/cpu/armv8/u-boot.lds | 5 +++++ arch/arm/include/asm/armv8/mmu.h | 5 +++++ 6 files changed, 28 insertions(+) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/Makefile b/Makefile index 37cbcb2..b923ef7 100644 --- a/Makefile +++ b/Makefile @@ -1182,8 +1182,13 @@ u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE # relocation). # FIXME refactor dts/Makefile to share target/arch detection u-boot.elf: u-boot.bin +ifeq ($(CONFIG_ARMV8_AARCH32),y) + @$(OBJCOPY) -B arm -I binary -O elf32-littlearm \ + $< u-boot-elf.o +else @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \ $< u-boot-elf.o +endif @$(LD) u-boot-elf.o -o $@ \ --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \ -Ttext=$(CONFIG_SYS_TEXT_BASE) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d7a9b11..6475a21 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -44,6 +44,12 @@ config CPU_ARM1176 select HAS_VBAR select SYS_CACHE_SHIFT_5 + +config ARMV8_AARCH32 + bool "some help" + help + some better help + config CPU_V7 bool select HAS_VBAR diff --git a/arch/arm/cpu/armv7/virt-v7.c b/arch/arm/cpu/armv7/virt-v7.c index d33e5c6..b0f54e3 100644 --- a/arch/arm/cpu/armv7/virt-v7.c +++ b/arch/arm/cpu/armv7/virt-v7.c @@ -131,12 +131,14 @@ int armv7_init_nonsec(void) * ram, so need to relocate secure section before enabling other * cores. */ +#ifndef CONFIG_ARMV8_AARCH32 relocate_secure_section(); #ifndef CONFIG_ARMV7_PSCI smp_set_core_boot_addr((unsigned long)secure_ram_addr(_smp_pen), -1); smp_kick_all_cpus(); #endif +#endif /* call the non-sec switching code on this CPU also */ secure_ram_addr(_nonsec_init)(); diff --git a/arch/arm/cpu/armv8/u-boot-spl.lds b/arch/arm/cpu/armv8/u-boot-spl.lds index cc427c3..bddfbe6 100644 --- a/arch/arm/cpu/armv8/u-boot-spl.lds +++ b/arch/arm/cpu/armv8/u-boot-spl.lds @@ -17,8 +17,13 @@ MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE, MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, LENGTH = CONFIG_SPL_BSS_MAX_SIZE } +#ifdef CONFIG_ARMV8_AARCH32 +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +#else OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") OUTPUT_ARCH(aarch64) +#endif ENTRY(_start) SECTIONS { diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds index fd15ad5..0543458 100644 --- a/arch/arm/cpu/armv8/u-boot.lds +++ b/arch/arm/cpu/armv8/u-boot.lds @@ -8,8 +8,13 @@ * SPDX-License-Identifier: GPL-2.0+ */ +#ifdef CONFIG_ARMV8_AARCH32 +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +#else OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") OUTPUT_ARCH(aarch64) +#endif ENTRY(_start) SECTIONS { diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h index aa0f3c4..755c517 100644 --- a/arch/arm/include/asm/armv8/mmu.h +++ b/arch/arm/include/asm/armv8/mmu.h @@ -77,8 +77,13 @@ #define PTE_BLOCK_INNER_SHARE (3 << 8) #define PTE_BLOCK_AF (1 << 10) #define PTE_BLOCK_NG (1 << 11) +#ifdef CONFIG_ARMV8_AARCH32 +#define PTE_BLOCK_PXN ((1ULL) << 53) +#define PTE_BLOCK_UXN ((1ULL) << 54) +#else #define PTE_BLOCK_PXN (UL(1) << 53) #define PTE_BLOCK_UXN (UL(1) << 54) +#endif /* * AttrIndx[2:0]