1.. SPDX-License-Identifier: GPL-2.0 2 3=============================================== 4TEE (Trusted Execution Environment) driver API 5=============================================== 6 7Kernel provides a TEE bus infrastructure where a Trusted Application is 8represented as a device identified via Universally Unique Identifier (UUID) and 9client drivers register a table of supported device UUIDs. 10 11TEE bus infrastructure registers following APIs: 12 13match(): 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 20uevent(): 21 notifies user-space (udev) whenever a new device is registered on 22 TEE bus for auto-loading of modularized client drivers. 23 24TEE bus device enumeration is specific to underlying TEE implementation, so it 25is left open for TEE drivers to provide corresponding implementation. 26 27Then TEE client driver can talk to a matched Trusted Application using APIs 28listed in include/linux/tee_drv.h. 29 30TEE client driver example 31------------------------- 32 33Suppose a TEE client driver needs to communicate with a Trusted Application 34having UUID: ``ac6a4085-0e82-4c33-bf98-8eb8e118b6c2``, so driver registration 35snippet 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 .id_table = client_id_table, 47 .driver = { 48 .name = DRIVER_NAME, 49 .bus = &tee_bus_type, 50 .probe = client_probe, 51 .remove = client_remove, 52 }, 53 }; 54 55 static int __init client_init(void) 56 { 57 return driver_register(&client_driver.driver); 58 } 59 60 static void __exit client_exit(void) 61 { 62 driver_unregister(&client_driver.driver); 63 } 64 65 module_init(client_init); 66 module_exit(client_exit); 67