From patchwork Sat Aug 11 01:25:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Chemparathy X-Patchwork-Id: 1416201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 2129BDFFCF for ; Thu, 6 Sep 2012 15:37:18 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T9e1h-0006Gj-OZ; Thu, 06 Sep 2012 15:29:55 +0000 Received: from comal.ext.ti.com ([198.47.26.152]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T00SK-0007up-VL for linux-arm-kernel@lists.infradead.org; Sat, 11 Aug 2012 01:25:39 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id q7B1PP6q021653; Fri, 10 Aug 2012 20:25:25 -0500 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q7B1PPPS010348; Fri, 10 Aug 2012 20:25:25 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Fri, 10 Aug 2012 20:25:24 -0500 Received: from ares-ubuntu.am.dhcp.ti.com (ares-ubuntu.am.dhcp.ti.com [158.218.103.17]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id q7B1PP0a001429; Fri, 10 Aug 2012 20:25:25 -0500 Received: from a0875269 by ares-ubuntu.am.dhcp.ti.com with local (Exim 4.76) (envelope-from ) id 1T00SC-00045e-Uo; Fri, 10 Aug 2012 21:25:25 -0400 From: Cyril Chemparathy To: , Subject: [RFC v2 21/22] ARM: keystone: enable SMP on Keystone machines Date: Fri, 10 Aug 2012 21:25:04 -0400 Message-ID: <1344648306-15619-22-git-send-email-cyril@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1344648306-15619-1-git-send-email-cyril@ti.com> References: <1344648306-15619-1-git-send-email-cyril@ti.com> MIME-Version: 1.0 X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.152 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Mailman-Approved-At: Thu, 06 Sep 2012 10:43:39 -0400 Cc: linux@arm.linux.org.uk, arnd@arndb.de, nico@linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, Vitaly Andrianov , grant.likely@secretlab.ca, Cyril Chemparathy X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch adds basic SMP support for Keystone machines. Nothing very fancy here, just enough to get 4 CPUs booted up. This does not include support for hotplug, etc. Signed-off-by: Vitaly Andrianov Signed-off-by: Cyril Chemparathy --- arch/arm/Kconfig | 1 + arch/arm/configs/keystone_defconfig | 2 + arch/arm/mach-keystone/Makefile | 1 + arch/arm/mach-keystone/keystone.c | 3 ++ arch/arm/mach-keystone/keystone.h | 23 +++++++++++ arch/arm/mach-keystone/platsmp.c | 74 +++++++++++++++++++++++++++++++++++ 6 files changed, 104 insertions(+) create mode 100644 arch/arm/mach-keystone/keystone.h create mode 100644 arch/arm/mach-keystone/platsmp.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f1b8aa0..37b4e9c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -416,6 +416,7 @@ config ARCH_KEYSTONE select SPARSE_IRQ select NEED_MACH_MEMORY_H select HAVE_SCHED_CLOCK + select HAVE_SMP help Support for boards based on the Texas Instruments Keystone family of SoCs. diff --git a/arch/arm/configs/keystone_defconfig b/arch/arm/configs/keystone_defconfig index 7f2a04b..5f71e66 100644 --- a/arch/arm/configs/keystone_defconfig +++ b/arch/arm/configs/keystone_defconfig @@ -1,7 +1,9 @@ CONFIG_EXPERIMENTAL=y CONFIG_BLK_DEV_INITRD=y CONFIG_ARCH_KEYSTONE=y +CONFIG_SMP=y CONFIG_ARM_ARCH_TIMER=y +CONFIG_NR_CPUS=4 CONFIG_AEABI=y CONFIG_HIGHMEM=y CONFIG_VFP=y diff --git a/arch/arm/mach-keystone/Makefile b/arch/arm/mach-keystone/Makefile index d4671d5..3f6b8ab 100644 --- a/arch/arm/mach-keystone/Makefile +++ b/arch/arm/mach-keystone/Makefile @@ -1 +1,2 @@ obj-y := keystone.o +obj-$(CONFIG_SMP) += platsmp.o diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c index 702c184..6a8ece9 100644 --- a/arch/arm/mach-keystone/keystone.c +++ b/arch/arm/mach-keystone/keystone.c @@ -26,6 +26,8 @@ #include #include +#include "keystone.h" + static struct map_desc io_desc[] = { { .virtual = 0xfe800000UL, @@ -73,6 +75,7 @@ static const char *keystone_match[] __initconst = { }; DT_MACHINE_START(KEYSTONE, "Keystone") + smp_ops(keystone_smp_ops) .map_io = keystone_map_io, .init_irq = keystone_init_irq, .timer = &keystone_timer, diff --git a/arch/arm/mach-keystone/keystone.h b/arch/arm/mach-keystone/keystone.h new file mode 100644 index 0000000..71bd0f4 --- /dev/null +++ b/arch/arm/mach-keystone/keystone.h @@ -0,0 +1,23 @@ +/* + * Copyright 2010-2012 Texas Instruments, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope 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, see . + */ + +#ifndef __KEYSTONE_H__ +#define __KEYSTONE_H__ + +extern struct smp_ops keystone_smp_ops; +extern void secondary_startup(void); + +#endif /* __KEYSTONE_H__ */ diff --git a/arch/arm/mach-keystone/platsmp.c b/arch/arm/mach-keystone/platsmp.c new file mode 100644 index 0000000..dbe7601 --- /dev/null +++ b/arch/arm/mach-keystone/platsmp.c @@ -0,0 +1,74 @@ +/* + * Copyright 2012 Texas Instruments, Inc. + * + * Based on platsmp.c, Copyright 2010-2011 Calxeda, Inc. + * Based on platsmp.c, Copyright (C) 2002 ARM Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope 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, see . + */ +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "keystone.h" + +static void __init keystone_smp_init_cpus(void) +{ + unsigned int i, ncores; + + ncores = 4; + + /* sanity check */ + if (ncores > NR_CPUS) { + pr_warn("restricted to %d cpus\n", NR_CPUS); + ncores = NR_CPUS; + } + + for (i = 0; i < ncores; i++) + set_cpu_possible(i, true); + + set_smp_cross_call(gic_raise_softirq); +} + +static void __init keystone_smp_prepare_cpus(unsigned int max_cpus) +{ + /* nothing for now */ +} + +static void __cpuinit keystone_secondary_init(unsigned int cpu) +{ + gic_secondary_init(0); +} + +static int __cpuinit +keystone_boot_secondary(unsigned int cpu, struct task_struct *idle) +{ + unsigned long *ptr; + + ptr = phys_to_virt(0x800001f0); + ptr[cpu] = virt_to_idmap(&secondary_startup); + __cpuc_flush_dcache_area(ptr, sizeof(ptr) * 4); + + return 0; +} + +struct smp_ops keystone_smp_ops __initdata = { + smp_init_ops(keystone) + smp_secondary_ops(keystone) +};