target/arm/kvm: host cpu: Add support for sve<N> properties
[qemu/ar7.git] / docs / qemu-cpu-models.texi
blobf88a1def0d042cc25213259172a648f0a9c514dc
1 @c man begin SYNOPSIS
2 QEMU / KVM CPU model configuration
3 @c man end
5 @set qemu_system_x86 qemu-system-x86_64
7 @c man begin DESCRIPTION
9 @menu
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
13 @end menu
15 QEMU / KVM virtualization supports two ways to configure CPU models
17 @table @option
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.
28 @item Named model
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
34 hardware.
35 @end table
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
46 live migration safe.
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.
56 @menu
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
63 @end menu
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.
74 @table @option
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)
95 @item @code{Haswell}
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)
121 @item @code{Nehalem}
122 @item @code{Nehalem-IBRS}
124 Intel Core i7 9xx (Nehalem Class Core i7, 2008)
127 @item @code{Penryn}
129 Intel Core 2 Duo P9xxx (Penryn Class Core 2, 2007)
132 @item @code{Conroe}
134 Intel Celeron_4x0 (Conroe/Merom Class Core 2, 2006)
136 @end table
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".
148 @table @option
150 @item @code{pcid}
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.
173 @item @code{stibp}
175 Required to enable stronger Spectre v2 (CVE-2017-5715) fixes in some
176 operating systems.
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.
184 @item @code{ssbd}
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.
196 @item @code{pdpe1gb}
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.
217 @end table
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.
229 @table @option
231 @item @code{EPYC}
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)
260 @end table
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".
272 @table @option
274 @item @code{ibpb}
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.
286 @item @code{stibp}
288 Required to enable stronger Spectre v2 (CVE-2017-5715) fixes in some
289 operating systems.
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.
339 @item @code{pdpe1gb}
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.
348 @end table
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.
363 @table @option
364 @item @code{qemu32}
365 @item @code{qemu64}
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.
371 @end table
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.
381 @table @option
383 @item @code{kvm32}
384 @item @code{kvm64}
386 Common KVM processor (32 & 64 bit variants)
388 Legacy models just for historical compatibility with ancient QEMU versions.
391 @item @code{486}
392 @item @code{athlon}
393 @item @code{phenom}
394 @item @code{coreduo}
395 @item @code{core2duo}
396 @item @code{n270}
397 @item @code{pentium}
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.
404 @end table
406 @node recommendations_cpu_models_MIPS
407 @subsection Supported CPU model configurations on MIPS hosts
409 QEMU supports variety of MIPS CPU models:
411 @menu
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
416 @end menu
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.
427 @table @option
428 @item @code{mips32r6-generic}
430 MIPS32 Processor (Release 6, 2015)
433 @item @code{P5600}
435 MIPS32 Processor (P5600, 2014)
438 @item @code{M14K}
439 @item @code{M14Kc}
441 MIPS32 Processor (M14K, 2009)
444 @item @code{74Kf}
446 MIPS32 Processor (74K, 2007)
449 @item @code{34Kf}
451 MIPS32 Processor (34K, 2006)
454 @item @code{24Kc}
455 @item @code{24KEc}
456 @item @code{24Kf}
458 MIPS32 Processor (24K, 2003)
461 @item @code{4Kc}
462 @item @code{4Km}
463 @item @code{4KEcR1}
464 @item @code{4KEmR1}
465 @item @code{4KEc}
466 @item @code{4KEm}
468 MIPS32 Processor (4K, 1999)
469 @end table
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.
480 @table @option
481 @item @code{I6400}
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}
502 @item @code{5KEc}
503 @item @code{5KEf}
505 MIPS64 Processor (Release 2, 2002)
508 @item @code{20Kc}
510 MIPS64 Processor (20K, 2000)
513 @item @code{5Kc}
514 @item @code{5Kf}
516 MIPS64 Processor (5K, 1999)
519 @item @code{VR5432}
521 MIPS64 Processor (VR, 1998)
524 @item @code{R4000}
526 MIPS64 Processor (MIPS III, 1991)
527 @end table
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.
538 @table @option
539 @item @code{I7200}
541 MIPS I7200 (nanoMIPS, 2018)
543 @end table
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:
550 @table @option
551 @item @code{MIPS III}
552 R4000
554 @item @code{MIPS32R2}
555 34Kf
557 @item @code{MIPS64R6}
558 I6400
560 @item @code{nanoMIPS}
561 I7200
562 @end table
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
570 @menu
571 * cpu_model_syntax_qemu::    QEMU command line
572 * cpu_model_syntax_libvirt:: Libvirt guest XML
573 @end menu
575 @node cpu_model_syntax_qemu
576 @subsubsection QEMU command line
578 @table @option
580 @item Host passthrough
582 @example
583    $ @value{qemu_system_x86} -cpu host
584 @end example
586 With feature customization:
588 @example
589    $ @value{qemu_system_x86} -cpu host,-vmx,...
590 @end example
592 @item Named CPU models
594 @example
595    $ @value{qemu_system_x86} -cpu Westmere
596 @end example
598 With feature customization:
600 @example
601    $ @value{qemu_system_x86} -cpu Westmere,+pcid,...
602 @end example
604 @end table
606 @node cpu_model_syntax_libvirt
607 @subsubsection Libvirt guest XML
609 @table @option
611 @item Host passthrough
613 @example
614    <cpu mode='host-passthrough'/>
615 @end example
617 With feature customization:
619 @example
620    <cpu mode='host-passthrough'>
621        <feature name="vmx" policy="disable"/>
622        ...
623    </cpu>
624 @end example
626 @item Host model
628 @example
629    <cpu mode='host-model'/>
630 @end example
632 With feature customization:
634 @example
635    <cpu mode='host-model'>
636        <feature name="vmx" policy="disable"/>
637        ...
638    </cpu>
639 @end example
641 @item Named model
643 @example
644    <cpu mode='custom'>
645        <model name="Westmere"/>
646    </cpu>
647 @end example
649 With feature customization:
651 @example
652    <cpu mode='custom'>
653        <model name="Westmere"/>
654        <feature name="pcid" policy="require"/>
655        ...
656    </cpu>
657 @end example
659 @end table
661 @c man end
663 @ignore
665 @setfilename qemu-cpu-models
666 @settitle QEMU / KVM CPU model configuration
668 @c man begin SEEALSO
669 The HTML documentation of QEMU for more precise information and Linux
670 user mode emulator invocation.
671 @c man end
673 @c man begin AUTHOR
674 Daniel P. Berrange
675 @c man end
677 @end ignore