drivers/tee/amdtee/amdtee_private.h
Source file repositories/reference/linux-study-clean/drivers/tee/amdtee/amdtee_private.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/tee/amdtee/amdtee_private.h- Extension
.h- Size
- 4272 bytes
- Lines
- 157
- Domain
- Driver Families
- Bucket
- drivers/tee
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mutex.hlinux/spinlock.hlinux/tee_core.hlinux/kref.hlinux/types.hamdtee_if.h
Detected Declarations
struct amdteestruct amdtee_sessionstruct amdtee_context_datastruct amdtee_driver_datastruct shmem_descstruct amdtee_ta_datafunction set_session_idfunction get_ta_handlefunction get_session_index
Annotated Snippet
struct amdtee {
struct tee_device *teedev;
struct tee_shm_pool *pool;
};
/**
* struct amdtee_session - Trusted Application (TA) session related information.
* @ta_handle: handle to Trusted Application (TA) loaded in TEE environment
* @refcount: counter to keep track of sessions opened for the TA instance
* @session_info: an array pointing to TA allocated session data.
* @sess_mask: session usage bit-mask. If a particular bit is set, then the
* corresponding @session_info entry is in use or valid.
*
* Session structure is updated on open_session and this information is used for
* subsequent operations with the Trusted Application.
*/
struct amdtee_session {
struct list_head list_node;
u32 ta_handle;
struct kref refcount;
u32 session_info[TEE_NUM_SESSIONS];
DECLARE_BITMAP(sess_mask, TEE_NUM_SESSIONS);
spinlock_t lock; /* synchronizes access to @sess_mask */
};
/**
* struct amdtee_context_data - AMD-TEE driver context data
* @sess_list: Keeps track of sessions opened in current TEE context
*/
struct amdtee_context_data {
struct list_head sess_list;
};
struct amdtee_driver_data {
struct amdtee *amdtee;
};
struct shmem_desc {
void *kaddr;
u64 size;
};
/**
* struct amdtee_ta_data - Keeps track of all TAs loaded in AMD Secure
* Processor
* @ta_handle: Handle to TA loaded in TEE
* @refcount: Reference count for the loaded TA
*/
struct amdtee_ta_data {
struct list_head list_node;
u32 ta_handle;
u32 refcount;
};
#define LOWER_TWO_BYTE_MASK 0x0000FFFF
/**
* set_session_id() - Sets the session identifier.
* @ta_handle: [in] handle of the loaded Trusted Application (TA)
* @session_index: [in] Session index. Range: 0 to (TEE_NUM_SESSIONS - 1).
* @session: [out] Pointer to session id
*
* Lower two bytes of the session identifier represents the TA handle and the
* upper two bytes is session index.
*/
static inline void set_session_id(u32 ta_handle, u32 session_index,
u32 *session)
{
*session = (session_index << 16) | (LOWER_TWO_BYTE_MASK & ta_handle);
}
static inline u32 get_ta_handle(u32 session)
{
return session & LOWER_TWO_BYTE_MASK;
}
static inline u32 get_session_index(u32 session)
{
return (session >> 16) & LOWER_TWO_BYTE_MASK;
}
int amdtee_open_session(struct tee_context *ctx,
struct tee_ioctl_open_session_arg *arg,
struct tee_param *param);
int amdtee_close_session(struct tee_context *ctx, u32 session);
int amdtee_invoke_func(struct tee_context *ctx,
struct tee_ioctl_invoke_arg *arg,
struct tee_param *param);
Annotation
- Immediate include surface: `linux/mutex.h`, `linux/spinlock.h`, `linux/tee_core.h`, `linux/kref.h`, `linux/types.h`, `amdtee_if.h`.
- Detected declarations: `struct amdtee`, `struct amdtee_session`, `struct amdtee_context_data`, `struct amdtee_driver_data`, `struct shmem_desc`, `struct amdtee_ta_data`, `function set_session_id`, `function get_ta_handle`, `function get_session_index`.
- Atlas domain: Driver Families / drivers/tee.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.