From patchwork Sat Nov 10 21:02:23 2018 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: 10677427 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B22115A6 for ; Sat, 10 Nov 2018 21:02:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F23CD2C40A for ; Sat, 10 Nov 2018 21:02:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4E962C410; Sat, 10 Nov 2018 21:02:43 +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=-2.8 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 8A86E2C40A for ; Sat, 10 Nov 2018 21:02:43 +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:Cc: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:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aMJrofjCJI+2Rnkx2BUJP66pKP1mptliI6WMREMiaNo=; b=gdtfSOVzhxgWKu X0oSP9TCF9k8AKhUFdnF119kHBTolauzun5W8i/IhM1ua3XqKOj3g08XL7Od5c8RpkfRuq2xOJfmT 6XPDHfNaXdRBGEg6sLWR6kkfRr4xi5KTR6uUwhAoE1w4Xny3RVYPSq8wq9AW2ACiW1nUSRdtIHw6J 8kxnlkfO/qea2pKq/l6qI9GcP11rwJds6fRNfL1etoT21UKZzAI0JBR7M4BazMt8Wtlhb93T4PR8m ksq3DzrHqix0adtsawN4pgv3ofYzu9Y5QusaXihA5s8/NuAUt5VG4aoY4POHGH0gPfrglD8LTFrj+ wmP6Hq0cP8e1T5AKg4yA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLaOt-00039G-M9; Sat, 10 Nov 2018 21:02:39 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLaOr-00038q-M2 for linux-arm-kernel@bombadil.infradead.org; Sat, 10 Nov 2018 21:02:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Cc:To:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:From:References:In-Reply-To:Message-Id:Date :Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=QM9q8egamx3husyDujyjoZsAlhmJd3hijaEIXWVjhno=; b=PfFbUkzWU9bcJCEhea0O6dGeBs G094aK/1XdHueXyBMfjzz06Lxx7RpR+lOmzQiLyeDeIePVTngRUh3ed6UdvV0DktISx4TDkgWg6cw mMqmhSzoZR6qQxrJxINu7xPJnX305mjJ7knbaKVdmSEb92a5n8YTB2/OpA2krO/y1Sxb7jBpleOEm XRUBBsyluEA6XhhQcVu29C1PtUIGYC9xwbc2SjaMgMEDT2gKOgvF9kPCtNwJeIqA3ZKpyRRNqni5l hpYEDW/c4UqwHyhalzbL+rrbLXUWjBPPsva30NsvLGomEHhSOg4Hj23frF2tX74fdZRertgtgEQC6 fxeNIyrQ==; Received: from rere.qmqm.pl ([91.227.64.183]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLaOo-0005yi-Ot for linux-arm-kernel@lists.infradead.org; Sat, 10 Nov 2018 21:02:36 +0000 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 42sqFJ0RyGzXW; Sat, 10 Nov 2018 22:01:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1541883684; bh=EAkVG0GgG7wtkZUSdJT2MyjnBtwKPq/yMGPbkGJRLUs=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=d/TczA/6g+yAs0+cez1gCwwAXSY2vi1/X+gVkLLRyQWJ1X28jAt8/DesOGtOCVRON UhO6nnZchKu0tvOa5jivhu4VU2RtgLmcs43eH8rbcMnnhnyDpeXdoksGs77Z6vXeaO bM8DCQmO5eD+v9YLpLEZEScAABZfH3XXTJpUuQj14o9g2JBULPxS73FeXyvfPOku81 4pB1kXPKZDiTUQfmtenbFvpWvxXIv/Yi8UPdvGi2mcoxhNSAXPgyGtAAfvbDKb8hXe llDpmqN0M1KCibCXpbCJN16FsORVZb2w7kEdO9sTUjNCIJpQ5E2O1JLaxZh0fN/Zm1 qr6NC91VMCKnw== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.100.2 at mail Date: Sat, 10 Nov 2018 22:02:23 +0100 Message-Id: <86834d26d87aa31ccb48c49e932f01274f1d4058.1541882833.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH 3/3] ARM: trusted_foundations: announce firmware version MIME-Version: 1.0 To: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181110_210234_852599_7CB0E8FB X-CRM114-Status: GOOD ( 14.76 ) 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: , Cc: linux-tegra@vger.kernel.org, Mark Rutland , Dmitry Osipenko , Russell King 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 | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/arch/arm/firmware/trusted_foundations.c b/arch/arm/firmware/trusted_foundations.c index 135068119453..e59f44fcda35 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 tf_generic_smc(u32 type, u32 arg1, u32 arg2) +static u64 tf_generic_smc(u32 type, u32 arg1, u32 arg2) { register u32 r0 asm("r0") = type; register u32 r1 asm("r1") = arg1; @@ -55,9 +57,10 @@ static void tf_generic_smc(u32 type, u32 arg1, u32 arg2) "mov r4, #0\n\t" "smc #0\n\t" "ldmfd sp!, {r4 - r11}\n\t" - : - : "r" (r0), "r" (r1), "r" (r2) + : "+r" (r0), "+r" (r1) + : "r" (r2) : "memory", "r3", "r12", "lr"); + return ((u64)r1 << 32) | r0; } static int tf_set_cpu_boot_addr(int cpu, unsigned long boot_addr) @@ -110,6 +113,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, @@ -120,6 +128,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 @@ -145,5 +159,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); }