include/linux/pci-tsm.h
Source file repositories/reference/linux-study-clean/include/linux/pci-tsm.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/pci-tsm.h- Extension
.h- Size
- 8470 bytes
- Lines
- 244
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mutex.hlinux/pci.hlinux/sockptr.h
Detected Declarations
struct pci_tsmstruct tsm_devstruct kvmstruct pci_tsm_opsstruct pci_tdistruct pci_tsmstruct pci_tsm_pf0enum pci_tsm_req_scopeenum pci_tsm_req_scopefunction is_pci_tsm_pf0function Managerfunction pci_tsm_registerfunction pci_tsm_unregisterfunction pci_tsm_unbind
Annotated Snippet
struct pci_tsm_ops {
/*
* struct pci_tsm_link_ops - Manage physical link and the TSM/DSM session
* @probe: establish context with the TSM (allocate / wrap 'struct
* pci_tsm') for follow-on link operations
* @remove: destroy link operations context
* @connect: establish / validate a secure connection (e.g. IDE)
* with the device
* @disconnect: teardown the secure link
* @bind: bind a TDI in preparation for it to be accepted by a TVM
* @unbind: remove a TDI from secure operation with a TVM
* @guest_req: marshal TVM information and state change requests
*
* Context: @probe, @remove, @connect, and @disconnect run under
* pci_tsm_rwsem held for write to sync with TSM unregistration and
* mutual exclusion of @connect and @disconnect. @connect and
* @disconnect additionally run under the DSM lock (struct
* pci_tsm_pf0::lock) as well as @probe and @remove of the subfunctions.
* @bind, @unbind, and @guest_req run under pci_tsm_rwsem held for read
* and the DSM lock.
*/
struct_group_tagged(pci_tsm_link_ops, link_ops,
struct pci_tsm *(*probe)(struct tsm_dev *tsm_dev,
struct pci_dev *pdev);
void (*remove)(struct pci_tsm *tsm);
int (*connect)(struct pci_dev *pdev);
void (*disconnect)(struct pci_dev *pdev);
struct pci_tdi *(*bind)(struct pci_dev *pdev,
struct kvm *kvm, u32 tdi_id);
void (*unbind)(struct pci_tdi *tdi);
ssize_t (*guest_req)(struct pci_tdi *tdi,
enum pci_tsm_req_scope scope,
sockptr_t req_in, size_t in_len,
sockptr_t req_out, size_t out_len,
u64 *tsm_code);
);
/*
* struct pci_tsm_devsec_ops - Manage the security state of the function
* @lock: establish context with the TSM (allocate / wrap 'struct
* pci_tsm') for follow-on security state transitions from the
* LOCKED state
* @unlock: destroy TSM context and return device to UNLOCKED state
*
* Context: @lock and @unlock run under pci_tsm_rwsem held for write to
* sync with TSM unregistration and each other
*/
struct_group_tagged(pci_tsm_devsec_ops, devsec_ops,
struct pci_tsm *(*lock)(struct tsm_dev *tsm_dev,
struct pci_dev *pdev);
void (*unlock)(struct pci_tsm *tsm);
);
};
/**
* struct pci_tdi - Core TEE I/O Device Interface (TDI) context
* @pdev: host side representation of guest-side TDI
* @kvm: TEE VM context of bound TDI
* @tdi_id: Identifier (virtual BDF) for the TDI as referenced by the TSM and DSM
*/
struct pci_tdi {
struct pci_dev *pdev;
struct kvm *kvm;
u32 tdi_id;
};
/**
* struct pci_tsm - Core TSM context for a given PCIe endpoint
* @pdev: Back ref to device function, distinguishes type of pci_tsm context
* @dsm_dev: PCI Device Security Manager for link operations on @pdev
* @tsm_dev: PCI TEE Security Manager device for Link Confidentiality or Device
* Function Security operations
* @tdi: TDI context established by the @bind link operation
*
* This structure is wrapped by low level TSM driver data and returned by
* probe()/lock(), it is freed by the corresponding remove()/unlock().
*
* For link operations it serves to cache the association between a Device
* Security Manager (DSM) and the functions that manager can assign to a TVM.
* That can be "self", for assigning function0 of a TEE I/O device, a
* sub-function (SR-IOV virtual function, or non-function0
* multifunction-device), or a downstream endpoint (PCIe upstream switch-port as
* DSM).
*/
struct pci_tsm {
struct pci_dev *pdev;
struct pci_dev *dsm_dev;
struct tsm_dev *tsm_dev;
struct pci_tdi *tdi;
};
Annotation
- Immediate include surface: `linux/mutex.h`, `linux/pci.h`, `linux/sockptr.h`.
- Detected declarations: `struct pci_tsm`, `struct tsm_dev`, `struct kvm`, `struct pci_tsm_ops`, `struct pci_tdi`, `struct pci_tsm`, `struct pci_tsm_pf0`, `enum pci_tsm_req_scope`, `enum pci_tsm_req_scope`, `function is_pci_tsm_pf0`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.