| 1 | |
| 2 |
|
| 3 | ===============================================
|
| 4 | TEE (Trusted Execution Environment) driver API
|
| 5 | ===============================================
|
| 6 |
|
| 7 | Kernel provides a TEE bus infrastructure where a Trusted Application is
|
| 8 | represented as a device identified via Universally Unique Identifier (UUID) and
|
| 9 | client drivers register a table of supported device UUIDs.
|
| 10 |
|
| 11 | TEE bus infrastructure registers following APIs:
|
| 12 |
|
| 13 | match():
|
| 14 | iterates over the client driver UUID table to find a corresponding
|
| 15 | match for device UUID. If a match is found, then this particular device is
|
| 16 | probed via corresponding probe API registered by the client driver. This
|
| 17 | process happens whenever a device or a client driver is registered with TEE
|
| 18 | bus.
|
| 19 |
|
| 20 | uevent():
|
| 21 | notifies user-space (udev) whenever a new device is registered on
|
| 22 | TEE bus for auto-loading of modularized client drivers.
|
| 23 |
|
| 24 | TEE bus device enumeration is specific to underlying TEE implementation, so it
|
| 25 | is left open for TEE drivers to provide corresponding implementation.
|
| 26 |
|
| 27 | Then TEE client driver can talk to a matched Trusted Application using APIs
|
| 28 | listed in include/linux/tee_drv.h.
|
| 29 |
|
| 30 | TEE client driver example
|
| 31 | -------------------------
|
| 32 |
|
| 33 | Suppose a TEE client driver needs to communicate with a Trusted Application
|
| 34 | having UUID: ``ac6a4085-0e82-4c33-bf98-8eb8e118b6c2``, so driver registration
|
| 35 | snippet would look like::
|
| 36 |
|
| 37 | static const struct tee_client_device_id client_id_table[] = {
|
| 38 | {UUID_INIT(0xac6a4085, 0x0e82, 0x4c33,
|
| 39 | 0xbf, 0x98, 0x8e, 0xb8, 0xe1, 0x18, 0xb6, 0xc2)},
|
| 40 | {}
|
| 41 | };
|
| 42 |
|
| 43 | MODULE_DEVICE_TABLE(tee, client_id_table);
|
| 44 |
|
| 45 | static struct tee_client_driver client_driver = {
|
| 46 | .probe = client_probe,
|
| 47 | .remove = client_remove,
|
| 48 | .id_table = client_id_table,
|
| 49 | .driver = {
|
| 50 | .name = DRIVER_NAME,
|
| 51 | },
|
| 52 | };
|
| 53 |
|
| 54 | module_tee_client_driver(client_driver);
|