arch/x86/kernel/cpu/vmware.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/cpu/vmware.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/cpu/vmware.c- Extension
.c- Size
- 15177 bytes
- Lines
- 596
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dmi.hlinux/init.hlinux/export.hlinux/clocksource.hlinux/cpu.hlinux/efi.hlinux/reboot.hlinux/static_call.hlinux/sched/cputime.hasm/div64.hasm/x86_init.hasm/hypervisor.hasm/cpuid/api.hasm/timer.hasm/apic.hasm/vmware.hasm/svm.h
Detected Declarations
struct vmware_steal_timefunction vmware_hypercall_slowfunction __vmware_platformfunction vmware_get_tsc_khzfunction setup_vmw_sched_clockfunction parse_no_stealaccfunction vmware_sched_clockfunction vmware_cyc2ns_setupfunction vmware_cmd_stealclockfunction stealclock_enablefunction __stealclock_disablefunction stealclock_disablefunction vmware_is_stealclock_availablefunction vmware_steal_clockfunction vmware_register_steal_timefunction vmware_disable_steal_timefunction vmware_guest_cpu_initfunction vmware_pv_guest_cpu_rebootfunction vmware_pv_reboot_notifyfunction vmware_smp_prepare_boot_cpufunction vmware_cpu_onlinefunction vmware_cpu_down_preparefunction activate_jump_labelsfunction vmware_paravirt_ops_setupfunction vmware_set_capabilitiesfunction vmware_platform_setupfunction vmware_select_hypercallfunction vmware_platformfunction vmware_legacy_x2apic_availablefunction vmware_tdx_hypercallfunction vmware_sev_es_hcall_preparefunction vmware_sev_es_hcall_finishexport vmware_tdx_hypercall
Annotated Snippet
struct vmware_steal_time {
union {
u64 clock; /* stolen time counter in units of vtsc */
struct {
/* only for little-endian */
u32 clock_low;
u32 clock_high;
};
};
u64 reserved[7];
};
static unsigned long vmware_tsc_khz __ro_after_init;
static u8 vmware_hypercall_mode __ro_after_init;
unsigned long vmware_hypercall_slow(unsigned long cmd,
unsigned long in1, unsigned long in3,
unsigned long in4, unsigned long in5,
u32 *out1, u32 *out2, u32 *out3,
u32 *out4, u32 *out5)
{
unsigned long out0, rbx, rcx, rdx, rsi, rdi;
switch (vmware_hypercall_mode) {
case CPUID_VMWARE_FEATURES_ECX_VMCALL:
asm_inline volatile ("vmcall"
: "=a" (out0), "=b" (rbx), "=c" (rcx),
"=d" (rdx), "=S" (rsi), "=D" (rdi)
: "a" (VMWARE_HYPERVISOR_MAGIC),
"b" (in1),
"c" (cmd),
"d" (in3),
"S" (in4),
"D" (in5)
: "cc", "memory");
break;
case CPUID_VMWARE_FEATURES_ECX_VMMCALL:
asm_inline volatile ("vmmcall"
: "=a" (out0), "=b" (rbx), "=c" (rcx),
"=d" (rdx), "=S" (rsi), "=D" (rdi)
: "a" (VMWARE_HYPERVISOR_MAGIC),
"b" (in1),
"c" (cmd),
"d" (in3),
"S" (in4),
"D" (in5)
: "cc", "memory");
break;
default:
asm_inline volatile ("movw %[port], %%dx; inl (%%dx), %%eax"
: "=a" (out0), "=b" (rbx), "=c" (rcx),
"=d" (rdx), "=S" (rsi), "=D" (rdi)
: [port] "i" (VMWARE_HYPERVISOR_PORT),
"a" (VMWARE_HYPERVISOR_MAGIC),
"b" (in1),
"c" (cmd),
"d" (in3),
"S" (in4),
"D" (in5)
: "cc", "memory");
break;
}
if (out1)
*out1 = rbx;
if (out2)
*out2 = rcx;
if (out3)
*out3 = rdx;
if (out4)
*out4 = rsi;
if (out5)
*out5 = rdi;
return out0;
}
static inline int __vmware_platform(void)
{
u32 eax, ebx, ecx;
eax = vmware_hypercall3(VMWARE_CMD_GETVERSION, 0, &ebx, &ecx);
return eax != UINT_MAX && ebx == VMWARE_HYPERVISOR_MAGIC;
}
static unsigned long vmware_get_tsc_khz(void)
{
return vmware_tsc_khz;
}
Annotation
- Immediate include surface: `linux/dmi.h`, `linux/init.h`, `linux/export.h`, `linux/clocksource.h`, `linux/cpu.h`, `linux/efi.h`, `linux/reboot.h`, `linux/static_call.h`.
- Detected declarations: `struct vmware_steal_time`, `function vmware_hypercall_slow`, `function __vmware_platform`, `function vmware_get_tsc_khz`, `function setup_vmw_sched_clock`, `function parse_no_stealacc`, `function vmware_sched_clock`, `function vmware_cyc2ns_setup`, `function vmware_cmd_stealclock`, `function stealclock_enable`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: integration 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.