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: 18926 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BA82A2391D for ; Fri, 9 Aug 2013 15:04:51 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id gf11sf1557557vcb.2 for ; Fri, 09 Aug 2013 08:04:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=B6kJbBBZWPa/GLm+uFKFtvsEX1sSdfgS6iqkCQwkMr8=; b=BIMwLoQ8xhKmt2wDvNUQMehqx2po+cSMzYUzFUWuSL7CjaqoCZ8x22dvvF2gs2MeLe z170pls1+AZh2TW3sVSgjdEoyuG3xWOgaKa0+WCv/+EqYn0dCtVyqD2SW/BOMI6AcMBR IK2jPQTEDswU0PP4DbnHMoOmy9uAuBoI31dkX/Hz6v+he2NogqTi0OCUMF4i8V0CzTgh s/kJ9vlFkpm6C1ai9R/yEkqOMyoE1tlOJfh4S2LWeXz3XUiZkIPNsKcCtqLDrHdAg0yQ r0Bs75EpXIYYKAyoOCWa/ZIWzQwMfykrCTUiVCDf9+YuF+GBghmJOM1fmRC70luLBYOT Zshg== X-Received: by 10.58.188.15 with SMTP id fw15mr1186228vec.9.1376060691528; Fri, 09 Aug 2013 08:04:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.52.40 with SMTP id q8ls1516257qeo.1.gmail; Fri, 09 Aug 2013 08:04:51 -0700 (PDT) X-Received: by 10.220.238.81 with SMTP id kr17mr630593vcb.61.1376060691424; Fri, 09 Aug 2013 08:04:51 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id t10si4736900vcm.62.2013.08.09.08.04.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 09 Aug 2013 08:04:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id id13so684975vcb.18 for ; Fri, 09 Aug 2013 08:04:51 -0700 (PDT) X-Gm-Message-State: ALoCoQk9+Y0+Gna8HvR2rEtq1oXEdNUvX9GKC9SrhimwQPLm203sTds4kglOUh1iqnKXUGcuyWt+ X-Received: by 10.220.164.138 with SMTP id e10mr6991874vcy.27.1376060691305; Fri, 09 Aug 2013 08:04:51 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp78370vcz; Fri, 9 Aug 2013 08:04:50 -0700 (PDT) X-Received: by 10.182.227.136 with SMTP id sa8mr820590obc.39.1376060690589; Fri, 09 Aug 2013 08:04:50 -0700 (PDT) Received: from mail-ob0-f179.google.com (mail-ob0-f179.google.com [209.85.214.179]) by mx.google.com with ESMTPS id ct10si9639086oeb.141.2013.08.09.08.04.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 09 Aug 2013 08:04:50 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.214.179 is neither permitted nor denied by best guess record for domain of andre.przywara@linaro.org) client-ip=209.85.214.179; Received: by mail-ob0-f179.google.com with SMTP id fb19so6592434obc.10 for ; Fri, 09 Aug 2013 08:04:50 -0700 (PDT) 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 Cc: u-boot@lists.denx.de, marc.zyngier@arm.com, peter.maydell@linaro.org, geoff.levand@linaro.org, agraf@suse.de, kvmarm@lists.cs.columbia.edu, yamada.m@jp.panasonic.com, nicknickolaev@gmail.com, patches@linaro.org, Andre Przywara Subject: [PATCH v4 8/8] ARM: VExpress: enable ARMv7 virt support for VExpress A15 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> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: andre.przywara@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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