From patchwork Mon Mar 9 09:53:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 45531 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 45D83214BF for ; Mon, 9 Mar 2015 09:53:46 +0000 (UTC) Received: by wibbs8 with SMTP id bs8sf10794252wib.3 for ; Mon, 09 Mar 2015 02:53:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:cc:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=uQ47c9//hR0pKYz61AxR+/kU/iwuCDiL7GzeQGKSjvs=; b=P3x7aWmBvKNhcCnUea7PKktQKkU1Nd/ObpjBfl5tpStOuYNv3P1g0Oq9TMQ1Sxm6CP 0WQ948x++3nhji1/T2qCUEz/o14yhWJqdnykjqidnvwz9gQcnIr4UPDBaqSoXmNaHDaO TO2b/oqr3D362EqszmuuoAjwpc7ypA1YRKFEnBPOVaPaMbhHA+Wd2cF1RiVIBngUzPBo i2yHz/gkvRMjAV09ioKx2eHvvu0gmzARbaGuEH8FNwQx68t/olZsifdzggP2b6AzUgdP OS4uig8oHcT20PWQXO0MbqW/fEUYHuKvhHWdHmmxEs6EElhS/SjaPQvT0x+MVYfRZZZW b39A== X-Gm-Message-State: ALoCoQkdXS0q2eWF6w/I0qgqfNBgmgT2SEVx0VCGolVKqBazw1GzJdMLBJA1iqpuOfSmLa+wM8IR X-Received: by 10.112.147.35 with SMTP id th3mr3691915lbb.15.1425894825474; Mon, 09 Mar 2015 02:53:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.206 with SMTP id q14ls321001lal.49.gmail; Mon, 09 Mar 2015 02:53:45 -0700 (PDT) X-Received: by 10.152.1.70 with SMTP id 6mr1759799lak.83.1425894825183; Mon, 09 Mar 2015 02:53:45 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id da11si13813779lad.115.2015.03.09.02.53.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Mar 2015 02:53:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbiw7 with SMTP id w7so30402649lbi.7 for ; Mon, 09 Mar 2015 02:53:45 -0700 (PDT) X-Received: by 10.112.147.104 with SMTP id tj8mr24917232lbb.106.1425894825050; Mon, 09 Mar 2015 02:53:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1367290lbj; Mon, 9 Mar 2015 02:53:44 -0700 (PDT) X-Received: by 10.194.219.169 with SMTP id pp9mr9120600wjc.143.1425894824035; Mon, 09 Mar 2015 02:53:44 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id dx5si35883848wib.57.2015.03.09.02.53.43; Mon, 09 Mar 2015 02:53:44 -0700 (PDT) Received-SPF: none (google.com: u-boot-bounces@lists.denx.de does not designate permitted sender hosts) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 67026A747C; Mon, 9 Mar 2015 10:53:42 +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 LyZvsoQIbhpk; Mon, 9 Mar 2015 10:53:41 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7967EA7439; Mon, 9 Mar 2015 10:53:41 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 759E5A7439 for ; Mon, 9 Mar 2015 10:53:38 +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 tDb1z4fU1J_O for ; Mon, 9 Mar 2015 10:53:38 +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-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) by theia.denx.de (Postfix) with ESMTPS id 2E07EA7427 for ; Mon, 9 Mar 2015 10:53:34 +0100 (CET) Received: by lbvp9 with SMTP id p9so46749770lbv.8 for ; Mon, 09 Mar 2015 02:53:34 -0700 (PDT) X-Received: by 10.152.181.197 with SMTP id dy5mr24901935lac.57.1425894814010; Mon, 09 Mar 2015 02:53:34 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id zo8sm3367277lbc.37.2015.03.09.02.53.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Mar 2015 02:53:32 -0700 (PDT) From: Linus Walleij To: u-boot@lists.denx.de, Albert Aribaud , Tom Rini Date: Mon, 9 Mar 2015 10:53:21 +0100 Message-Id: <1425894801-11823-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 Cc: Steve Rae , u-boot-review@google.com Subject: [U-Boot] [PATCH 4/4 v4] armv8/vexpress64: make multientry conditional X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 While the Freescale ARMv8 board LS2085A will enter U-Boot both on a master and a secondary (slave) CPU, this is not the common behaviour on ARMv8 platforms. The norm is that U-Boot is entered from the master CPU only, while the other CPUs are kept in WFI (wait for interrupt) state. The code determining which CPU we are running on is using the MPIDR register, but the definition of that register varies with platform to some extent, and handling multi-cluster platforms (such as the Juno) will become cumbersome. It is better to only enable the multiple entry code on machines that actually need it and disable it by default. Make the single entry default and add a special ARMV8_MULTIENTRY KConfig option to be used by the platforms that need multientry and set it for the LS2085A. Delete all use of the CPU_RELEASE_ADDR from the Vexpress64 boards as it is just totally unused and misleading, and make it conditional in the generic start.S code. This makes the Juno platform start U-Boot properly. Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Fix a non-inverted #ifdef and badly placed #endif regressing the Freescale LS2085A. - All other patches 1-3/4 are now applied so this is a stand-alone patch despite being named 4/4. ChangeLog v2->v3: - Make a bit more low-level assembly conditional with #ifdef. ChangeLog v1->v2: - Move configuration of ARMV8_MULTIENTRY over to Kconfig as requested by Tom Rini. --- arch/arm/Kconfig | 4 ++++ arch/arm/cpu/armv8/Kconfig | 6 ++++++ arch/arm/cpu/armv8/start.S | 19 +++++++++++++++---- arch/arm/include/asm/macro.h | 8 ++++++++ board/armltd/vexpress64/vexpress64.c | 6 ------ include/configs/vexpress_aemv8a.h | 7 ------- 6 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 arch/arm/cpu/armv8/Kconfig diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 72e7981bbecb..b9ebee104628 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -641,10 +641,12 @@ config TARGET_VEXPRESS64_JUNO config TARGET_LS2085A_EMU bool "Support ls2085a_emu" select ARM64 + select ARMV8_MULTIENTRY config TARGET_LS2085A_SIMU bool "Support ls2085a_simu" select ARM64 + select ARMV8_MULTIENTRY config TARGET_LS1021AQDS bool "Support ls1021aqds" @@ -757,6 +759,8 @@ source "arch/arm/cpu/armv7/zynq/Kconfig" source "arch/arm/cpu/armv7/Kconfig" +source "arch/arm/cpu/armv8/Kconfig" + source "board/aristainetos/Kconfig" source "board/BuR/kwb/Kconfig" source "board/BuR/tseries/Kconfig" diff --git a/arch/arm/cpu/armv8/Kconfig b/arch/arm/cpu/armv8/Kconfig new file mode 100644 index 000000000000..4cd84b031114 --- /dev/null +++ b/arch/arm/cpu/armv8/Kconfig @@ -0,0 +1,6 @@ +if ARM64 + +config ARMV8_MULTIENTRY + boolean "Enable multiple CPUs to enter into U-boot" + +endif diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S index 4b11aa4f2227..df80a4e5fd94 100644 --- a/arch/arm/cpu/armv8/start.S +++ b/arch/arm/cpu/armv8/start.S @@ -77,6 +77,7 @@ reset: /* Processor specific initialization */ bl lowlevel_init +#ifdef CONFIG_ARMV8_MULTIENTRY branch_if_master x0, x1, master_cpu /* @@ -88,11 +89,10 @@ slave_cpu: ldr x0, [x1] cbz x0, slave_cpu br x0 /* branch to the given address */ - - /* - * Master CPU - */ master_cpu: + /* On the master CPU */ +#endif /* CONFIG_ARMV8_MULTIENTRY */ + bl _main /*-----------------------------------------------------------------------*/ @@ -100,6 +100,15 @@ master_cpu: WEAK(lowlevel_init) mov x29, lr /* Save LR */ +#ifndef CONFIG_ARMV8_MULTIENTRY + /* + * For single-entry systems the lowlevel init is very simple. + */ + ldr x0, =GICD_BASE + bl gic_init_secure + +#else /* CONFIG_ARMV8_MULTIENTRY is set */ + #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3) branch_if_slave x0, 1f ldr x0, =GICD_BASE @@ -137,6 +146,8 @@ WEAK(lowlevel_init) bl armv8_switch_to_el1 #endif +#endif /* CONFIG_ARMV8_MULTIENTRY */ + 2: mov lr, x29 /* Restore LR */ ret diff --git a/arch/arm/include/asm/macro.h b/arch/arm/include/asm/macro.h index 1c8c4251ee0c..3b3146ab2239 100644 --- a/arch/arm/include/asm/macro.h +++ b/arch/arm/include/asm/macro.h @@ -78,6 +78,8 @@ lr .req x30 * choose processor with all zero affinity value as the master. */ .macro branch_if_slave, xreg, slave_label +#ifdef CONFIG_ARMV8_MULTIENTRY + /* NOTE: MPIDR handling will be erroneous on multi-cluster machines */ mrs \xreg, mpidr_el1 tst \xreg, #0xff /* Test Affinity 0 */ b.ne \slave_label @@ -90,6 +92,7 @@ lr .req x30 lsr \xreg, \xreg, #16 tst \xreg, #0xff /* Test Affinity 3 */ b.ne \slave_label +#endif .endm /* @@ -97,12 +100,17 @@ lr .req x30 * choose processor with all zero affinity value as the master. */ .macro branch_if_master, xreg1, xreg2, master_label +#ifdef CONFIG_ARMV8_MULTIENTRY + /* NOTE: MPIDR handling will be erroneous on multi-cluster machines */ mrs \xreg1, mpidr_el1 lsr \xreg2, \xreg1, #32 lsl \xreg1, \xreg1, #40 lsr \xreg1, \xreg1, #40 orr \xreg1, \xreg1, \xreg2 cbz \xreg1, \master_label +#else + b \master_label +#endif .endm .macro armv8_switch_to_el2_m, xreg1 diff --git a/board/armltd/vexpress64/vexpress64.c b/board/armltd/vexpress64/vexpress64.c index 20db81222e79..de6286435d97 100644 --- a/board/armltd/vexpress64/vexpress64.c +++ b/board/armltd/vexpress64/vexpress64.c @@ -22,12 +22,6 @@ int board_init(void) int dram_init(void) { - /* - * Clear spin table so that secondary processors - * observe the correct value after waken up from wfe. - */ - *(unsigned long *)CPU_RELEASE_ADDR = 0; - gd->ram_size = PHYS_SDRAM_1_SIZE; return 0; } diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index e6cd8819dd40..810eef12deb1 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -54,13 +54,6 @@ /* Flat Device Tree Definitions */ #define CONFIG_OF_LIBFDT -/* SMP Spin Table Definitions */ -#ifdef CONFIG_TARGET_VEXPRESS64_BASE_FVP -#define CPU_RELEASE_ADDR (CONFIG_SYS_SDRAM_BASE + 0x03f00000) -#else -#define CPU_RELEASE_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fff0) -#endif - /* CS register bases for the original memory map. */ #define V2M_PA_CS0 0x00000000 #define V2M_PA_CS1 0x14000000