From patchwork Thu Nov 22 15:51:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 1783931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 2D2A33FC23 for ; Thu, 22 Nov 2012 15:54:57 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TbZ4O-0001Ub-GQ; Thu, 22 Nov 2012 15:52:04 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TbZ40-0001OO-OX for linux-arm-kernel@lists.infradead.org; Thu, 22 Nov 2012 15:51:42 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MDW00HWMC1SSPX0@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 23 Nov 2012 00:51:37 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-aa-50ae4a0995dd Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id DF.A4.01231.90A4EA05; Fri, 23 Nov 2012 00:51:37 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MDW0039YC1LP780@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 23 Nov 2012 00:51:37 +0900 (KST) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Subject: [PATCH v4 2/5] ARM: EXYNOS: Add support for secure monitor calls Date: Thu, 22 Nov 2012 16:51:15 +0100 Message-id: <1353599478-24617-3-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1353599478-24617-1-git-send-email-t.figa@samsung.com> References: <1353599478-24617-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jQV1Or3UBBncPa1lsenyN1YHRY/OS +gDGKC6blNSczLLUIn27BK6MhTtnsBd8Fa+YsWsKYwPjduEuRk4OCQETiRmfz7FA2GISF+6t Z+ti5OIQEpjOKPFk2XsmCGczk8SKvqesIFVsAmoSnxsesYHYIgKqEp/bFrCDFDEL3GKUOHzz L2MXIweHsICnxKYr0iA1LEA1S06eANvAK+AkMXXjUaht8hJP7/eBzeEUcJaY1f2ZHcQWAqpZ uP8P8wRG3gWMDKsYRVMLkguKk9JzDfWKE3OLS/PS9ZLzczcxgn3+TGoH48oGi0OMAhyMSjy8 ms5rA4RYE8uKK3MPMUpwMCuJ8OborwsQ4k1JrKxKLcqPLyrNSS0+xCjNwaIkztvskRIgJJCe WJKanZpakFoEk2Xi4JRqYNx712mxvFynvc9v+YbPVqeZPwrevjT73enyj1yn2edbiG2zZf1p ec1T+ddzJZu7c2YVMG/R1bg93e5POEv5aqmlEeLbr/+XDgpbl8uslKLrtXdC9JHs4xtXPU6K Ef7w5vqere+P1FidNtN/dnXKmUfvVJ6W1nPwnPQ931ISttNn/xer73HNTl+UWIozEg21mIuK EwGbtVKq9QEAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121122_105141_178250_DD1E8A1D X-CRM114-Status: GOOD ( 11.63 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.34 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: kgene.kim@samsung.com, linux@arm.linux.org.uk, arnd@arndb.de, t.figa@samsung.com, tomasz.figa@gmail.com, kyungmin.park@samsung.com, olof@lixom.net, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com 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: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Some boards use secure monitor calls to communicate with secure firmware. This patch adds exynos_smc function which uses smc assembly instruction to do secure monitor calls. Signed-off-by: Kyungmin Park Signed-off-by: Tomasz Figa --- arch/arm/mach-exynos/Makefile | 5 +++++ arch/arm/mach-exynos/exynos-smc.S | 22 ++++++++++++++++++++++ arch/arm/mach-exynos/smc.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 arch/arm/mach-exynos/exynos-smc.S create mode 100644 arch/arm/mach-exynos/smc.h diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile index c12ed6a..a031012 100644 --- a/arch/arm/mach-exynos/Makefile +++ b/arch/arm/mach-exynos/Makefile @@ -30,6 +30,11 @@ obj-$(CONFIG_EXYNOS4_MCT) += mct.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o +obj-$(CONFIG_ARCH_EXYNOS) += exynos-smc.o + +plus_sec := $(call as-instr,.arch_extension sec,+sec) +AFLAGS_exynos-smc.o :=-Wa,-march=armv7-a$(plus_sec) + # machine support obj-$(CONFIG_MACH_SMDKC210) += mach-smdkv310.o diff --git a/arch/arm/mach-exynos/exynos-smc.S b/arch/arm/mach-exynos/exynos-smc.S new file mode 100644 index 0000000..2e27aa3 --- /dev/null +++ b/arch/arm/mach-exynos/exynos-smc.S @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2012 Samsung Electronics. + * + * Copied from omap-smc.S Copyright (C) 2010 Texas Instruments, Inc. + * + * 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 + +/* + * Function signature: void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3) + */ + +ENTRY(exynos_smc) + stmfd sp!, {r4-r11, lr} + dsb + smc #0 + ldmfd sp!, {r4-r11, pc} +ENDPROC(exynos_smc) diff --git a/arch/arm/mach-exynos/smc.h b/arch/arm/mach-exynos/smc.h new file mode 100644 index 0000000..e972390 --- /dev/null +++ b/arch/arm/mach-exynos/smc.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2012 Samsung Electronics. + * + * EXYNOS - SMC Call + * + * 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. + */ + +#ifndef __ASM_ARCH_EXYNOS_SMC_H +#define __ASM_ARCH_EXYNOS_SMC_H + +#define SMC_CMD_INIT (-1) +#define SMC_CMD_INFO (-2) +/* For Power Management */ +#define SMC_CMD_SLEEP (-3) +#define SMC_CMD_CPU1BOOT (-4) +#define SMC_CMD_CPU0AFTR (-5) +/* For CP15 Access */ +#define SMC_CMD_C15RESUME (-11) +/* For L2 Cache Access */ +#define SMC_CMD_L2X0CTRL (-21) +#define SMC_CMD_L2X0SETUP1 (-22) +#define SMC_CMD_L2X0SETUP2 (-23) +#define SMC_CMD_L2X0INVALL (-24) +#define SMC_CMD_L2X0DEBUG (-25) + +extern void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3); + +#endif