drivers/crypto/ccp/sev-dev-tio.c
Source file repositories/reference/linux-study-clean/drivers/crypto/ccp/sev-dev-tio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/ccp/sev-dev-tio.c- Extension
.c- Size
- 22086 bytes
- Lines
- 865
- Domain
- Driver Families
- Bucket
- drivers/crypto
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.hlinux/tsm.hlinux/psp.hlinux/vmalloc.hlinux/bitfield.hlinux/pci-doe.hasm/sev-common.hasm/sev.hasm/page.hsev-dev.hsev-dev-tio.h
Detected Declarations
struct sla_buffer_hdrstruct spdm_dobj_hdr_reqstruct spdm_dobj_hdr_respstruct spdm_dobj_hdr_certstruct spdm_dobj_hdr_measstruct spdm_dobj_hdr_reportstruct spdm_ctrlstruct sev_data_tio_statusstruct sev_data_tio_initstruct sev_data_tio_dev_createstruct sev_data_tio_dev_connectstruct sev_data_tio_dev_disconnectstruct sev_data_tio_dev_measstruct sev_data_tio_dev_certsstruct sev_data_tio_dev_reclaimenum spdm_data_type_tfunction sla_to_pafunction make_slafunction sla_dobj_id_to_sizefunction sla_to_dobj_hdr_checkfunction sla_buffer_unmapfunction dobj_response_initfunction sla_freefunction sla_allocfunction sla_expandfunction sev_tio_do_cmdfunction sev_tio_continuefunction spdm_ctrl_initfunction spdm_ctrl_freefunction spdm_ctrl_allocfunction sev_tio_init_lockedfunction sev_tio_dev_createfunction sev_tio_dev_reclaimfunction sev_tio_dev_connectfunction sev_tio_dev_disconnectfunction sev_tio_cmd_buffer_len
Annotated Snippet
struct sla_buffer_hdr {
u32 capacity_sz;
u32 payload_sz; /* The size of BUFFER_PAYLOAD in bytes. Must be multiple of 32B */
u32 flags;
u8 reserved1[4];
u8 iv[16]; /* IV used for the encryption of this buffer */
u8 authtag[16]; /* Authentication tag for this buffer */
u8 reserved2[16];
} __packed;
enum spdm_data_type_t {
DOBJ_DATA_TYPE_SPDM = 0x1,
DOBJ_DATA_TYPE_SECURE_SPDM = 0x2,
};
struct spdm_dobj_hdr_req {
struct spdm_dobj_hdr hdr; /* hdr.id == SPDM_DOBJ_ID_REQ */
u8 data_type; /* spdm_data_type_t */
u8 reserved2[5];
} __packed;
struct spdm_dobj_hdr_resp {
struct spdm_dobj_hdr hdr; /* hdr.id == SPDM_DOBJ_ID_RESP */
u8 data_type; /* spdm_data_type_t */
u8 reserved2[5];
} __packed;
/* Defined in sev-dev-tio.h so sev-dev-tsm.c can read types of blobs */
struct spdm_dobj_hdr_cert;
struct spdm_dobj_hdr_meas;
struct spdm_dobj_hdr_report;
/* Used in all SPDM-aware TIO commands */
struct spdm_ctrl {
struct sla_addr_t req;
struct sla_addr_t resp;
struct sla_addr_t scratch;
struct sla_addr_t output;
} __packed;
static size_t sla_dobj_id_to_size(u8 id)
{
size_t n;
BUILD_BUG_ON(sizeof(struct spdm_dobj_hdr_resp) != 0x10);
switch (id) {
case SPDM_DOBJ_ID_REQ:
n = sizeof(struct spdm_dobj_hdr_req);
break;
case SPDM_DOBJ_ID_RESP:
n = sizeof(struct spdm_dobj_hdr_resp);
break;
default:
WARN_ON(1);
n = 0;
break;
}
return n;
}
#define SPDM_DOBJ_HDR_SIZE(hdr) sla_dobj_id_to_size((hdr)->id)
#define SPDM_DOBJ_DATA(hdr) ((u8 *)(hdr) + SPDM_DOBJ_HDR_SIZE(hdr))
#define SPDM_DOBJ_LEN(hdr) ((hdr)->length - SPDM_DOBJ_HDR_SIZE(hdr))
#define sla_to_dobj_resp_hdr(buf) ((struct spdm_dobj_hdr_resp *) \
sla_to_dobj_hdr_check((buf), SPDM_DOBJ_ID_RESP))
#define sla_to_dobj_req_hdr(buf) ((struct spdm_dobj_hdr_req *) \
sla_to_dobj_hdr_check((buf), SPDM_DOBJ_ID_REQ))
static struct spdm_dobj_hdr *sla_to_dobj_hdr(struct sla_buffer_hdr *buf)
{
if (!buf)
return NULL;
return (struct spdm_dobj_hdr *) &buf[1];
}
static struct spdm_dobj_hdr *sla_to_dobj_hdr_check(struct sla_buffer_hdr *buf, u32 check_dobjid)
{
struct spdm_dobj_hdr *hdr = sla_to_dobj_hdr(buf);
if (WARN_ON_ONCE(!hdr))
return NULL;
if (hdr->id != check_dobjid) {
pr_err("! ERROR: expected %d, found %d\n", check_dobjid, hdr->id);
return NULL;
}
Annotation
- Immediate include surface: `linux/pci.h`, `linux/tsm.h`, `linux/psp.h`, `linux/vmalloc.h`, `linux/bitfield.h`, `linux/pci-doe.h`, `asm/sev-common.h`, `asm/sev.h`.
- Detected declarations: `struct sla_buffer_hdr`, `struct spdm_dobj_hdr_req`, `struct spdm_dobj_hdr_resp`, `struct spdm_dobj_hdr_cert`, `struct spdm_dobj_hdr_meas`, `struct spdm_dobj_hdr_report`, `struct spdm_ctrl`, `struct sev_data_tio_status`, `struct sev_data_tio_init`, `struct sev_data_tio_dev_create`.
- Atlas domain: Driver Families / drivers/crypto.
- 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.