OP-TEE updates for 7.2

- Fix kernel-doc warnings in optee_private.h and optee_msg.h
 - Allow MT_NORMAL_TAGGED shared memory to support ARM64 MTE buffers
 -----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEE0qerISgy2SKkqO79Wr/6JGat8H4FAmoZYygaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQWr/6JGat8H53ew//TRKAo3lNtl0qpGNg/WKQ
 Js1g9Yr4CrvgH2LbjLTUxARkYjAofy82XuYrQUXX39HeWZLyrebe1o+NTdFo3fhs
 Z7fw8K+krwFe5+xI450E6jVwUnDEhzhroLC2SqC7GeaeIWCQfZxJU5TgTVqeGa2q
 SBG7pJG9w89ICvdMZtepuz5AHBmoX02lCywPYV/5yeOQ8+mitBvGdLFXtR0sGPo3
 AfQ2SsnrzhB+MVj28jjY1/lBlNxC0xA13n47u3CclCiq9UEt4v4BPGcS99Rya0r7
 Et/Jczb/c0Rtit886SOohQ6zVRZ3MLS4NMC06okGg5i1Esc2i+eovnwh9I+lM/7C
 cVFKi223/dhIBgpGwoquca8sMrTSRMTI17oWn0zGk6xrq3EESScGZuDk+dYW4w5y
 sudcfMtTmkPrfw5AzDhtO3/Ihxq58js6BtRY1D32xs3DlFea28S1IgEoxpQMGawD
 KvhGGtEkZzADiBG8hwOwzdhUnDH7mBC6hA83Tvf/8nmzGIXcLWYjmE+EWxBe+fE+
 hwLObSb3eeh4pN2KUEzWJ3JyfrxQnfpfFIWY8XnirHs4QRPGZOjOUIOpmMhg8Vf7
 2q+6IDFjxxPqogAzcF/kGCqRbcu2GlwFEBKUlDl1xOJ6wQFdLQpSL7rT1fqxFYrD
 WUMPyTTJrTMQcxXdKnXlXJg=
 =VjsA
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmoaElQACgkQmmx57+YA
 GNlShQ/9FCV5RfITCXiyLiR4FAGeByON8oT4gnO+dDm5zlmxW4EcZV3ENZ3AEvb4
 Ix6/CIyivgLqcGDAzx/LYYeH/pdEulT1/Tw6PlLJ+6aWlI+547pMQ1Bg10a4+uCX
 +rGvR994eVu25XjFdU2MwBasAm1sgwhbnkH2WAMFtu70a0yvIE38fDP4CwNqgroX
 5fimtTK5zOE1wJU7jjl5LeJuWy8ws4+k2RQlVRSXbs+Xfl/W6Ti9WiiiXArGFcbr
 E3ZdSaGf+Ne8HwLpvULwSi+xwQ/T14WkraCREu89NSe0S6D1yqoJ/6pg5GfxJ27g
 dVrROEBwjXIcI9NcApLdK9lVPzmTt6qkmv/MMDJS0q6iRxR8u+muxuXGNWcu4XRW
 TZtJVET4ZLa0ZJukHffd+lsTWZOQa1LZkvz6VUAha/rndaU/YK9sTbNTVszEXH8N
 ko1UTW/mky65hwB7cK0S3D8uT8P/1BrgjZI/oIN+XjomkM5OYT8BT5XF4H9H0DyW
 s1EN5HynPwbANUyWuo6d08C8ZNVzvI9dykoG4ZMS/KXgc2QTqa78vzWsV5U5Gd4Y
 wNKXww4bBIKDvn7aCJrpHzrwOot0hbkjUS88W1YBL9sm2fflSUHJ1UhnhUkNsuSU
 6rR/FX2BsF9ClNvDfEvtilrQZiheivgJhX7nuB6iPZZ/63yFFkg=
 =EMFT
 -----END PGP SIGNATURE-----

Merge tag 'optee-for-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/jenswi/linux-tee into soc/drivers

OP-TEE updates for 7.2

- Fix kernel-doc warnings in optee_private.h and optee_msg.h
- Allow MT_NORMAL_TAGGED shared memory to support ARM64 MTE buffers

* tag 'optee-for-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/jenswi/linux-tee:
  tee: optee: fix kernel-doc warnings
  tee: optee: Allow MT_NORMAL_TAGGED shared memory

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2026-05-30 00:25:12 +02:00
commit 1f512d1f74
3 changed files with 94 additions and 79 deletions

View File

@ -602,7 +602,8 @@ static bool is_normal_memory(pgprot_t p)
return (((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC) ||
((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEBACK));
#elif defined(CONFIG_ARM64)
return (pgprot_val(p) & PTE_ATTRINDX_MASK) == PTE_ATTRINDX(MT_NORMAL);
return ((pgprot_val(p) & PTE_ATTRINDX_MASK) == PTE_ATTRINDX(MT_NORMAL)) ||
((pgprot_val(p) & PTE_ATTRINDX_MASK) == PTE_ATTRINDX(MT_NORMAL_TAGGED));
#else
#error "Unsupported architecture"
#endif

View File

@ -103,9 +103,9 @@
/**
* struct optee_msg_param_tmem - temporary memory reference parameter
* @buf_ptr: Address of the buffer
* @size: Size of the buffer
* @shm_ref: Temporary shared memory reference, pointer to a struct tee_shm
* @buf_ptr: address of the buffer
* @size: size of the buffer
* @shm_ref: temporary shared memory reference, pointer to a struct tee_shm
*
* Secure and normal world communicates pointers as physical address
* instead of the virtual address. This is because secure and normal world
@ -122,9 +122,9 @@ struct optee_msg_param_tmem {
/**
* struct optee_msg_param_rmem - registered memory reference parameter
* @offs: Offset into shared memory reference
* @size: Size of the buffer
* @shm_ref: Shared memory reference, pointer to a struct tee_shm
* @offs: offset into shared memory reference
* @size: size of the buffer
* @shm_ref: shared memory reference, pointer to a struct tee_shm
*/
struct optee_msg_param_rmem {
u64 offs;
@ -134,12 +134,12 @@ struct optee_msg_param_rmem {
/**
* struct optee_msg_param_fmem - FF-A memory reference parameter
* @offs_lower: Lower bits of offset into shared memory reference
* @offs_upper: Upper bits of offset into shared memory reference
* @internal_offs: Internal offset into the first page of shared memory
* reference
* @size: Size of the buffer
* @global_id: Global identifier of the shared memory
* @offs_low: lower bits of offset into shared memory reference
* @offs_high: higher bits of offset into shared memory reference
* @internal_offs: internal offset into the first page of shared memory
* reference
* @size: size of the buffer
* @global_id: global identifier of the shared memory
*/
struct optee_msg_param_fmem {
u32 offs_low;
@ -151,6 +151,9 @@ struct optee_msg_param_fmem {
/**
* struct optee_msg_param_value - opaque value parameter
* @a: first opaque value
* @b: second opaque value
* @c: third opaque value
*
* Value parameters are passed unchecked between normal and secure world.
*/
@ -168,6 +171,7 @@ struct optee_msg_param_value {
* @fmem: parameter by FF-A registered memory reference
* @value: parameter by opaque value
* @octets: parameter by octet string
* @u: union holding OP-TEE msg parameter
*
* @attr & OPTEE_MSG_ATTR_TYPE_MASK indicates if tmem, rmem or value is used in
* the union. OPTEE_MSG_ATTR_TYPE_VALUE_* indicates value or octets,
@ -189,16 +193,18 @@ struct optee_msg_param {
/**
* struct optee_msg_arg - call argument
* @cmd: Command, one of OPTEE_MSG_CMD_* or OPTEE_MSG_RPC_CMD_*
* @func: Trusted Application function, specific to the Trusted Application,
* used if cmd == OPTEE_MSG_CMD_INVOKE_COMMAND
* @session: In parameter for all OPTEE_MSG_CMD_* except
* OPTEE_MSG_CMD_OPEN_SESSION where it's an output parameter instead
* @cancel_id: Cancellation id, a unique value to identify this request
* @ret: return value
* @ret_origin: origin of the return value
* @num_params: number of parameters supplied to the OS Command
* @params: the parameters supplied to the OS Command
* @cmd: command, one of OPTEE_MSG_CMD_* or OPTEE_MSG_RPC_CMD_*
* @func: Trusted Application function, specific to the Trusted
* Application, used if cmd == OPTEE_MSG_CMD_INVOKE_COMMAND
* @session: in parameter for all OPTEE_MSG_CMD_* except
* OPTEE_MSG_CMD_OPEN_SESSION where it's an output parameter
* instead
* @cancel_id: cancellation id, a unique value to identify this request
* @pad: padding for alignment
* @ret: return value
* @ret_origin: origin of the return value
* @num_params: number of parameters supplied to the OS Command
* @params: the parameters supplied to the OS Command
*
* All normal calls to Trusted OS uses this struct. If cmd requires further
* information than what these fields hold it can be passed as a parameter

View File

@ -47,11 +47,11 @@ typedef void (optee_invoke_fn)(unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long,
struct arm_smccc_res *);
/*
/**
* struct optee_call_waiter - TEE entry may need to wait for a free TEE thread
* @list_node Reference in waiters list
* @c Waiting completion reference
* @sys_thread True if waiter belongs to a system thread
* @list_node: reference in waiters list
* @c: waiting completion reference
* @sys_thread: true if waiter belongs to a system thread
*/
struct optee_call_waiter {
struct list_head list_node;
@ -59,13 +59,13 @@ struct optee_call_waiter {
bool sys_thread;
};
/*
/**
* struct optee_call_queue - OP-TEE call queue management
* @mutex Serializes access to this struct
* @waiters List of threads waiting to enter OP-TEE
* @total_thread_count Overall number of thread context in OP-TEE or 0
* @free_thread_count Number of threads context free in OP-TEE
* @sys_thread_req_count Number of registered system thread sessions
* @mutex: serializes access to this struct
* @waiters: list of threads waiting to enter OP-TEE
* @total_thread_count: overall number of thread context in OP-TEE or 0
* @free_thread_count: number of threads context free in OP-TEE
* @sys_thread_req_count: number of registered system thread sessions
*/
struct optee_call_queue {
/* Serializes access to this struct */
@ -96,17 +96,17 @@ struct optee_shm_arg_cache {
/**
* struct optee_supp - supplicant synchronization struct
* @ctx the context of current connected supplicant.
* if !NULL the supplicant device is available for use,
* else busy
* @mutex: held while accessing content of this struct
* @req_id: current request id if supplicant is doing synchronous
* communication, else -1
* @reqs: queued request not yet retrieved by supplicant
* @idr: IDR holding all requests currently being processed
* by supplicant
* @reqs_c: completion used by supplicant when waiting for a
* request to be queued.
* @mutex: held while accessing content of this struct
* @ctx: the context of current connected supplicant.
* if !NULL the supplicant device is available for use,
* else busy
* @req_id: current request id if supplicant is doing synchronous
* communication, else -1
* @reqs: queued request not yet retrieved by supplicant
* @idr: IDR holding all requests currently being processed
* by supplicant
* @reqs_c: completion used by supplicant when waiting for a
* request to be queued.
*/
struct optee_supp {
/* Serializes access to this struct */
@ -119,25 +119,25 @@ struct optee_supp {
struct completion reqs_c;
};
/*
/**
* struct optee_pcpu - per cpu notif private struct passed to work functions
* @optee optee device reference
* @optee: optee device reference
*/
struct optee_pcpu {
struct optee *optee;
};
/*
/**
* struct optee_smc - optee smc communication struct
* @invoke_fn handler function to invoke secure monitor
* @memremaped_shm virtual address of memory in shared memory pool
* @invoke_fn: handler function to invoke secure monitor
* @memremaped_shm: virtual address of memory in shared memory pool
* @sec_caps: secure world capabilities defined by
* OPTEE_SMC_SEC_CAP_* in optee_smc.h
* @notif_irq interrupt used as async notification by OP-TEE or 0
* @optee_pcpu per_cpu optee instance for per cpu work or NULL
* @notif_pcpu_wq workqueue for per cpu asynchronous notification or NULL
* @notif_pcpu_work work for per cpu asynchronous notification
* @notif_cpuhp_state CPU hotplug state assigned for pcpu interrupt management
* @notif_irq: interrupt used as async notification by OP-TEE or 0
* @optee_pcpu: per_cpu optee instance for per cpu work or NULL
* @notif_pcpu_wq: workqueue for per cpu asynchronous notification or NULL
* @notif_pcpu_work: work for per cpu asynchronous notification
* @notif_cpuhp_state: CPU hotplug state assigned for pcpu interrupt management
*/
struct optee_smc {
optee_invoke_fn *invoke_fn;
@ -151,13 +151,15 @@ struct optee_smc {
};
/**
* struct optee_ffa_data - FFA communication struct
* @ffa_dev FFA device, contains the destination id, the id of
* struct optee_ffa - FFA communication struct
* @ffa_dev: FFA device, contains the destination id, the id of
* OP-TEE in secure world
* @bottom_half_value Notification ID used for bottom half signalling or
* @bottom_half_value: notification ID used for bottom half signalling or
* U32_MAX if unused
* @mutex Serializes access to @global_ids
* @global_ids FF-A shared memory global handle translation
* @mutex: serializes access to @global_ids
* @global_ids: FF-A shared memory global handle translation
* @notif_wq: workqueue for FF-A asynchronous notification
* @notif_work: work for FF-A asynchronous notification
*/
struct optee_ffa {
struct ffa_device *ffa_dev;
@ -222,26 +224,32 @@ struct optee_ops {
/**
* struct optee - main service struct
* @supp_teedev: supplicant device
* @teedev: client device
* @ops: internal callbacks for different ways to reach secure
* world
* @ctx: driver internal TEE context
* @smc: specific to SMC ABI
* @ffa: specific to FF-A ABI
* @call_queue: queue of threads waiting to call @invoke_fn
* @notif: notification synchronization struct
* @supp: supplicant synchronization struct for RPC to supplicant
* @pool: shared memory pool
* @mutex: mutex protecting @rpmb_dev
* @rpmb_dev: current RPMB device or NULL
* @rpmb_scan_bus_done flag if device registation of RPMB dependent devices
* was already done
* @rpmb_scan_bus_work workq to for an RPMB device and to scan optee bus
* and register RPMB dependent optee drivers
* @rpc_param_count: If > 0 number of RPC parameters to make room for
* @scan_bus_done flag if device registation was already done.
* @scan_bus_work workq to scan optee bus and register optee drivers
* @supp_teedev: supplicant device
* @teedev: client device
* @ops: internal callbacks for different ways to reach
* secure world
* @ctx: driver internal TEE context
* @smc: specific to SMC ABI
* @ffa: specific to FF-A ABI
* @shm_arg_cache: shared memory cache argument
* @call_queue: queue of threads waiting to call @invoke_fn
* @notif: notification synchronization struct
* @supp: supplicant synchronization struct for RPC to
* supplicant
* @pool: shared memory pool
* @rpmb_dev_mutex: mutex protecting @rpmb_dev
* @rpmb_dev: current RPMB device or NULL
* @rpmb_intf: RPMB notifier block
* @rpc_param_count: if > 0 number of RPC parameters to make room for
* @scan_bus_done: flag if device registation was already done
* @rpmb_scan_bus_done: flag if device registation of RPMB dependent
* devices was already done
* @in_kernel_rpmb_routing: flag if OP-TEE supports in-kernel RPMB routing
* @scan_bus_work: workq to scan optee bus and register optee
* drivers
* @rpmb_scan_bus_work: workq to for an RPMB device and to scan optee
* bus and register RPMB dependent optee drivers
* @revision: OP-TEE OS revision
*/
struct optee {
struct tee_device *supp_teedev;