From patchwork Fri Nov 24 14:47:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 10074153 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 06633602DC for ; Fri, 24 Nov 2017 14:49:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB6662A248 for ; Fri, 24 Nov 2017 14:49:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E08AE2A258; Fri, 24 Nov 2017 14:49:24 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham 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 70CB52A248 for ; Fri, 24 Nov 2017 14:49:24 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=V0poMSESWmzxMiX+MOr2XV/rG1RFYE8iGz/RJq6aFkc=; b=V8dYRRvRd2u+0/I+K0caMMMlnN ZIHn3d7L8bhORFCRSjtzCmohbjWhpgBjqQ/8O/KRG7xiSri+FalbZWr+npk0wYBvdYHCVreuSbFMS y0ynzlAzHVFOoPXYx1xqGVYSu9KMHb2np/KzxlZ+2HJEyoxW5iNK2o/mqlTWicId/tyY6e6t1mZab Kv+FjydO2uWFMqnwVX3fXST1gwtEC0Z8PY6ny8/eu3liKIPDYWQ8jdU7F1kFdV4kuzD2dpBvu3RHE DOZsoaZbuEg7ehjJKEzBSuUYFfriWeMaa4F+KGTkkwkS29Da6FjMAdnO4MFioXZmfAdpgWr0pPE2/ n+PIJCUA==; 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 1eIFIB-0000Fr-WD; Fri, 24 Nov 2017 14:49:24 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eIFHv-0008Cj-Ie for linux-arm-kernel@lists.infradead.org; Fri, 24 Nov 2017 14:49:11 +0000 Received: by mail-wm0-x243.google.com with SMTP id g130so20671868wme.0 for ; Fri, 24 Nov 2017 06:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=tka2Z5Z0Wt91tYkb1614WpZZNy4NOzb8s2OeJpvoHt8=; b=Q6G9HG+baQmnHzQZCD7R4YsXFG03KuTLKqA94PnFybb7O6wsogNed9DAk8c+02h5Dj fwoS9lH42qWyLTbXy/4kqQ4QTeEmkT4M9WnQvMhVVCRUDwYh/zuLAFPhuI6BwQbQhSlV 8LaMcYb9qgmVBkB6Ra51RLBYm/kjuuy60Frio= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=tka2Z5Z0Wt91tYkb1614WpZZNy4NOzb8s2OeJpvoHt8=; b=rKm1q9o9npArBiMZr9hEC8zE3WGLsb22aP8tpwkctYtshxc0gDbRRDD5+E2betaKR0 NF8RHiAYEJ950thPVs+jWt6cHSkF5gf873+q08YR+nxT0/HSFou6m9/yIQBYFc2klisq aJoCdSlwcrdoTpvC3FCQWl2qZIVauMEnlGX9HJ4Od92gjq+Dt/miwiRfjHTk4pcZlVLN v3AF8ZcaikyxjZ6YtVlrMXdKf0yM7GhOIexl5XivVhNw+2YLDXo4Kfdvebz5FdSOLpN/ TW9XGNNRb+UAuB09pimltKHuk3ki1DBwz+zMEsF+BopdJma7Kwjx7+/pnE4ILGJpaVb9 ms4g== X-Gm-Message-State: AJaThX5jE4OsL9+Q2p1aajTJddU0Z1fmXNtnUB5MdqiuYiWed+vJiaHT QfZaLCWVD2ybST4k8HFStGDZcA== X-Google-Smtp-Source: AGs4zMbnrFBpA6V+5Q1t26/Tl2QfYUj8wvfWJsRpC0qkee+SCJMp1wzJDHTJ8yqALggX7TQoYNbCkA== X-Received: by 10.28.238.221 with SMTP id j90mr10806707wmi.44.1511534925664; Fri, 24 Nov 2017 06:48:45 -0800 (PST) Received: from jfw540.home (ANice-653-1-499-163.w86-205.abo.wanadoo.fr. [86.205.111.163]) by smtp.gmail.com with ESMTPSA id l31sm37189661wrc.50.2017.11.24.06.48.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Nov 2017 06:48:45 -0800 (PST) From: Jerome Forissier To: Jens Wiklander , linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] tee: optee: report OP-TEE revision information Date: Fri, 24 Nov 2017 15:47:18 +0100 Message-Id: <00cdd293320d68f0d315ffc4c1957cfa90fdfb73.1511533457.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171124_064908_352670_B987CF84 X-CRM114-Status: GOOD ( 10.91 ) 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: Jerome Forissier MIME-Version: 1.0 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 When the driver initializes, report the following information about the OP-TEE OS: - major and minor version, - build identifier (if available). Signed-off-by: Jerome Forissier --- drivers/tee/optee/core.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c index 7952357df9c8..d04f4617aed2 100644 --- a/drivers/tee/optee/core.c +++ b/drivers/tee/optee/core.c @@ -302,6 +302,27 @@ static bool optee_msg_api_uid_is_optee_api(optee_invoke_fn *invoke_fn) return false; } +static void optee_msg_get_os_revision(optee_invoke_fn *invoke_fn) +{ + union { + struct arm_smccc_res smccc; + struct optee_smc_call_get_os_revision_result result; + } res = { + .result = { + .build_id = 0 + } + }; + + invoke_fn(OPTEE_SMC_CALL_GET_OS_REVISION, 0, 0, 0, 0, 0, 0, 0, + &res.smccc); + + if (res.result.build_id) + pr_info("revision %lu.%lu (%08lx)", res.result.major, + res.result.minor, res.result.build_id); + else + pr_info("revision %lu.%lu", res.result.major, res.result.minor); +} + static bool optee_msg_api_revision_is_compatible(optee_invoke_fn *invoke_fn) { union { @@ -465,6 +486,8 @@ static struct optee *optee_probe(struct device_node *np) return ERR_PTR(-EINVAL); } + optee_msg_get_os_revision(invoke_fn); + if (!optee_msg_api_revision_is_compatible(invoke_fn)) { pr_warn("api revision mismatch\n"); return ERR_PTR(-EINVAL);