All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] tee: optee: report OP-TEE revision information
@ 2017-11-24 14:47 Jerome Forissier
  2017-11-24 14:47 ` [PATCH 1/2] tee: optee: GET_OS_REVISION: document a2 as a build identifier Jerome Forissier
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jerome Forissier @ 2017-11-24 14:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

This patchset updates the OP-TEE driver to report the version of the
secure OS upon initialization. To further facilitate troubleshooting,
an optional build ID is introduced in the response to the
OPTEE_SMC_CALL_GET_OS_REVISION request. Upstream OP-TEE uses this field
to report its Git SHA1 since commit 29cff5cf09aa ("core: GET_OS_REVISION:
return SHA1 of current Git commit").

Typical boot log (>> is introduced by this patchset):

    optee: probing for conduit method from DT.
 >> optee: revision 2.6 (947cfeec)
    optee: initialized driver

...or, if the build ID is not set by the TEE or set to zero:

    optee: probing for conduit method from DT.
 >> optee: revision 2.6
    optee: initialized driver

Jerome Forissier (2):
  tee: optee: GET_OS_REVISION: document a2 as a build identifier
  tee: optee: report OP-TEE revision information

 drivers/tee/optee/core.c      | 23 +++++++++++++++++++++++
 drivers/tee/optee/optee_smc.h | 10 +++++++++-
 2 files changed, 32 insertions(+), 1 deletion(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] tee: optee: GET_OS_REVISION: document a2 as a build identifier
  2017-11-24 14:47 [PATCH 0/2] tee: optee: report OP-TEE revision information Jerome Forissier
@ 2017-11-24 14:47 ` Jerome Forissier
  2017-11-24 14:47 ` [PATCH 2/2] tee: optee: report OP-TEE revision information Jerome Forissier
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jerome Forissier @ 2017-11-24 14:47 UTC (permalink / raw)
  To: linux-arm-kernel

In the OPTEE_SMC_CALL_GET_OS_REVISION request, the previously reserved
parameter a2 is now documented as being an optional build identifier
(such as an SCM revision or commit ID, for instance).

A new structure optee_smc_call_get_os_revision_result is introduced to
be used when querying the secure OS version, instead of re-using the
struct defined for OPTEE_SMC_CALLS_REVISION.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
---
 drivers/tee/optee/optee_smc.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/tee/optee/optee_smc.h b/drivers/tee/optee/optee_smc.h
index 069c8e1429de..d0b67c65ea8f 100644
--- a/drivers/tee/optee/optee_smc.h
+++ b/drivers/tee/optee/optee_smc.h
@@ -112,12 +112,20 @@ struct optee_smc_calls_revision_result {
  * Trusted OS, not of the API.
  *
  * Returns revision in a0-1 in the same way as OPTEE_SMC_CALLS_REVISION
- * described above.
+ * described above. May optionally return a 32-bit build identifier in a2,
+ * with zero meaning unspecified.
  */
 #define OPTEE_SMC_FUNCID_GET_OS_REVISION OPTEE_MSG_FUNCID_GET_OS_REVISION
 #define OPTEE_SMC_CALL_GET_OS_REVISION \
 	OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_GET_OS_REVISION)
 
+struct optee_smc_call_get_os_revision_result {
+	unsigned long major;
+	unsigned long minor;
+	unsigned long build_id;
+	unsigned long reserved1;
+};
+
 /*
  * Call with struct optee_msg_arg as argument
  *
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] tee: optee: report OP-TEE revision information
  2017-11-24 14:47 [PATCH 0/2] tee: optee: report OP-TEE revision information Jerome Forissier
  2017-11-24 14:47 ` [PATCH 1/2] tee: optee: GET_OS_REVISION: document a2 as a build identifier Jerome Forissier
@ 2017-11-24 14:47 ` Jerome Forissier
  2018-01-12  8:25 ` [PATCH 0/2] " Jerome Forissier
  2018-01-12 12:11 ` Matthias Brugger
  3 siblings, 0 replies; 5+ messages in thread
From: Jerome Forissier @ 2017-11-24 14:47 UTC (permalink / raw)
  To: linux-arm-kernel

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 <jerome.forissier@linaro.org>
---
 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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 0/2] tee: optee: report OP-TEE revision information
  2017-11-24 14:47 [PATCH 0/2] tee: optee: report OP-TEE revision information Jerome Forissier
  2017-11-24 14:47 ` [PATCH 1/2] tee: optee: GET_OS_REVISION: document a2 as a build identifier Jerome Forissier
  2017-11-24 14:47 ` [PATCH 2/2] tee: optee: report OP-TEE revision information Jerome Forissier
@ 2018-01-12  8:25 ` Jerome Forissier
  2018-01-12 12:11 ` Matthias Brugger
  3 siblings, 0 replies; 5+ messages in thread
From: Jerome Forissier @ 2018-01-12  8:25 UTC (permalink / raw)
  To: linux-arm-kernel



On 11/24/2017 03:47 PM, Jerome Forissier wrote:
> Hi,
> 
> This patchset updates the OP-TEE driver to report the version of the
> secure OS upon initialization. To further facilitate troubleshooting,
> an optional build ID is introduced in the response to the
> OPTEE_SMC_CALL_GET_OS_REVISION request. Upstream OP-TEE uses this field
> to report its Git SHA1 since commit 29cff5cf09aa ("core: GET_OS_REVISION:
> return SHA1 of current Git commit").
> 
> Typical boot log (>> is introduced by this patchset):
> 
>     optee: probing for conduit method from DT.
>  >> optee: revision 2.6 (947cfeec)
>     optee: initialized driver
> 
> ...or, if the build ID is not set by the TEE or set to zero:
> 
>     optee: probing for conduit method from DT.
>  >> optee: revision 2.6
>     optee: initialized driver
> 
> Jerome Forissier (2):
>   tee: optee: GET_OS_REVISION: document a2 as a build identifier
>   tee: optee: report OP-TEE revision information
> 
>  drivers/tee/optee/core.c      | 23 +++++++++++++++++++++++
>  drivers/tee/optee/optee_smc.h | 10 +++++++++-
>  2 files changed, 32 insertions(+), 1 deletion(-)
> 

Ping?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 0/2] tee: optee: report OP-TEE revision information
  2017-11-24 14:47 [PATCH 0/2] tee: optee: report OP-TEE revision information Jerome Forissier
                   ` (2 preceding siblings ...)
  2018-01-12  8:25 ` [PATCH 0/2] " Jerome Forissier
@ 2018-01-12 12:11 ` Matthias Brugger
  3 siblings, 0 replies; 5+ messages in thread
From: Matthias Brugger @ 2018-01-12 12:11 UTC (permalink / raw)
  To: linux-arm-kernel



On 11/24/2017 03:47 PM, Jerome Forissier wrote:
> Hi,
> 
> This patchset updates the OP-TEE driver to report the version of the
> secure OS upon initialization. To further facilitate troubleshooting,
> an optional build ID is introduced in the response to the
> OPTEE_SMC_CALL_GET_OS_REVISION request. Upstream OP-TEE uses this field
> to report its Git SHA1 since commit 29cff5cf09aa ("core: GET_OS_REVISION:
> return SHA1 of current Git commit").
> 
> Typical boot log (>> is introduced by this patchset):
> 
>     optee: probing for conduit method from DT.
>  >> optee: revision 2.6 (947cfeec)
>     optee: initialized driver
> 
> ...or, if the build ID is not set by the TEE or set to zero:
> 
>     optee: probing for conduit method from DT.
>  >> optee: revision 2.6
>     optee: initialized driver
> 
> Jerome Forissier (2):
>   tee: optee: GET_OS_REVISION: document a2 as a build identifier
>   tee: optee: report OP-TEE revision information
> 
>  drivers/tee/optee/core.c      | 23 +++++++++++++++++++++++
>  drivers/tee/optee/optee_smc.h | 10 +++++++++-
>  2 files changed, 32 insertions(+), 1 deletion(-)
> 

Reviewed-by: Matthias Brugger <mbruger@suse.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-12 12:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-24 14:47 [PATCH 0/2] tee: optee: report OP-TEE revision information Jerome Forissier
2017-11-24 14:47 ` [PATCH 1/2] tee: optee: GET_OS_REVISION: document a2 as a build identifier Jerome Forissier
2017-11-24 14:47 ` [PATCH 2/2] tee: optee: report OP-TEE revision information Jerome Forissier
2018-01-12  8:25 ` [PATCH 0/2] " Jerome Forissier
2018-01-12 12:11 ` Matthias Brugger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.