diff options
Diffstat (limited to 'usr/src/uts/intel/sys')
-rw-r--r-- | usr/src/uts/intel/sys/vmm.h | 47 | ||||
-rw-r--r-- | usr/src/uts/intel/sys/vmm_dev.h | 22 |
2 files changed, 68 insertions, 1 deletions
diff --git a/usr/src/uts/intel/sys/vmm.h b/usr/src/uts/intel/sys/vmm.h index 50d76ab17c..45e0fe8f34 100644 --- a/usr/src/uts/intel/sys/vmm.h +++ b/usr/src/uts/intel/sys/vmm.h @@ -406,4 +406,51 @@ enum vm_create_flags { VCF_RESERVOIR_MEM = (1 << 0), }; +/* + * Describes an entry for `cpuid` emulation. + * Used internally by bhyve (kernel) in addition to exposed ioctl(2) interface. + */ +struct vcpu_cpuid_entry { + uint32_t vce_function; + uint32_t vce_index; + uint32_t vce_flags; + uint32_t vce_eax; + uint32_t vce_ebx; + uint32_t vce_ecx; + uint32_t vce_edx; + uint32_t _pad; +}; + +/* + * Defined flags for vcpu_cpuid_entry`vce_flags are below. + */ + +/* Use index (ecx) input value when matching entry */ +#define VCE_FLAG_MATCH_INDEX (1 << 0) + +/* All valid flacts for vcpu_cpuid_entry`vce_flags */ +#define VCE_FLAGS_VALID VCE_FLAG_MATCH_INDEX + +/* + * Defined flags for vcpu_cpuid configuration are below. + * These are used by both the ioctl(2) interface via vm_vcpu_cpuid_config and + * internally in the kernel vmm. + */ + +/* Use legacy hard-coded cpuid masking tables applied to the host CPU */ +#define VCC_FLAG_LEGACY_HANDLING (1 << 0) +/* + * Emulate Intel-style fallback behavior (emit highest "standard" entry) if the + * queried function/index do not match. If not set, emulate AMD-style, where + * all zeroes are returned in such cases. + */ +#define VCC_FLAG_INTEL_FALLBACK (1 << 1) + +/* All valid flacts for vm_vcpu_cpuid_config`vvcc_flags */ +#define VCC_FLAGS_VALID \ + (VCC_FLAG_LEGACY_HANDLING | VCC_FLAG_INTEL_FALLBACK) + +/* Maximum vcpu_cpuid_entry records per vCPU */ +#define VMM_MAX_CPUID_ENTRIES 256 + #endif /* _VMM_H_ */ diff --git a/usr/src/uts/intel/sys/vmm_dev.h b/usr/src/uts/intel/sys/vmm_dev.h index b8c87217b4..80b8c2d7ba 100644 --- a/usr/src/uts/intel/sys/vmm_dev.h +++ b/usr/src/uts/intel/sys/vmm_dev.h @@ -370,6 +370,23 @@ struct vm_data_xfer { void *vdx_data; }; +struct vm_vcpu_cpuid_config { + int vvcc_vcpuid; + uint32_t vvcc_flags; + uint32_t vvcc_nent; + uint32_t _pad; + void *vvcc_entries; +}; + +/* Query the computed legacy cpuid value for a vcpuid with VM_LEGACY_CPUID */ +struct vm_legacy_cpuid { + int vlc_vcpuid; + uint32_t vlc_eax; + uint32_t vlc_ebx; + uint32_t vlc_ecx; + uint32_t vlc_edx; +}; + /* * VMM Interface Version * @@ -385,7 +402,7 @@ struct vm_data_xfer { * best-effort activity. Nothing is to be inferred about the magnitude of a * change when the version is modified. It follows no rules like semver. */ -#define VMM_CURRENT_INTERFACE_VERSION 4 +#define VMM_CURRENT_INTERFACE_VERSION 5 #define VMMCTL_IOC_BASE (('V' << 16) | ('M' << 8)) @@ -431,6 +448,9 @@ struct vm_data_xfer { #define VM_SET_RUN_STATE (VMM_CPU_IOC_BASE | 0x18) #define VM_GET_FPU (VMM_CPU_IOC_BASE | 0x19) #define VM_SET_FPU (VMM_CPU_IOC_BASE | 0x1a) +#define VM_GET_CPUID (VMM_CPU_IOC_BASE | 0x1b) +#define VM_SET_CPUID (VMM_CPU_IOC_BASE | 0x1c) +#define VM_LEGACY_CPUID (VMM_CPU_IOC_BASE | 0x1d) /* Operations requiring write-locking the VM */ #define VM_REINIT (VMM_LOCK_IOC_BASE | 0x01) |