include/linux/tpm_svsm.h
Source file repositories/reference/linux-study-clean/include/linux/tpm_svsm.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/tpm_svsm.h- Extension
.h- Size
- 4734 bytes
- Lines
- 150
- 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/errno.hlinux/string.hlinux/types.h
Detected Declarations
struct svsm_vtpm_requeststruct svsm_vtpm_responsestruct svsm_vtpm_cmd_requeststruct svsm_vtpm_cmd_responsefunction svsm_vtpm_cmd_request_fillfunction svsm_vtpm_cmd_response_parse
Annotated Snippet
struct svsm_vtpm_request {
u32 cmd;
};
/**
* struct svsm_vtpm_response - Generic response
* @size: The response size (zero if nothing follows)
*
* Defined by AMD SVSM spec [1] in section "8.2 SVSM_VTPM_CMD Call" -
* Table 15: vTPM Common Request/Response Structure
* Byte Size In/Out Description
* Offset (Bytes)
* 0x000 4 In Platform command
* Out Platform command response size
*
* Note: most TCG Simulator commands simply return zero here with no indication
* of success or failure.
*/
struct svsm_vtpm_response {
u32 size;
};
/**
* struct svsm_vtpm_cmd_request - Structure for a TPM_SEND_COMMAND request
* @cmd: The command to send (must be TPM_SEND_COMMAND)
* @locality: The locality
* @buf_size: The size of the input buffer following
* @buf: A buffer of size buf_size
*
* Defined by AMD SVSM spec [1] in section "8.2 SVSM_VTPM_CMD Call" -
* Table 16: TPM_SEND_COMMAND Request Structure
* Byte Size Meaning
* Offset (Bytes)
* 0x000 4 Platform command (8)
* 0x004 1 Locality (must-be-0)
* 0x005 4 TPM Command size (in bytes)
* 0x009 Variable TPM Command
*
* Note: the TCG Simulator expects @buf_size to be equal to the size of the
* specific TPM command, otherwise an TPM_RC_COMMAND_SIZE error is returned.
*/
struct svsm_vtpm_cmd_request {
u32 cmd;
u8 locality;
u32 buf_size;
u8 buf[];
} __packed;
/**
* struct svsm_vtpm_cmd_response - Structure for a TPM_SEND_COMMAND response
* @buf_size: The size of the output buffer following
* @buf: A buffer of size buf_size
*
* Defined by AMD SVSM spec [1] in section "8.2 SVSM_VTPM_CMD Call" -
* Table 17: TPM_SEND_COMMAND Response Structure
* Byte Size Meaning
* Offset (Bytes)
* 0x000 4 Response size (in bytes)
* 0x004 Variable Response
*/
struct svsm_vtpm_cmd_response {
u32 buf_size;
u8 buf[];
};
/**
* svsm_vtpm_cmd_request_fill() - Fill a TPM_SEND_COMMAND request to be sent to SVSM
* @req: The struct svsm_vtpm_cmd_request to fill
* @locality: The locality
* @buf: The buffer from where to copy the payload of the command
* @len: The size of the buffer
*
* Return: 0 on success, negative error code on failure.
*/
static inline int
svsm_vtpm_cmd_request_fill(struct svsm_vtpm_cmd_request *req, u8 locality,
const u8 *buf, size_t len)
{
if (len > SVSM_VTPM_MAX_BUFFER - sizeof(*req))
return -EINVAL;
req->cmd = 8; /* TPM_SEND_COMMAND */
req->locality = locality;
req->buf_size = len;
memcpy(req->buf, buf, len);
return 0;
}
Annotation
- Immediate include surface: `linux/errno.h`, `linux/string.h`, `linux/types.h`.
- Detected declarations: `struct svsm_vtpm_request`, `struct svsm_vtpm_response`, `struct svsm_vtpm_cmd_request`, `struct svsm_vtpm_cmd_response`, `function svsm_vtpm_cmd_request_fill`, `function svsm_vtpm_cmd_response_parse`.
- 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.