From patchwork Fri Jun 21 22:54:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 2764831 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B89C8C0AB1 for ; Fri, 21 Jun 2013 22:55:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC69620197 for ; Fri, 21 Jun 2013 22:55:30 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 728CC2012B for ; Fri, 21 Jun 2013 22:55:29 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UqAEg-0007U6-EF; Fri, 21 Jun 2013 22:55:18 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UqAEd-0007X0-Oy; Fri, 21 Jun 2013 22:55:15 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UqAEb-0007WW-3r for linux-arm-kernel@lists.infradead.org; Fri, 21 Jun 2013 22:55:13 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5LMsljL023316; Fri, 21 Jun 2013 17:54:47 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r5LMslai012557; Fri, 21 Jun 2013 17:54:47 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Fri, 21 Jun 2013 17:54:47 -0500 Received: from [158.218.103.117] (ula0393909.am.dhcp.ti.com [158.218.103.117]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r5LMslQM010911; Fri, 21 Jun 2013 17:54:47 -0500 Message-ID: <51C4D9B7.5010109@ti.com> Date: Fri, 21 Jun 2013 18:54:47 -0400 From: Santosh Shilimkar User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Arnd Bergmann Subject: Re: [PATCH] ARM: keystone: remove hand-coded smc instruction References: <201306212228.29717.arnd@arndb.de> <201306212313.16771.arnd@arndb.de> <51C4C3B4.2050508@ti.com> <201306212341.08579.arnd@arndb.de> In-Reply-To: <201306212341.08579.arnd@arndb.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130621_185513_269326_5D0D3652 X-CRM114-Status: GOOD ( 22.95 ) X-Spam-Score: -8.4 (--------) Cc: Linux ARM Kernel List X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Friday 21 June 2013 05:41 PM, Arnd Bergmann wrote: > On Friday 21 June 2013, Santosh Shilimkar wrote: >>> >> I was curious how you will fix that for a c file. >> Just to be clear, I was planning to do that in 3.11-rcx/3.12 >> time. Let me know if it needs to be done earlier than that. > > It breaks randconfig builds on arm-soc at the moment, so I'd > like the fix as early as possible for 3.11. > Ok, fix is at end of the email. Let me know if it makes to pass both the builds now. I have build and boot tested both ARM and THUMB2 builds on Keystone board. Regards, Santosh From 05d6a5b6cad624fb3791e8c1f8eb7c774f0790d9 Mon Sep 17 00:00:00 2001 From: Santosh Shilimkar Date: Fri, 21 Jun 2013 18:35:32 -0400 Subject: [PATCH] ARM: keystone: Move CPU bringup code to dedicated asm file Because of inline asm usage in platsmp.c, smc instruction creates build failure for ARM V6+V7 build where as using instruction encoding for smc breaks the thumb2 build. So move the code snippet to separate asm file and mark it with 'armv7-a$(plus_sec)' to avoid any build issues. Cc: Arnd Bergmann Signed-off-by: Santosh Shilimkar --- arch/arm/mach-keystone/Makefile | 6 +++++- arch/arm/mach-keystone/keystone.h | 6 ++++++ arch/arm/mach-keystone/platsmp.c | 15 +++------------ arch/arm/mach-keystone/smc.S | 29 +++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 13 deletions(-) create mode 100644 arch/arm/mach-keystone/smc.S diff --git a/arch/arm/mach-keystone/Makefile b/arch/arm/mach-keystone/Makefile index 3f6b8ab..ddc52b0 100644 --- a/arch/arm/mach-keystone/Makefile +++ b/arch/arm/mach-keystone/Makefile @@ -1,2 +1,6 @@ -obj-y := keystone.o +obj-y := keystone.o smc.o + +plus_sec := $(call as-instr,.arch_extension sec,+sec) +AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec) + obj-$(CONFIG_SMP) += platsmp.o diff --git a/arch/arm/mach-keystone/keystone.h b/arch/arm/mach-keystone/keystone.h index 43a1b47..60bef9d 100644 --- a/arch/arm/mach-keystone/keystone.h +++ b/arch/arm/mach-keystone/keystone.h @@ -11,7 +11,13 @@ #ifndef __KEYSTONE_H__ #define __KEYSTONE_H__ +#define KEYSTONE_MON_CPU_UP_IDX 0x00 + +#ifndef __ASSEMBLER__ + extern struct smp_operations keystone_smp_ops; extern void secondary_startup(void); +extern u32 keystone_cpu_smc(u32 command, u32 cpu, u32 addr); +#endif /* __ASSEMBLER__ */ #endif /* __KEYSTONE_H__ */ diff --git a/arch/arm/mach-keystone/platsmp.c b/arch/arm/mach-keystone/platsmp.c index 630ab3b..1d4181e 100644 --- a/arch/arm/mach-keystone/platsmp.c +++ b/arch/arm/mach-keystone/platsmp.c @@ -30,18 +30,9 @@ static int __cpuinit keystone_smp_boot_secondary(unsigned int cpu, pr_debug("keystone-smp: booting cpu %d, vector %08lx\n", cpu, start); - asm volatile ( - "mov r0, #0\n" /* power on cmd */ - "mov r1, %1\n" /* cpu */ - "mov r2, %2\n" /* start */ - ".inst 0xe1600070\n" /* smc #0 */ - "mov %0, r0\n" - : "=r" (error) - : "r"(cpu), "r"(start) - : "cc", "r0", "r1", "r2", "memory" - ); - - pr_debug("keystone-smp: monitor returned %d\n", error); + error = keystone_cpu_smc(KEYSTONE_MON_CPU_UP_IDX, cpu, start); + if (error) + pr_err("CPU %d bringup failed with %d\n", cpu, error); return error; } diff --git a/arch/arm/mach-keystone/smc.S b/arch/arm/mach-keystone/smc.S new file mode 100644 index 0000000..9b9e4f7 --- /dev/null +++ b/arch/arm/mach-keystone/smc.S @@ -0,0 +1,29 @@ +/* + * Keystone Secure APIs + * + * Copyright (C) 2013 Texas Instruments, Inc. + * Santosh Shilimkar + * + * This program is free software,you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include + +/** + * u32 keystone_cpu_smc(u32 command, u32 cpu, u32 addr) + * + * Low level CPU monitor API + * @command: Monitor command. + * @cpu: CPU Number + * @addr: Kernel jump address for boot CPU + * + * Return: Non zero value on failure + */ +ENTRY(keystone_cpu_smc) + stmfd sp!, {r4-r12, lr} + smc #0 + dsb + ldmfd sp!, {r4-r12, pc} +ENDPROC(keystone_cpu_smc)