arch/x86/virt/vmx/tdx/tdx_global_metadata.c
Source file repositories/reference/linux-study-clean/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/virt/vmx/tdx/tdx_global_metadata.c- Extension
.c- Size
- 4411 bytes
- Lines
- 134
- 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
- No C-style include directives detected by the generator.
Detected Declarations
function get_tdx_sys_info_versionfunction get_tdx_sys_info_featuresfunction get_tdx_sys_info_tdmrfunction get_tdx_sys_info_td_ctrlfunction get_tdx_sys_info_td_conffunction get_tdx_sys_info_handofffunction get_tdx_sys_info
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Automatically generated functions to read TDX global metadata.
*
* This file doesn't compile on its own as it lacks of inclusion
* of SEAMCALL wrapper primitive which reads global metadata.
* Include this file to other C file instead.
*/
static int get_tdx_sys_info_version(struct tdx_sys_info_version *sysinfo_version)
{
int ret = 0;
u64 val;
if (!ret && !(ret = read_sys_metadata_field(0x0800000100000003, &val)))
sysinfo_version->minor_version = val;
if (!ret && !(ret = read_sys_metadata_field(0x0800000100000004, &val)))
sysinfo_version->major_version = val;
if (!ret && !(ret = read_sys_metadata_field(0x0800000100000005, &val)))
sysinfo_version->update_version = val;
return ret;
}
static __init int get_tdx_sys_info_features(struct tdx_sys_info_features *sysinfo_features)
{
int ret = 0;
u64 val;
if (!ret && !(ret = read_sys_metadata_field(0x0A00000300000008, &val)))
sysinfo_features->tdx_features0 = val;
return ret;
}
static __init int get_tdx_sys_info_tdmr(struct tdx_sys_info_tdmr *sysinfo_tdmr)
{
int ret = 0;
u64 val;
if (!ret && !(ret = read_sys_metadata_field(0x9100000100000008, &val)))
sysinfo_tdmr->max_tdmrs = val;
if (!ret && !(ret = read_sys_metadata_field(0x9100000100000009, &val)))
sysinfo_tdmr->max_reserved_per_tdmr = val;
if (!ret && !(ret = read_sys_metadata_field(0x9100000100000010, &val)))
sysinfo_tdmr->pamt_4k_entry_size = val;
if (!ret && !(ret = read_sys_metadata_field(0x9100000100000011, &val)))
sysinfo_tdmr->pamt_2m_entry_size = val;
if (!ret && !(ret = read_sys_metadata_field(0x9100000100000012, &val)))
sysinfo_tdmr->pamt_1g_entry_size = val;
return ret;
}
static __init int get_tdx_sys_info_td_ctrl(struct tdx_sys_info_td_ctrl *sysinfo_td_ctrl)
{
int ret = 0;
u64 val;
if (!ret && !(ret = read_sys_metadata_field(0x9800000100000000, &val)))
sysinfo_td_ctrl->tdr_base_size = val;
if (!ret && !(ret = read_sys_metadata_field(0x9800000100000100, &val)))
sysinfo_td_ctrl->tdcs_base_size = val;
if (!ret && !(ret = read_sys_metadata_field(0x9800000100000200, &val)))
sysinfo_td_ctrl->tdvps_base_size = val;
return ret;
}
static __init int get_tdx_sys_info_td_conf(struct tdx_sys_info_td_conf *sysinfo_td_conf)
{
int ret = 0;
u64 val;
int i, j;
if (!ret && !(ret = read_sys_metadata_field(0x1900000300000000, &val)))
sysinfo_td_conf->attributes_fixed0 = val;
if (!ret && !(ret = read_sys_metadata_field(0x1900000300000001, &val)))
sysinfo_td_conf->attributes_fixed1 = val;
if (!ret && !(ret = read_sys_metadata_field(0x1900000300000002, &val)))
sysinfo_td_conf->xfam_fixed0 = val;
if (!ret && !(ret = read_sys_metadata_field(0x1900000300000003, &val)))
sysinfo_td_conf->xfam_fixed1 = val;
if (!ret && !(ret = read_sys_metadata_field(0x9900000100000004, &val)))
sysinfo_td_conf->num_cpuid_config = val;
if (!ret && !(ret = read_sys_metadata_field(0x9900000100000008, &val)))
sysinfo_td_conf->max_vcpus_per_td = val;
if (sysinfo_td_conf->num_cpuid_config > ARRAY_SIZE(sysinfo_td_conf->cpuid_config_leaves))
return -EINVAL;
for (i = 0; i < sysinfo_td_conf->num_cpuid_config; i++)
Annotation
- Detected declarations: `function get_tdx_sys_info_version`, `function get_tdx_sys_info_features`, `function get_tdx_sys_info_tdmr`, `function get_tdx_sys_info_td_ctrl`, `function get_tdx_sys_info_td_conf`, `function get_tdx_sys_info_handoff`, `function get_tdx_sys_info`.
- 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.