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: 791313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="oB1HyLUF"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xCZXT1qJkz9t33 for ; Thu, 20 Jul 2017 10:29:29 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753680AbdGTA31 (ORCPT ); Wed, 19 Jul 2017 20:29:27 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:50906 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753720AbdGTA30 (ORCPT ); Wed, 19 Jul 2017 20:29:26 -0400 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 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org 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); }