From patchwork Fri Aug 9 15:03:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 266084 X-Patchwork-Delegate: albert.aribaud@free.fr 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 B519F2C00A2 for ; Sat, 10 Aug 2013 01:13:14 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 82F544A021; Fri, 9 Aug 2013 17:13:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 4Jofe7aUj1mn; Fri, 9 Aug 2013 17:13:13 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0DAEE4A02C; Fri, 9 Aug 2013 17:13:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AD4844A021 for ; Fri, 9 Aug 2013 17:13:06 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 csHV9Qo1fEgY for ; Fri, 9 Aug 2013 17:13:01 +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 mail-ob0-f180.google.com (mail-ob0-f180.google.com [209.85.214.180]) by theia.denx.de (Postfix) with ESMTPS id 4CBE84A049 for ; Fri, 9 Aug 2013 17:12:53 +0200 (CEST) Received: by mail-ob0-f180.google.com with SMTP id up14so803514obb.11 for ; Fri, 09 Aug 2013 08:12:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=B6kJbBBZWPa/GLm+uFKFtvsEX1sSdfgS6iqkCQwkMr8=; b=oIvo0CyTdeg5T4rhIozDzyA6y70UfFewHRLsUnsKlTaVIR3jYNRYnpsNbfzeQDevOw Jz+qB4so/D9PywqGElTvhlsdbIB5OSbUjbTwyF+y9YpZrPZxaHOGsTYPYhuzqHNIR9Q4 EcjzvBCJVP0FpO0WTYYI55ZI0mV/q8YQzu2vPc9IXp8kFC5yWdqshH6ogjJE5AfZhYYj lSMU0yEF6ymyBxR9t6aGekulpewa74Gu/4oFlz2KNxv2hfWq5sR1XBqwCT8wUuV6qbuM Ril/9HDiR33NjxSQgNUOXknA1bwvPeJuviE88jw5pHsI9CEUeVQyYVVcuPQcDWAaXSJ6 OcDg== X-Gm-Message-State: ALoCoQmSzC7hQL1hXszYg3XWHHcXv0wPeRHBrSL7IyIFbYSijTTK0AfQ3bj0iXfHPT8gIqeKivJj X-Received: by 10.60.144.230 with SMTP id sp6mr787979oeb.102.1376060690023; Fri, 09 Aug 2013 08:04:50 -0700 (PDT) Received: from slackpad.drs.calxeda.com (f053081188.adsl.alicedsl.de. [78.53.81.188]) by mx.google.com with ESMTPSA id hm1sm19249781obb.9.2013.08.09.08.04.46 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 09 Aug 2013 08:04:49 -0700 (PDT) From: Andre Przywara To: trini@ti.com, albert.u.boot@aribaud.net, christoffer.dall@linaro.org Date: Fri, 9 Aug 2013 17:03:12 +0200 Message-Id: <1376060592-10824-9-git-send-email-andre.przywara@linaro.org> X-Mailer: git-send-email 1.7.12.1 In-Reply-To: <1376060592-10824-1-git-send-email-andre.przywara@linaro.org> References: <1376060592-10824-1-git-send-email-andre.przywara@linaro.org> Cc: peter.maydell@linaro.org, geoff.levand@linaro.org, patches@linaro.org, marc.zyngier@arm.com, agraf@suse.de, u-boot@lists.denx.de, nicknickolaev@gmail.com, kvmarm@lists.cs.columbia.edu Subject: [U-Boot] [PATCH v4 8/8] ARM: VExpress: enable ARMv7 virt support for VExpress A15 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de To enable hypervisors utilizing the ARMv7 virtualization extension on the Versatile Express board with the A15 core tile, we add the required configuration variable. Also we define the board specific functions to do the SMP bringup: smp_set_cpu_boot_addr() to set the start address for secondary cores and smp_waitloop() to wait for IPIs and jump to the start address. This also serves as an example for what to do when adding support for new boards. Signed-off-by: Andre Przywara --- board/armltd/vexpress/Makefile | 7 +++++-- board/armltd/vexpress/vexpress_common.c | 13 ++++++++++++ board/armltd/vexpress/vexpress_smp.S | 36 +++++++++++++++++++++++++++++++++ include/configs/vexpress_ca15_tc2.h | 4 ++++ 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 board/armltd/vexpress/vexpress_smp.S diff --git a/board/armltd/vexpress/Makefile b/board/armltd/vexpress/Makefile index 6719f3d..282ef6d 100644 --- a/board/armltd/vexpress/Makefile +++ b/board/armltd/vexpress/Makefile @@ -26,9 +26,12 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o COBJS := vexpress_common.o +ifneq ($(CONFIG_ARMV7_NONSEC)$(CONFIG_ARMV7_VIRT),) +SOBJS := vexpress_smp.o +endif -SRCS := $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) +SRCS := $(COBJS:.o=.c) $(SOBJS:.o=.S) +OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) $(LIB): $(obj).depend $(OBJS) $(call cmd_link_o_target, $(OBJS)) diff --git a/board/armltd/vexpress/vexpress_common.c b/board/armltd/vexpress/vexpress_common.c index 2c54869..66b810d 100644 --- a/board/armltd/vexpress/vexpress_common.c +++ b/board/armltd/vexpress/vexpress_common.c @@ -272,3 +272,16 @@ ulong get_tbclk(void) { return (ulong)CONFIG_SYS_HZ; } + +/* Setting the address at which secondary cores start from. + * Versatile Express uses one address for all cores, so ignore corenr + */ +void smp_set_core_boot_addr(unsigned long addr, int corenr) +{ + /* The SYSFLAGS register on VExpress needs to be cleared first + * by writing to the next address, since any writes to the address + * at offset 0 will only be ORed in + */ + writel(~0, CONFIG_SYSFLAGS_ADDR + 4); + writel(addr, CONFIG_SYSFLAGS_ADDR); +} diff --git a/board/armltd/vexpress/vexpress_smp.S b/board/armltd/vexpress/vexpress_smp.S new file mode 100644 index 0000000..41be2e7 --- /dev/null +++ b/board/armltd/vexpress/vexpress_smp.S @@ -0,0 +1,36 @@ +/* + * code for redirecting secondary cores to their start address + * + * Copyright (c) 2013 Andre Przywara + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include + +/* void _smp_waitloop(unsigned previous_address); */ +ENTRY(smp_waitloop) + wfi + ldr r1, =CONFIG_SYSFLAGS_ADDR @ load start address + ldr r1, [r1] + cmp r0, r1 @ make sure we dont execute this code + beq smp_waitloop @ again (due to a spurious wakeup) + mov pc, r1 +ENDPROC(smp_waitloop) diff --git a/include/configs/vexpress_ca15_tc2.h b/include/configs/vexpress_ca15_tc2.h index 4f425ac..14aa78e 100644 --- a/include/configs/vexpress_ca15_tc2.h +++ b/include/configs/vexpress_ca15_tc2.h @@ -31,4 +31,8 @@ #include "vexpress_common.h" #define CONFIG_BOOTP_VCI_STRING "U-boot.armv7.vexpress_ca15x2_tc2" +#define CONFIG_SYSFLAGS_ADDR 0x1c010030 + +#define CONFIG_ARMV7_VIRT + #endif