Skip to content

Instantly share code, notes, and snippets.

@tsangwpx
Last active November 12, 2024 07:02
Show Gist options
  • Save tsangwpx/414eac56a0e14119bbfca5ef133d3576 to your computer and use it in GitHub Desktop.
Save tsangwpx/414eac56a0e14119bbfca5ef133d3576 to your computer and use it in GitHub Desktop.
VirtualBox CPUID flags
~# cat /proc/cpuinfo

processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 23
model           : 113
model name      : AMD Ryzen 9 3900X 12-Core Processor
stepping        : 0
microcode       : 0xffffffff
cpu MHz         : 3792.882
cache size      : 512 KB
physical id     : 0
siblings        : 6
core id         : 0
cpu cores       : 6
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx fxsr_opt rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid tsc_known_freq pni ssse3 sse4_1 sse4_2 movbe popcnt aes hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a 3dnowprefetch ssbd vmmcall fsgsbase arat
bugs            : fxsave_leak sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass
bogomips        : 7585.76
TLB size        : 3072 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 48 bits physical, 48 bits virtual
power management:

VirtualBox may expose less features to guests. Say, avx2 is still missing.

After digging in the code, use the following to forcedly enable a flag.

VBoxManage setextradata VMName VBoxInternal/CPUM/SSE4.2 1

The full list is available around CFGMR3ValidateConfig(pIsaExts, "/CPUM/IsaExts/", in src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp

The current list (v6.1.22) is

  • 3DNOWPRF
  • ABM
  • AESNI
  • AVX
  • AVX2
  • AXMMX
  • CLFLUSHOPT
  • CMPXCHG16B
  • FSGSBASE
  • FlushCmdMsr
  • INVPCID
  • MISALNSSE
  • MONITOR
  • MOVBE
  • MWaitExtensions
  • PCID
  • PCLMUL
  • POPCNT
  • RDRAND
  • RDSEED
  • SSE4.1
  • SSE4.2
  • SSE4A
  • XSAVE

There are checks (same file) to determine whether a feature is actually exposed to the guest. For example, avx2 requires xsave, and xsave requires unrestricted guest execution mode, which is currently unavailable under Windows Virtualization Platform. A few grep-ing around the code is required to obtain the answers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment