All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Documentation: tee: Document TEE kernel interface
@ 2020-06-04  6:59 Sumit Garg
  2020-06-04  9:05 ` Maxim Uvarov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sumit Garg @ 2020-06-04  6:59 UTC (permalink / raw)
  To: jens.wiklander, corbet
  Cc: maxim.uvarov, jarkko.sakkinen, tee-dev, linux-doc, linux-kernel,
	op-tee, Sumit Garg

Update documentation with TEE bus infrastructure which provides an
interface for kernel client drivers to communicate with corresponding
Trusted Application.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
---

Changes in v2:
- Add TEE client driver example snippet.

 Documentation/tee.txt | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/Documentation/tee.txt b/Documentation/tee.txt
index c8fad81..350dd40 100644
--- a/Documentation/tee.txt
+++ b/Documentation/tee.txt
@@ -53,6 +53,66 @@ clients, forward them to the TEE and send back the results. In the case of
 supplicants the communication goes in the other direction, the TEE sends
 requests to the supplicant which then sends back the result.
 
+The TEE kernel interface
+========================
+
+Kernel provides a TEE bus infrastructure where a Trusted Application is
+represented as a device identified via Universally Unique Identifier (UUID) and
+client drivers register a table of supported device UUIDs.
+
+TEE bus infrastructure registers following APIs:
+-  match(): iterates over the client driver UUID table to find a corresponding
+   match for device UUID. If a match is found, then this particular device is
+   probed via corresponding probe API registered by the client driver. This
+   process happens whenever a device or a client driver is registered with TEE
+   bus.
+-  uevent(): notifies user-space (udev) whenever a new device is registered on
+   TEE bus for auto-loading of modularized client drivers.
+
+TEE bus device enumeration is specific to underlying TEE implementation, so it
+is left open for TEE drivers to provide corresponding implementation.
+
+Then TEE client driver can talk to a matched Trusted Application using APIs
+listed in include/linux/tee_drv.h.
+
+TEE client driver example
+-------------------------
+
+Suppose a TEE client driver needs to communicate with a Trusted Application
+having UUID: ``ac6a4085-0e82-4c33-bf98-8eb8e118b6c2``, so driver registration
+snippet would look like::
+
+	static const struct tee_client_device_id client_id_table[] = {
+		{UUID_INIT(0xac6a4085, 0x0e82, 0x4c33,
+			   0xbf, 0x98, 0x8e, 0xb8, 0xe1, 0x18, 0xb6, 0xc2)},
+		{}
+	};
+
+	MODULE_DEVICE_TABLE(tee, client_id_table);
+
+	static struct tee_client_driver client_driver = {
+		.id_table	= client_id_table,
+		.driver		= {
+			.name		= DRIVER_NAME,
+			.bus		= &tee_bus_type,
+			.probe		= client_probe,
+			.remove		= client_remove,
+		},
+	};
+
+	static int __init client_init(void)
+	{
+		return driver_register(&client_driver.driver);
+	}
+
+	static void __exit client_exit(void)
+	{
+		driver_unregister(&client_driver.driver);
+	}
+
+	module_init(client_init);
+	module_exit(client_exit);
+
 OP-TEE driver
 =============
 
@@ -112,6 +172,14 @@ kernel are handled by the kernel driver. Other RPC messages will be forwarded to
 tee-supplicant without further involvement of the driver, except switching
 shared memory buffer representation.
 
+OP-TEE device enumeration
+-------------------------
+
+OP-TEE provides a pseudo Trusted Application: drivers/tee/optee/device.c in
+order to support device enumeration. In other words, OP-TEE driver invokes this
+application to retrieve a list of Trusted Applications which can be registered
+as devices on the TEE bus.
+
 AMD-TEE driver
 ==============
 
-- 
2.7.4


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

* Re: [PATCH v2] Documentation: tee: Document TEE kernel interface
  2020-06-04  6:59 [PATCH v2] Documentation: tee: Document TEE kernel interface Sumit Garg
@ 2020-06-04  9:05 ` Maxim Uvarov
  2020-06-15 20:19 ` Jarkko Sakkinen
  2020-06-19 19:42 ` Jonathan Corbet
  2 siblings, 0 replies; 6+ messages in thread
From: Maxim Uvarov @ 2020-06-04  9:05 UTC (permalink / raw)
  To: Sumit Garg
  Cc: Jens Wiklander, corbet, Jarkko Sakkinen,
	tee-dev @ lists . linaro . org, linux-doc,
	Linux Kernel Mailing List, op-tee

Looks good for me.

Reviewed-by: Maxim Uvarov <maxim.uvarov@linaro.org>

On Thu, 4 Jun 2020 at 10:00, Sumit Garg <sumit.garg@linaro.org> wrote:
>
> Update documentation with TEE bus infrastructure which provides an
> interface for kernel client drivers to communicate with corresponding
> Trusted Application.
>
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> ---
>
> Changes in v2:
> - Add TEE client driver example snippet.
>
>  Documentation/tee.txt | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 68 insertions(+)
>
> diff --git a/Documentation/tee.txt b/Documentation/tee.txt
> index c8fad81..350dd40 100644
> --- a/Documentation/tee.txt
> +++ b/Documentation/tee.txt
> @@ -53,6 +53,66 @@ clients, forward them to the TEE and send back the results. In the case of
>  supplicants the communication goes in the other direction, the TEE sends
>  requests to the supplicant which then sends back the result.
>
> +The TEE kernel interface
> +========================
> +
> +Kernel provides a TEE bus infrastructure where a Trusted Application is
> +represented as a device identified via Universally Unique Identifier (UUID) and
> +client drivers register a table of supported device UUIDs.
> +
> +TEE bus infrastructure registers following APIs:
> +-  match(): iterates over the client driver UUID table to find a corresponding
> +   match for device UUID. If a match is found, then this particular device is
> +   probed via corresponding probe API registered by the client driver. This
> +   process happens whenever a device or a client driver is registered with TEE
> +   bus.
> +-  uevent(): notifies user-space (udev) whenever a new device is registered on
> +   TEE bus for auto-loading of modularized client drivers.
> +
> +TEE bus device enumeration is specific to underlying TEE implementation, so it
> +is left open for TEE drivers to provide corresponding implementation.
> +
> +Then TEE client driver can talk to a matched Trusted Application using APIs
> +listed in include/linux/tee_drv.h.
> +
> +TEE client driver example
> +-------------------------
> +
> +Suppose a TEE client driver needs to communicate with a Trusted Application
> +having UUID: ``ac6a4085-0e82-4c33-bf98-8eb8e118b6c2``, so driver registration
> +snippet would look like::
> +
> +       static const struct tee_client_device_id client_id_table[] = {
> +               {UUID_INIT(0xac6a4085, 0x0e82, 0x4c33,
> +                          0xbf, 0x98, 0x8e, 0xb8, 0xe1, 0x18, 0xb6, 0xc2)},
> +               {}
> +       };
> +
> +       MODULE_DEVICE_TABLE(tee, client_id_table);
> +
> +       static struct tee_client_driver client_driver = {
> +               .id_table       = client_id_table,
> +               .driver         = {
> +                       .name           = DRIVER_NAME,
> +                       .bus            = &tee_bus_type,
> +                       .probe          = client_probe,
> +                       .remove         = client_remove,
> +               },
> +       };
> +
> +       static int __init client_init(void)
> +       {
> +               return driver_register(&client_driver.driver);
> +       }
> +
> +       static void __exit client_exit(void)
> +       {
> +               driver_unregister(&client_driver.driver);
> +       }
> +
> +       module_init(client_init);
> +       module_exit(client_exit);
> +
>  OP-TEE driver
>  =============
>
> @@ -112,6 +172,14 @@ kernel are handled by the kernel driver. Other RPC messages will be forwarded to
>  tee-supplicant without further involvement of the driver, except switching
>  shared memory buffer representation.
>
> +OP-TEE device enumeration
> +-------------------------
> +
> +OP-TEE provides a pseudo Trusted Application: drivers/tee/optee/device.c in
> +order to support device enumeration. In other words, OP-TEE driver invokes this
> +application to retrieve a list of Trusted Applications which can be registered
> +as devices on the TEE bus.
> +
>  AMD-TEE driver
>  ==============
>
> --
> 2.7.4
>

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

* Re: [PATCH v2] Documentation: tee: Document TEE kernel interface
  2020-06-04  6:59 [PATCH v2] Documentation: tee: Document TEE kernel interface Sumit Garg
  2020-06-04  9:05 ` Maxim Uvarov
@ 2020-06-15 20:19 ` Jarkko Sakkinen
  2020-06-16 13:50   ` Sumit Garg
  2020-06-19 19:42 ` Jonathan Corbet
  2 siblings, 1 reply; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-06-15 20:19 UTC (permalink / raw)
  To: Sumit Garg
  Cc: jens.wiklander, corbet, maxim.uvarov, tee-dev, linux-doc,
	linux-kernel, op-tee

On Thu, Jun 04, 2020 at 12:29:39PM +0530, Sumit Garg wrote:
> Update documentation with TEE bus infrastructure which provides an
> interface for kernel client drivers to communicate with corresponding
> Trusted Application.
> 
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>

Please at least broadly describe the update in the commit message.

/Jarkko

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

* Re: [PATCH v2] Documentation: tee: Document TEE kernel interface
  2020-06-15 20:19 ` Jarkko Sakkinen
@ 2020-06-16 13:50   ` Sumit Garg
  2020-06-17 23:15     ` Jarkko Sakkinen
  0 siblings, 1 reply; 6+ messages in thread
From: Sumit Garg @ 2020-06-16 13:50 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Jens Wiklander, Jonathan Corbet, Maxim Uvarov,
	tee-dev @ lists . linaro . org, Linux Doc Mailing List,
	Linux Kernel Mailing List, op-tee

On Tue, 16 Jun 2020 at 01:49, Jarkko Sakkinen
<jarkko.sakkinen@linux.intel.com> wrote:
>
> On Thu, Jun 04, 2020 at 12:29:39PM +0530, Sumit Garg wrote:
> > Update documentation with TEE bus infrastructure which provides an
> > interface for kernel client drivers to communicate with corresponding
> > Trusted Application.
> >
> > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
>
> Please at least broadly describe the update in the commit message.
>

How about following additional info to the above commit description?

Brief description of changes:
- Add a section to describe TEE kernel interface along with a TEE
client driver example snippet.
- Add a sub-section for OP-TEE driver to describe OP-TEE specific
device enumeration.

-Sumit

> /Jarkko

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

* Re: [PATCH v2] Documentation: tee: Document TEE kernel interface
  2020-06-16 13:50   ` Sumit Garg
@ 2020-06-17 23:15     ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-06-17 23:15 UTC (permalink / raw)
  To: Sumit Garg
  Cc: Jens Wiklander, Jonathan Corbet, Maxim Uvarov,
	tee-dev @ lists . linaro . org, Linux Doc Mailing List,
	Linux Kernel Mailing List, op-tee

On Tue, Jun 16, 2020 at 07:20:17PM +0530, Sumit Garg wrote:
> On Tue, 16 Jun 2020 at 01:49, Jarkko Sakkinen
> <jarkko.sakkinen@linux.intel.com> wrote:
> >
> > On Thu, Jun 04, 2020 at 12:29:39PM +0530, Sumit Garg wrote:
> > > Update documentation with TEE bus infrastructure which provides an
> > > interface for kernel client drivers to communicate with corresponding
> > > Trusted Application.
> > >
> > > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> >
> > Please at least broadly describe the update in the commit message.
> >
> 
> How about following additional info to the above commit description?
> 
> Brief description of changes:
> - Add a section to describe TEE kernel interface along with a TEE
> client driver example snippet.
> - Add a sub-section for OP-TEE driver to describe OP-TEE specific
> device enumeration.
> 
> -Sumit
> 
> > /Jarkko

WFM

/Jarkko

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

* Re: [PATCH v2] Documentation: tee: Document TEE kernel interface
  2020-06-04  6:59 [PATCH v2] Documentation: tee: Document TEE kernel interface Sumit Garg
  2020-06-04  9:05 ` Maxim Uvarov
  2020-06-15 20:19 ` Jarkko Sakkinen
@ 2020-06-19 19:42 ` Jonathan Corbet
  2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Corbet @ 2020-06-19 19:42 UTC (permalink / raw)
  To: Sumit Garg
  Cc: jens.wiklander, maxim.uvarov, jarkko.sakkinen, tee-dev,
	linux-doc, linux-kernel, op-tee

On Thu,  4 Jun 2020 12:29:39 +0530
Sumit Garg <sumit.garg@linaro.org> wrote:

> Update documentation with TEE bus infrastructure which provides an
> interface for kernel client drivers to communicate with corresponding
> Trusted Application.
> 
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> ---
> 
> Changes in v2:
> - Add TEE client driver example snippet.
> 
>  Documentation/tee.txt | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 68 insertions(+)

Applied, thanks.

jon

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

end of thread, other threads:[~2020-06-19 19:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04  6:59 [PATCH v2] Documentation: tee: Document TEE kernel interface Sumit Garg
2020-06-04  9:05 ` Maxim Uvarov
2020-06-15 20:19 ` Jarkko Sakkinen
2020-06-16 13:50   ` Sumit Garg
2020-06-17 23:15     ` Jarkko Sakkinen
2020-06-19 19:42 ` Jonathan Corbet

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.