From patchwork Thu Jul 20 00:29:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 9853425 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 243D7600F5 for ; Thu, 20 Jul 2017 00:33:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2862A286FB for ; Thu, 20 Jul 2017 00:33:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D48728709; Thu, 20 Jul 2017 00:33:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C81BC286FB for ; Thu, 20 Jul 2017 00:33:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:MIME-Version:Subject:From:References :In-Reply-To:Message-Id:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D86YeDB7ZHoG8cbvj/kOLM+4/t3SBF2GKJH9ZtrE0/U=; b=UIKtKlk8j6BuhI +Ol8yo0Lxr4xZs8EkGivr6RWMuY2irzHFXJa/UTjYPoLt2NqSA/xXxxk5F7nWVQUVd/xbdAkEf+/t ee5/J/V4XCfCq5jVi2he9KSVb3wMOS7pJbj/KgBx/QvKQ/DC3Gl7Lcv1cyHnKeVInhiN+TBU9THra u+aGaULKgIZa0GqoVZv7dpvdaf1cj+tLOTQrfxjNnjTVGC1adY2PCryHDmlh1rh/qpVbhWqtryBVq xhq1WBUxP5V+UiVCuyctMXPmQmubmW0L0MLlx/Yvjw5ks/nRU1sYZt2fGWo3EQGbIdDBkitaeMfvY edpXk3yV99/tRCpaoCeg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dXzPH-0006T7-0K; Thu, 20 Jul 2017 00:33:31 +0000 Received: from rere.qmqm.pl ([91.227.64.183]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dXzM9-0002Ra-3P for linux-arm-kernel@lists.infradead.org; Thu, 20 Jul 2017 00:30:23 +0000 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id EA20932A; Thu, 20 Jul 2017 02:29:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1500510565; bh=XQoZ/1ZaTQT49FFYTZczxrx/p2BrytIZUgWizwAR/hk=; h=Date:In-Reply-To:References:From:Subject:To:From; b=oB1HyLUFqEhlchnAfWPwsccnktwi58CS3WcA3YsO3thxRKcD6cdvbHMn07gf+egjn UhJ9yx2+fa45EGImsWUmhnDtv1kL0bvEtu0gJr5Dca2fv8F7w+n4GaBAvpWD7U9ASO xge9Afeq0RYS6uQ+aV1YfVWzNvK+H9zm+vaLnmxE5+3p4hWOFIvfD+hU/j9+yAKyvg tj9byIXagCZ1YF46r4VEVFa/smdth6QdrlMwsfukQV8bz4UYk+9fgHApRlh8PcQlw2 rszPHmw8hVOdzofxMYP0gyOLHQzN5y7ZJHUFrJwhgMreb3Fc7PQmhSi6Lg0/e56mZO k0odUHaw2VREw== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.99.2 at rere Date: Thu, 20 Jul 2017 02:29:24 +0200 Message-Id: <90ad41ff1b54695154348c0c7f9333ed9e162ce3.1500510157.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH 5/9] ARM: trusted_foundations: announce firmware version MIME-Version: 1.0 To: linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170719_173018_081028_4CDF1475 X-CRM114-Status: UNSURE ( 9.98 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 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-Virus-Scanned: ClamAV using ClamSMTP Announce Trusted Foundations version for debugging and documentation. Signed-off-by: Michał Mirosław --- arch/arm/firmware/trusted_foundations.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm/firmware/trusted_foundations.c b/arch/arm/firmware/trusted_foundations.c index 81ff71b87438..105655802dfd 100644 --- a/arch/arm/firmware/trusted_foundations.c +++ b/arch/arm/firmware/trusted_foundations.c @@ -30,6 +30,8 @@ #define TF_CACHE_FLUSH 2 #define TF_CACHE_REENABLE 4 +#define TF_GET_PROTOCOL_VERSION 0xfffffffb + #define TF_CPU_PM 0xfffffffc #define TF_CPU_PM_S3 0xffffffe3 #define TF_CPU_PM_S2 0xffffffe6 @@ -39,7 +41,7 @@ static unsigned long cpu_boot_addr; -static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2) +static u64 __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2) { asm volatile( ".arch_extension sec\n\t" @@ -54,6 +56,7 @@ static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2) : : "r" (type), "r" (arg1), "r" (arg2) : "memory"); + return 0; /* silence gcc warning */ } static int tf_set_cpu_boot_addr(int cpu, unsigned long boot_addr) @@ -106,6 +109,11 @@ static int tf_init_cache(void) } #endif /* CONFIG_CACHE_L2X0 */ +static u32 tf_get_protocol_version(void) +{ + return tf_generic_smc(TF_GET_PROTOCOL_VERSION, 0, 0) >> 48; +} + static const struct firmware_ops trusted_foundations_ops = { .set_cpu_boot_addr = tf_set_cpu_boot_addr, .prepare_idle = tf_prepare_idle, @@ -116,6 +124,12 @@ static const struct firmware_ops trusted_foundations_ops = { void register_trusted_foundations(struct trusted_foundations_platform_data *pd) { + unsigned int protocol = tf_get_protocol_version(); + + pr_info("TF: version %u.%u, protocol %u.%u\n", + pd->version_major, pd->version_minor, + protocol >> 8, protocol & 0xFF); + /* * we are not using version information for now since currently * supported SMCs are compatible with all TF releases @@ -141,5 +155,6 @@ void of_register_trusted_foundations(void) &pdata.version_minor); if (err != 0) panic("Trusted Foundation: missing version-minor property\n"); + register_trusted_foundations(&pdata); }