2 QEMU / KVM CPU model configuration
5 @set qemu_system_x86 qemu-system-x86_64
7 @c man begin DESCRIPTION
10 * recommendations_cpu_models_x86:: Recommendations for KVM CPU model configuration on x86 hosts
11 * recommendations_cpu_models_MIPS:: Supported CPU model configurations on MIPS hosts
12 * cpu_model_syntax_apps:: Syntax for configuring CPU models
15 QEMU / KVM virtualization supports two ways to configure CPU models
19 @item Host passthrough
21 This passes the host CPU model features, model, stepping, exactly to the
22 guest. Note that KVM may filter out some host CPU model features if they
23 cannot be supported with virtualization. Live migration is unsafe when
24 this mode is used as libvirt / QEMU cannot guarantee a stable CPU is
25 exposed to the guest across hosts. This is the recommended CPU to use,
26 provided live migration is not required.
30 QEMU comes with a number of predefined named CPU models, that typically
31 refer to specific generations of hardware released by Intel and AMD.
32 These allow the guest VMs to have a degree of isolation from the host CPU,
33 allowing greater flexibility in live migrating between hosts with differing
37 In both cases, it is possible to optionally add or remove individual CPU
38 features, to alter what is presented to the guest by default.
40 Libvirt supports a third way to configure CPU models known as "Host model".
41 This uses the QEMU "Named model" feature, automatically picking a CPU model
42 that is similar the host CPU, and then adding extra features to approximate
43 the host model as closely as possible. This does not guarantee the CPU family,
44 stepping, etc will precisely match the host CPU, as they would with "Host
45 passthrough", but gives much of the benefit of passthrough, while making
48 @node recommendations_cpu_models_x86
49 @subsection Recommendations for KVM CPU model configuration on x86 hosts
51 The information that follows provides recommendations for configuring
52 CPU models on x86 hosts. The goals are to maximise performance, while
53 protecting guest OS against various CPU hardware flaws, and optionally
54 enabling live migration between hosts with heterogeneous CPU models.
57 * preferred_cpu_models_intel_x86:: Preferred CPU models for Intel x86 hosts
58 * important_cpu_features_intel_x86:: Important CPU features for Intel x86 hosts
59 * preferred_cpu_models_amd_x86:: Preferred CPU models for AMD x86 hosts
60 * important_cpu_features_amd_x86:: Important CPU features for AMD x86 hosts
61 * default_cpu_models_x86:: Default x86 CPU models
62 * other_non_recommended_cpu_models_x86:: Other non-recommended x86 CPUs
65 @node preferred_cpu_models_intel_x86
66 @subsubsection Preferred CPU models for Intel x86 hosts
68 The following CPU models are preferred for use on Intel hosts. Administrators /
69 applications are recommended to use the CPU model that matches the generation
70 of the host CPUs in use. In a deployment with a mixture of host CPU models
71 between machines, if live migration compatibility is required, use the newest
72 CPU model that is compatible across all desired hosts.
75 @item @code{Skylake-Server}
76 @item @code{Skylake-Server-IBRS}
78 Intel Xeon Processor (Skylake, 2016)
81 @item @code{Skylake-Client}
82 @item @code{Skylake-Client-IBRS}
84 Intel Core Processor (Skylake, 2015)
87 @item @code{Broadwell}
88 @item @code{Broadwell-IBRS}
89 @item @code{Broadwell-noTSX}
90 @item @code{Broadwell-noTSX-IBRS}
92 Intel Core Processor (Broadwell, 2014)
96 @item @code{Haswell-IBRS}
97 @item @code{Haswell-noTSX}
98 @item @code{Haswell-noTSX-IBRS}
100 Intel Core Processor (Haswell, 2013)
103 @item @code{IvyBridge}
104 @item @code{IvyBridge-IBRS}
106 Intel Xeon E3-12xx v2 (Ivy Bridge, 2012)
109 @item @code{SandyBridge}
110 @item @code{SandyBridge-IBRS}
112 Intel Xeon E312xx (Sandy Bridge, 2011)
115 @item @code{Westmere}
116 @item @code{Westmere-IBRS}
118 Westmere E56xx/L56xx/X56xx (Nehalem-C, 2010)
122 @item @code{Nehalem-IBRS}
124 Intel Core i7 9xx (Nehalem Class Core i7, 2008)
129 Intel Core 2 Duo P9xxx (Penryn Class Core 2, 2007)
134 Intel Celeron_4x0 (Conroe/Merom Class Core 2, 2006)
138 @node important_cpu_features_intel_x86
139 @subsubsection Important CPU features for Intel x86 hosts
141 The following are important CPU features that should be used on Intel x86
142 hosts, when available in the host CPU. Some of them require explicit
143 configuration to enable, as they are not included by default in some, or all,
144 of the named CPU models listed above. In general all of these features are
145 included if using "Host passthrough" or "Host model".
152 Recommended to mitigate the cost of the Meltdown (CVE-2017-5754) fix
154 Included by default in Haswell, Broadwell & Skylake Intel CPU models.
156 Should be explicitly turned on for Westmere, SandyBridge, and IvyBridge
157 Intel CPU models. Note that some desktop/mobile Westmere CPUs cannot
158 support this feature.
161 @item @code{spec-ctrl}
163 Required to enable the Spectre v2 (CVE-2017-5715) fix.
165 Included by default in Intel CPU models with -IBRS suffix.
167 Must be explicitly turned on for Intel CPU models without -IBRS suffix.
169 Requires the host CPU microcode to support this feature before it
170 can be used for guest CPUs.
175 Required to enable stronger Spectre v2 (CVE-2017-5715) fixes in some
178 Must be explicitly turned on for all Intel CPU models.
180 Requires the host CPU microcode to support this feature before it
181 can be used for guest CPUs.
186 Required to enable the CVE-2018-3639 fix
188 Not included by default in any Intel CPU model.
190 Must be explicitly turned on for all Intel CPU models.
192 Requires the host CPU microcode to support this feature before it
193 can be used for guest CPUs.
198 Recommended to allow guest OS to use 1GB size pages
200 Not included by default in any Intel CPU model.
202 Should be explicitly turned on for all Intel CPU models.
204 Note that not all CPU hardware will support this feature.
206 @item @code{md-clear}
208 Required to confirm the MDS (CVE-2018-12126, CVE-2018-12127, CVE-2018-12130,
209 CVE-2019-11091) fixes.
211 Not included by default in any Intel CPU model.
213 Must be explicitly turned on for all Intel CPU models.
215 Requires the host CPU microcode to support this feature before it
216 can be used for guest CPUs.
220 @node preferred_cpu_models_amd_x86
221 @subsubsection Preferred CPU models for AMD x86 hosts
223 The following CPU models are preferred for use on Intel hosts. Administrators /
224 applications are recommended to use the CPU model that matches the generation
225 of the host CPUs in use. In a deployment with a mixture of host CPU models
226 between machines, if live migration compatibility is required, use the newest
227 CPU model that is compatible across all desired hosts.
232 @item @code{EPYC-IBPB}
234 AMD EPYC Processor (2017)
237 @item @code{Opteron_G5}
239 AMD Opteron 63xx class CPU (2012)
242 @item @code{Opteron_G4}
244 AMD Opteron 62xx class CPU (2011)
247 @item @code{Opteron_G3}
249 AMD Opteron 23xx (Gen 3 Class Opteron, 2009)
252 @item @code{Opteron_G2}
254 AMD Opteron 22xx (Gen 2 Class Opteron, 2006)
257 @item @code{Opteron_G1}
259 AMD Opteron 240 (Gen 1 Class Opteron, 2004)
262 @node important_cpu_features_amd_x86
263 @subsubsection Important CPU features for AMD x86 hosts
265 The following are important CPU features that should be used on AMD x86
266 hosts, when available in the host CPU. Some of them require explicit
267 configuration to enable, as they are not included by default in some, or all,
268 of the named CPU models listed above. In general all of these features are
269 included if using "Host passthrough" or "Host model".
276 Required to enable the Spectre v2 (CVE-2017-5715) fix.
278 Included by default in AMD CPU models with -IBPB suffix.
280 Must be explicitly turned on for AMD CPU models without -IBPB suffix.
282 Requires the host CPU microcode to support this feature before it
283 can be used for guest CPUs.
288 Required to enable stronger Spectre v2 (CVE-2017-5715) fixes in some
291 Must be explicitly turned on for all AMD CPU models.
293 Requires the host CPU microcode to support this feature before it
294 can be used for guest CPUs.
297 @item @code{virt-ssbd}
299 Required to enable the CVE-2018-3639 fix
301 Not included by default in any AMD CPU model.
303 Must be explicitly turned on for all AMD CPU models.
305 This should be provided to guests, even if amd-ssbd is also
306 provided, for maximum guest compatibility.
308 Note for some QEMU / libvirt versions, this must be force enabled
309 when when using "Host model", because this is a virtual feature
310 that doesn't exist in the physical host CPUs.
313 @item @code{amd-ssbd}
315 Required to enable the CVE-2018-3639 fix
317 Not included by default in any AMD CPU model.
319 Must be explicitly turned on for all AMD CPU models.
321 This provides higher performance than virt-ssbd so should be
322 exposed to guests whenever available in the host. virt-ssbd
323 should none the less also be exposed for maximum guest
324 compatibility as some kernels only know about virt-ssbd.
327 @item @code{amd-no-ssb}
329 Recommended to indicate the host is not vulnerable CVE-2018-3639
331 Not included by default in any AMD CPU model.
333 Future hardware generations of CPU will not be vulnerable to
334 CVE-2018-3639, and thus the guest should be told not to enable
335 its mitigations, by exposing amd-no-ssb. This is mutually
336 exclusive with virt-ssbd and amd-ssbd.
341 Recommended to allow guest OS to use 1GB size pages
343 Not included by default in any AMD CPU model.
345 Should be explicitly turned on for all AMD CPU models.
347 Note that not all CPU hardware will support this feature.
351 @node default_cpu_models_x86
352 @subsubsection Default x86 CPU models
354 The default QEMU CPU models are designed such that they can run on all hosts.
355 If an application does not wish to do perform any host compatibility checks
356 before launching guests, the default is guaranteed to work.
358 The default CPU models will, however, leave the guest OS vulnerable to various
359 CPU hardware flaws, so their use is strongly discouraged. Applications should
360 follow the earlier guidance to setup a better CPU configuration, with host
361 passthrough recommended if live migration is not needed.
367 QEMU Virtual CPU version 2.5+ (32 & 64 bit variants)
369 qemu64 is used for x86_64 guests and qemu32 is used for i686 guests, when no
370 -cpu argument is given to QEMU, or no <cpu> is provided in libvirt XML.
374 @node other_non_recommended_cpu_models_x86
375 @subsubsection Other non-recommended x86 CPUs
377 The following CPUs models are compatible with most AMD and Intel x86 hosts, but
378 their usage is discouraged, as they expose a very limited featureset, which
379 prevents guests having optimal performance.
386 Common KVM processor (32 & 64 bit variants)
388 Legacy models just for historical compatibility with ancient QEMU versions.
395 @item @code{core2duo}
398 @item @code{pentium2}
399 @item @code{pentium3}
401 Various very old x86 CPU models, mostly predating the introduction of
402 hardware assisted virtualization, that should thus not be required for
403 running virtual machines.
406 @node recommendations_cpu_models_MIPS
407 @subsection Supported CPU model configurations on MIPS hosts
409 QEMU supports variety of MIPS CPU models:
412 * cpu_models_MIPS32:: Supported CPU models for MIPS32 hosts
413 * cpu_models_MIPS64:: Supported CPU models for MIPS64 hosts
414 * cpu_models_nanoMIPS:: Supported CPU models for nanoMIPS hosts
415 * preferred_cpu_models_MIPS:: Preferred CPU models for MIPS hosts
418 @node cpu_models_MIPS32
419 @subsubsection Supported CPU models for MIPS32 hosts
421 The following CPU models are supported for use on MIPS32 hosts. Administrators /
422 applications are recommended to use the CPU model that matches the generation
423 of the host CPUs in use. In a deployment with a mixture of host CPU models
424 between machines, if live migration compatibility is required, use the newest
425 CPU model that is compatible across all desired hosts.
428 @item @code{mips32r6-generic}
430 MIPS32 Processor (Release 6, 2015)
435 MIPS32 Processor (P5600, 2014)
441 MIPS32 Processor (M14K, 2009)
446 MIPS32 Processor (74K, 2007)
451 MIPS32 Processor (34K, 2006)
458 MIPS32 Processor (24K, 2003)
468 MIPS32 Processor (4K, 1999)
471 @node cpu_models_MIPS64
472 @subsubsection Supported CPU models for MIPS64 hosts
474 The following CPU models are supported for use on MIPS64 hosts. Administrators /
475 applications are recommended to use the CPU model that matches the generation
476 of the host CPUs in use. In a deployment with a mixture of host CPU models
477 between machines, if live migration compatibility is required, use the newest
478 CPU model that is compatible across all desired hosts.
483 MIPS64 Processor (Release 6, 2014)
486 @item @code{Loongson-2F}
488 MIPS64 Processor (Loongson 2, 2008)
491 @item @code{Loongson-2E}
493 MIPS64 Processor (Loongson 2, 2006)
496 @item @code{mips64dspr2}
498 MIPS64 Processor (Release 2, 2006)
501 @item @code{MIPS64R2-generic}
505 MIPS64 Processor (Release 2, 2002)
510 MIPS64 Processor (20K, 2000)
516 MIPS64 Processor (5K, 1999)
521 MIPS64 Processor (VR, 1998)
526 MIPS64 Processor (MIPS III, 1991)
529 @node cpu_models_nanoMIPS
530 @subsubsection Supported CPU models for nanoMIPS hosts
532 The following CPU models are supported for use on nanoMIPS hosts. Administrators /
533 applications are recommended to use the CPU model that matches the generation
534 of the host CPUs in use. In a deployment with a mixture of host CPU models
535 between machines, if live migration compatibility is required, use the newest
536 CPU model that is compatible across all desired hosts.
541 MIPS I7200 (nanoMIPS, 2018)
545 @node preferred_cpu_models_MIPS
546 @subsubsection Preferred CPU models for MIPS hosts
548 The following CPU models are preferred for use on different MIPS hosts:
551 @item @code{MIPS III}
554 @item @code{MIPS32R2}
557 @item @code{MIPS64R6}
560 @item @code{nanoMIPS}
564 @node cpu_model_syntax_apps
565 @subsection Syntax for configuring CPU models
567 The example below illustrate the approach to configuring the various
568 CPU models / features in QEMU and libvirt
571 * cpu_model_syntax_qemu:: QEMU command line
572 * cpu_model_syntax_libvirt:: Libvirt guest XML
575 @node cpu_model_syntax_qemu
576 @subsubsection QEMU command line
580 @item Host passthrough
583 $ @value{qemu_system_x86} -cpu host
586 With feature customization:
589 $ @value{qemu_system_x86} -cpu host,-vmx,...
592 @item Named CPU models
595 $ @value{qemu_system_x86} -cpu Westmere
598 With feature customization:
601 $ @value{qemu_system_x86} -cpu Westmere,+pcid,...
606 @node cpu_model_syntax_libvirt
607 @subsubsection Libvirt guest XML
611 @item Host passthrough
614 <cpu mode='host-passthrough'/>
617 With feature customization:
620 <cpu mode='host-passthrough'>
621 <feature name="vmx" policy="disable"/>
629 <cpu mode='host-model'/>
632 With feature customization:
635 <cpu mode='host-model'>
636 <feature name="vmx" policy="disable"/>
645 <model name="Westmere"/>
649 With feature customization:
653 <model name="Westmere"/>
654 <feature name="pcid" policy="require"/>
665 @setfilename qemu-cpu-models
666 @settitle QEMU / KVM CPU model configuration
669 The HTML documentation of QEMU for more precise information and Linux
670 user mode emulator invocation.