arch/x86/include/asm/sev.h
Source file repositories/reference/linux-study-clean/arch/x86/include/asm/sev.h
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/include/asm/sev.h- Extension
.h- Size
- 18669 bytes
- Lines
- 687
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/sev-guest.hasm/insn.hasm/sev-common.hasm/coco.hasm/set_memory.hasm/svm.h
Detected Declarations
struct boot_paramsstruct es_fault_infostruct pt_regsstruct es_em_ctxtstruct cc_blob_sev_infostruct real_mode_headerstruct snp_cpuid_fnstruct snp_cpuid_tablestruct rmp_statestruct snp_req_datastruct snp_guest_msg_hdrstruct snp_guest_msgstruct snp_tsc_info_reqstruct snp_tsc_info_respstruct snp_guest_reqstruct secrets_os_areastruct snp_secrets_pagestruct snp_msg_descstruct svsm_castruct svsm_pvalidate_entrystruct svsm_pvalidate_callstruct svsm_loc_entrystruct svsm_attest_callstruct pte_enc_descstruct svsm_callstruct cpuid_leafstruct psc_descenum es_resultenum stack_typeenum msg_typeenum aead_algofunction lower_bitsfunction sev_es_ist_enterfunction sev_es_ist_exitfunction sev_es_nmi_completefunction privilegedfunction pvalidatefunction vc_ghcb_invalidatefunction sev_evict_cachefunction sev_es_ist_enterfunction sev_es_nmi_completefunction sev_enablefunction rmpadjustfunction setup_ghcbfunction snp_dmi_setupfunction snp_accept_memoryfunction sev_get_statusfunction sev_show_status
Annotated Snippet
struct es_fault_info {
unsigned long vector;
unsigned long error_code;
unsigned long cr2;
};
struct pt_regs;
/* ES instruction emulation context */
struct es_em_ctxt {
struct pt_regs *regs;
struct insn insn;
struct es_fault_info fi;
};
/*
* AMD SEV Confidential computing blob structure. The structure is
* defined in OVMF UEFI firmware header:
* https://github.com/tianocore/edk2/blob/master/OvmfPkg/Include/Guid/ConfidentialComputingSevSnpBlob.h
*/
#define CC_BLOB_SEV_HDR_MAGIC 0x45444d41
struct cc_blob_sev_info {
u32 magic;
u16 version;
u16 reserved;
u64 secrets_phys;
u32 secrets_len;
u32 rsvd1;
u64 cpuid_phys;
u32 cpuid_len;
u32 rsvd2;
} __packed;
void do_vc_no_ghcb(struct pt_regs *regs, unsigned long exit_code);
static inline u64 lower_bits(u64 val, unsigned int bits)
{
u64 mask = (1ULL << bits) - 1;
return (val & mask);
}
struct real_mode_header;
enum stack_type;
/* Early IDT entry points for #VC handler */
extern void vc_no_ghcb(void);
extern void vc_boot_ghcb(void);
extern bool handle_vc_boot_ghcb(struct pt_regs *regs);
/*
* Individual entries of the SNP CPUID table, as defined by the SNP
* Firmware ABI, Revision 0.9, Section 7.1, Table 14.
*/
struct snp_cpuid_fn {
u32 eax_in;
u32 ecx_in;
u64 xcr0_in;
u64 xss_in;
u32 eax;
u32 ebx;
u32 ecx;
u32 edx;
u64 __reserved;
} __packed;
/*
* SNP CPUID table, as defined by the SNP Firmware ABI, Revision 0.9,
* Section 8.14.2.6. Also noted there is the SNP firmware-enforced limit
* of 64 entries per CPUID table.
*/
#define SNP_CPUID_COUNT_MAX 64
struct snp_cpuid_table {
u32 count;
u32 __reserved1;
u64 __reserved2;
struct snp_cpuid_fn fn[SNP_CPUID_COUNT_MAX];
} __packed;
/* PVALIDATE return codes */
#define PVALIDATE_FAIL_SIZEMISMATCH 6
/* Software defined (when rFlags.CF = 1) */
#define PVALIDATE_FAIL_NOUPDATE 255
/* RMUPDATE detected 4K page and 2MB page overlap. */
#define RMPUPDATE_FAIL_OVERLAP 4
/* PSMASH failed due to concurrent access by another CPU */
Annotation
- Immediate include surface: `linux/types.h`, `linux/sev-guest.h`, `asm/insn.h`, `asm/sev-common.h`, `asm/coco.h`, `asm/set_memory.h`, `asm/svm.h`.
- Detected declarations: `struct boot_params`, `struct es_fault_info`, `struct pt_regs`, `struct es_em_ctxt`, `struct cc_blob_sev_info`, `struct real_mode_header`, `struct snp_cpuid_fn`, `struct snp_cpuid_table`, `struct rmp_state`, `struct snp_req_data`.
- Atlas domain: Architecture Layer / arch/x86.
- 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.