]> git.proxmox.com Git - mirror_qemu.git/blame - docs/qemu-cpu-models.texi
migration/savevm: wrap into qemu_loadvm_state_header()
[mirror_qemu.git] / docs / qemu-cpu-models.texi
CommitLineData
2544e9e4
DB
1@c man begin SYNOPSIS
2QEMU / KVM CPU model configuration
3@c man end
4
5@c man begin DESCRIPTION
6
7@menu
e5a5b1bb
SM
8* recommendations_cpu_models_x86:: Recommendations for KVM CPU model configuration on x86 hosts
9* recommendations_cpu_models_MIPS:: Supported CPU model configurations on MIPS hosts
10* cpu_model_syntax_apps:: Syntax for configuring CPU models
2544e9e4
DB
11@end menu
12
13QEMU / KVM virtualization supports two ways to configure CPU models
14
15@table @option
16
17@item Host passthrough
18
19This passes the host CPU model features, model, stepping, exactly to the
20guest. Note that KVM may filter out some host CPU model features if they
21cannot be supported with virtualization. Live migration is unsafe when
22this mode is used as libvirt / QEMU cannot guarantee a stable CPU is
23exposed to the guest across hosts. This is the recommended CPU to use,
24provided live migration is not required.
25
26@item Named model
27
28QEMU comes with a number of predefined named CPU models, that typically
29refer to specific generations of hardware released by Intel and AMD.
30These allow the guest VMs to have a degree of isolation from the host CPU,
31allowing greater flexibility in live migrating between hosts with differing
32hardware.
33@end table
34
35In both cases, it is possible to optionally add or remove individual CPU
36features, to alter what is presented to the guest by default.
37
38Libvirt supports a third way to configure CPU models known as "Host model".
39This uses the QEMU "Named model" feature, automatically picking a CPU model
40that is similar the host CPU, and then adding extra features to approximate
41the host model as closely as possible. This does not guarantee the CPU family,
42stepping, etc will precisely match the host CPU, as they would with "Host
43passthrough", but gives much of the benefit of passthrough, while making
44live migration safe.
45
46@node recommendations_cpu_models_x86
47@subsection Recommendations for KVM CPU model configuration on x86 hosts
48
49The information that follows provides recommendations for configuring
50CPU models on x86 hosts. The goals are to maximise performance, while
51protecting guest OS against various CPU hardware flaws, and optionally
806be373 52enabling live migration between hosts with heterogeneous CPU models.
2544e9e4
DB
53
54@menu
55* preferred_cpu_models_intel_x86:: Preferred CPU models for Intel x86 hosts
56* important_cpu_features_intel_x86:: Important CPU features for Intel x86 hosts
57* preferred_cpu_models_amd_x86:: Preferred CPU models for AMD x86 hosts
58* important_cpu_features_amd_x86:: Important CPU features for AMD x86 hosts
59* default_cpu_models_x86:: Default x86 CPU models
60* other_non_recommended_cpu_models_x86:: Other non-recommended x86 CPUs
61@end menu
62
63@node preferred_cpu_models_intel_x86
64@subsubsection Preferred CPU models for Intel x86 hosts
65
66The following CPU models are preferred for use on Intel hosts. Administrators /
67applications are recommended to use the CPU model that matches the generation
68of the host CPUs in use. In a deployment with a mixture of host CPU models
69between machines, if live migration compatibility is required, use the newest
70CPU model that is compatible across all desired hosts.
71
72@table @option
73@item @code{Skylake-Server}
74@item @code{Skylake-Server-IBRS}
75
76Intel Xeon Processor (Skylake, 2016)
77
78
79@item @code{Skylake-Client}
80@item @code{Skylake-Client-IBRS}
81
82Intel Core Processor (Skylake, 2015)
83
84
85@item @code{Broadwell}
86@item @code{Broadwell-IBRS}
87@item @code{Broadwell-noTSX}
88@item @code{Broadwell-noTSX-IBRS}
89
90Intel Core Processor (Broadwell, 2014)
91
92
93@item @code{Haswell}
94@item @code{Haswell-IBRS}
95@item @code{Haswell-noTSX}
96@item @code{Haswell-noTSX-IBRS}
97
98Intel Core Processor (Haswell, 2013)
99
100
101@item @code{IvyBridge}
102@item @code{IvyBridge-IBRS}
103
104Intel Xeon E3-12xx v2 (Ivy Bridge, 2012)
105
106
107@item @code{SandyBridge}
108@item @code{SandyBridge-IBRS}
109
110Intel Xeon E312xx (Sandy Bridge, 2011)
111
112
113@item @code{Westmere}
114@item @code{Westmere-IBRS}
115
116Westmere E56xx/L56xx/X56xx (Nehalem-C, 2010)
117
118
119@item @code{Nehalem}
120@item @code{Nehalem-IBRS}
121
122Intel Core i7 9xx (Nehalem Class Core i7, 2008)
123
124
125@item @code{Penryn}
126
127Intel Core 2 Duo P9xxx (Penryn Class Core 2, 2007)
128
129
130@item @code{Conroe}
131
132Intel Celeron_4x0 (Conroe/Merom Class Core 2, 2006)
133
134@end table
135
136@node important_cpu_features_intel_x86
137@subsubsection Important CPU features for Intel x86 hosts
138
139The following are important CPU features that should be used on Intel x86
140hosts, when available in the host CPU. Some of them require explicit
141configuration to enable, as they are not included by default in some, or all,
142of the named CPU models listed above. In general all of these features are
143included if using "Host passthrough" or "Host model".
144
145
146@table @option
147
148@item @code{pcid}
149
150Recommended to mitigate the cost of the Meltdown (CVE-2017-5754) fix
151
152Included by default in Haswell, Broadwell & Skylake Intel CPU models.
153
154Should be explicitly turned on for Westmere, SandyBridge, and IvyBridge
155Intel CPU models. Note that some desktop/mobile Westmere CPUs cannot
156support this feature.
157
158
159@item @code{spec-ctrl}
160
174a78a8 161Required to enable the Spectre v2 (CVE-2017-5715) fix.
2544e9e4
DB
162
163Included by default in Intel CPU models with -IBRS suffix.
164
165Must be explicitly turned on for Intel CPU models without -IBRS suffix.
166
167Requires the host CPU microcode to support this feature before it
168can be used for guest CPUs.
169
170
21ee4787
DB
171@item @code{stibp}
172
173Required to enable stronger Spectre v2 (CVE-2017-5715) fixes in some
174operating systems.
175
176Must be explicitly turned on for all Intel CPU models.
177
178Requires the host CPU microcode to support this feature before it
179can be used for guest CPUs.
180
181
2544e9e4
DB
182@item @code{ssbd}
183
184Required to enable the CVE-2018-3639 fix
185
186Not included by default in any Intel CPU model.
187
188Must be explicitly turned on for all Intel CPU models.
189
190Requires the host CPU microcode to support this feature before it
191can be used for guest CPUs.
192
193
194@item @code{pdpe1gb}
195
196Recommended to allow guest OS to use 1GB size pages
197
198Not included by default in any Intel CPU model.
199
200Should be explicitly turned on for all Intel CPU models.
201
202Note that not all CPU hardware will support this feature.
203@end table
204
205
206@node preferred_cpu_models_amd_x86
207@subsubsection Preferred CPU models for AMD x86 hosts
208
209The following CPU models are preferred for use on Intel hosts. Administrators /
210applications are recommended to use the CPU model that matches the generation
211of the host CPUs in use. In a deployment with a mixture of host CPU models
212between machines, if live migration compatibility is required, use the newest
213CPU model that is compatible across all desired hosts.
214
215@table @option
216
217@item @code{EPYC}
218@item @code{EPYC-IBPB}
219
220AMD EPYC Processor (2017)
221
222
223@item @code{Opteron_G5}
224
225AMD Opteron 63xx class CPU (2012)
226
227
228@item @code{Opteron_G4}
229
230AMD Opteron 62xx class CPU (2011)
231
232
233@item @code{Opteron_G3}
234
235AMD Opteron 23xx (Gen 3 Class Opteron, 2009)
236
237
238@item @code{Opteron_G2}
239
240AMD Opteron 22xx (Gen 2 Class Opteron, 2006)
241
242
243@item @code{Opteron_G1}
244
245AMD Opteron 240 (Gen 1 Class Opteron, 2004)
246@end table
247
248@node important_cpu_features_amd_x86
249@subsubsection Important CPU features for AMD x86 hosts
250
251The following are important CPU features that should be used on AMD x86
252hosts, when available in the host CPU. Some of them require explicit
253configuration to enable, as they are not included by default in some, or all,
254of the named CPU models listed above. In general all of these features are
255included if using "Host passthrough" or "Host model".
256
257
258@table @option
259
260@item @code{ibpb}
261
174a78a8 262Required to enable the Spectre v2 (CVE-2017-5715) fix.
2544e9e4
DB
263
264Included by default in AMD CPU models with -IBPB suffix.
265
266Must be explicitly turned on for AMD CPU models without -IBPB suffix.
267
268Requires the host CPU microcode to support this feature before it
269can be used for guest CPUs.
270
271
21ee4787
DB
272@item @code{stibp}
273
274Required to enable stronger Spectre v2 (CVE-2017-5715) fixes in some
275operating systems.
276
277Must be explicitly turned on for all AMD CPU models.
278
279Requires the host CPU microcode to support this feature before it
280can be used for guest CPUs.
281
282
2544e9e4
DB
283@item @code{virt-ssbd}
284
285Required to enable the CVE-2018-3639 fix
286
287Not included by default in any AMD CPU model.
288
289Must be explicitly turned on for all AMD CPU models.
290
291This should be provided to guests, even if amd-ssbd is also
292provided, for maximum guest compatibility.
293
294Note for some QEMU / libvirt versions, this must be force enabled
295when when using "Host model", because this is a virtual feature
296that doesn't exist in the physical host CPUs.
297
298
299@item @code{amd-ssbd}
300
301Required to enable the CVE-2018-3639 fix
302
303Not included by default in any AMD CPU model.
304
305Must be explicitly turned on for all AMD CPU models.
306
307This provides higher performance than virt-ssbd so should be
308exposed to guests whenever available in the host. virt-ssbd
309should none the less also be exposed for maximum guest
806be373 310compatibility as some kernels only know about virt-ssbd.
2544e9e4
DB
311
312
313@item @code{amd-no-ssb}
314
315Recommended to indicate the host is not vulnerable CVE-2018-3639
316
317Not included by default in any AMD CPU model.
318
806be373 319Future hardware generations of CPU will not be vulnerable to
2544e9e4
DB
320CVE-2018-3639, and thus the guest should be told not to enable
321its mitigations, by exposing amd-no-ssb. This is mutually
322exclusive with virt-ssbd and amd-ssbd.
323
324
325@item @code{pdpe1gb}
326
327Recommended to allow guest OS to use 1GB size pages
328
329Not included by default in any AMD CPU model.
330
331Should be explicitly turned on for all AMD CPU models.
332
333Note that not all CPU hardware will support this feature.
334@end table
335
336
337@node default_cpu_models_x86
338@subsubsection Default x86 CPU models
339
340The default QEMU CPU models are designed such that they can run on all hosts.
341If an application does not wish to do perform any host compatibility checks
342before launching guests, the default is guaranteed to work.
343
344The default CPU models will, however, leave the guest OS vulnerable to various
345CPU hardware flaws, so their use is strongly discouraged. Applications should
346follow the earlier guidance to setup a better CPU configuration, with host
347passthrough recommended if live migration is not needed.
348
349@table @option
350@item @code{qemu32}
351@item @code{qemu64}
352
353QEMU Virtual CPU version 2.5+ (32 & 64 bit variants)
354
355qemu64 is used for x86_64 guests and qemu32 is used for i686 guests, when no
356-cpu argument is given to QEMU, or no <cpu> is provided in libvirt XML.
357@end table
358
359
360@node other_non_recommended_cpu_models_x86
361@subsubsection Other non-recommended x86 CPUs
362
363The following CPUs models are compatible with most AMD and Intel x86 hosts, but
364their usage is discouraged, as they expose a very limited featureset, which
365prevents guests having optimal performance.
366
367@table @option
368
369@item @code{kvm32}
370@item @code{kvm64}
371
372Common KVM processor (32 & 64 bit variants)
373
374Legacy models just for historical compatibility with ancient QEMU versions.
375
376
377@item @code{486}
378@item @code{athlon}
379@item @code{phenom}
380@item @code{coreduo}
381@item @code{core2duo}
382@item @code{n270}
383@item @code{pentium}
384@item @code{pentium2}
385@item @code{pentium3}
386
387Various very old x86 CPU models, mostly predating the introduction of
388hardware assisted virtualization, that should thus not be required for
389running virtual machines.
390@end table
391
e5a5b1bb
SM
392@node recommendations_cpu_models_MIPS
393@subsection Supported CPU model configurations on MIPS hosts
394
395QEMU supports variety of MIPS CPU models:
396
397@menu
398* cpu_models_MIPS32:: Supported CPU models for MIPS32 hosts
399* cpu_models_MIPS64:: Supported CPU models for MIPS64 hosts
400* cpu_models_nanoMIPS:: Supported CPU models for nanoMIPS hosts
401* preferred_cpu_models_MIPS:: Preferred CPU models for MIPS hosts
402@end menu
403
404@node cpu_models_MIPS32
405@subsubsection Supported CPU models for MIPS32 hosts
406
407The following CPU models are supported for use on MIPS32 hosts. Administrators /
408applications are recommended to use the CPU model that matches the generation
409of the host CPUs in use. In a deployment with a mixture of host CPU models
410between machines, if live migration compatibility is required, use the newest
411CPU model that is compatible across all desired hosts.
412
413@table @option
414@item @code{mips32r6-generic}
415
416MIPS32 Processor (Release 6, 2015)
417
418
419@item @code{P5600}
420
421MIPS32 Processor (P5600, 2014)
422
423
424@item @code{M14K}
425@item @code{M14Kc}
426
427MIPS32 Processor (M14K, 2009)
428
429
430@item @code{74Kf}
431
432MIPS32 Processor (74K, 2007)
433
434
435@item @code{34Kf}
436
437MIPS32 Processor (34K, 2006)
438
439
440@item @code{24Kc}
441@item @code{24KEc}
442@item @code{24Kf}
443
444MIPS32 Processor (24K, 2003)
445
446
447@item @code{4Kc}
448@item @code{4Km}
449@item @code{4KEcR1}
450@item @code{4KEmR1}
451@item @code{4KEc}
452@item @code{4KEm}
453
454MIPS32 Processor (4K, 1999)
455@end table
456
457@node cpu_models_MIPS64
458@subsubsection Supported CPU models for MIPS64 hosts
459
460The following CPU models are supported for use on MIPS64 hosts. Administrators /
461applications are recommended to use the CPU model that matches the generation
462of the host CPUs in use. In a deployment with a mixture of host CPU models
463between machines, if live migration compatibility is required, use the newest
464CPU model that is compatible across all desired hosts.
465
466@table @option
467@item @code{I6400}
468
469MIPS64 Processor (Release 6, 2014)
470
471
472@item @code{Loongson-2F}
473
806be373 474MIPS64 Processor (Loongson 2, 2008)
e5a5b1bb
SM
475
476
477@item @code{Loongson-2E}
478
479MIPS64 Processor (Loongson 2, 2006)
480
481
482@item @code{mips64dspr2}
483
484MIPS64 Processor (Release 2, 2006)
485
486
487@item @code{MIPS64R2-generic}
488@item @code{5KEc}
489@item @code{5KEf}
490
491MIPS64 Processor (Release 2, 2002)
492
493
494@item @code{20Kc}
495
496MIPS64 Processor (20K, 2000)
497
498
499@item @code{5Kc}
500@item @code{5Kf}
501
502MIPS64 Processor (5K, 1999)
503
504
505@item @code{VR5432}
506
507MIPS64 Processor (VR, 1998)
508
509
510@item @code{R4000}
511
512MIPS64 Processor (MIPS III, 1991)
513@end table
514
515@node cpu_models_nanoMIPS
516@subsubsection Supported CPU models for nanoMIPS hosts
517
518The following CPU models are supported for use on nanoMIPS hosts. Administrators /
519applications are recommended to use the CPU model that matches the generation
520of the host CPUs in use. In a deployment with a mixture of host CPU models
521between machines, if live migration compatibility is required, use the newest
522CPU model that is compatible across all desired hosts.
523
524@table @option
525@item @code{I7200}
526
527MIPS I7200 (nanoMIPS, 2018)
528
529@end table
530
531@node preferred_cpu_models_MIPS
532@subsubsection Preferred CPU models for MIPS hosts
533
534The following CPU models are preferred for use on different MIPS hosts:
535
536@table @option
537@item @code{MIPS III}
538R4000
539
540@item @code{MIPS32R2}
54134Kf
542
543@item @code{MIPS64R6}
544I6400
545
546@item @code{nanoMIPS}
547I7200
548@end table
549
2544e9e4
DB
550@node cpu_model_syntax_apps
551@subsection Syntax for configuring CPU models
552
553The example below illustrate the approach to configuring the various
554CPU models / features in QEMU and libvirt
555
556@menu
557* cpu_model_syntax_qemu:: QEMU command line
558* cpu_model_syntax_libvirt:: Libvirt guest XML
559@end menu
560
561@node cpu_model_syntax_qemu
562@subsubsection QEMU command line
563
564@table @option
565
566@item Host passthrough
567
568@example
569 $ qemu-system-x86_64 -cpu host
570@end example
571
572With feature customization:
573
574@example
575 $ qemu-system-x86_64 -cpu host,-vmx,...
576@end example
577
578@item Named CPU models
579
580@example
581 $ qemu-system-x86_64 -cpu Westmere
582@end example
583
584With feature customization:
585
586@example
587 $ qemu-system-x86_64 -cpu Westmere,+pcid,...
588@end example
589
590@end table
591
592@node cpu_model_syntax_libvirt
593@subsubsection Libvirt guest XML
594
595@table @option
596
597@item Host passthrough
598
599@example
600 <cpu mode='host-passthrough'/>
601@end example
602
603With feature customization:
604
605@example
606 <cpu mode='host-passthrough'>
607 <feature name="vmx" policy="disable"/>
608 ...
609 </cpu>
610@end example
611
612@item Host model
613
614@example
615 <cpu mode='host-model'/>
616@end example
617
618With feature customization:
619
620@example
621 <cpu mode='host-model'>
622 <feature name="vmx" policy="disable"/>
623 ...
624 </cpu>
625@end example
626
627@item Named model
628
629@example
630 <cpu mode='custom'>
631 <model name="Westmere"/>
632 </cpu>
633@end example
634
635With feature customization:
636
637@example
638 <cpu mode='custom'>
639 <model name="Westmere"/>
640 <feature name="pcid" policy="require"/>
641 ...
642 </cpu>
643@end example
644
645@end table
646
647@c man end
648
649@ignore
650
651@setfilename qemu-cpu-models
652@settitle QEMU / KVM CPU model configuration
653
654@c man begin SEEALSO
655The HTML documentation of QEMU for more precise information and Linux
656user mode emulator invocation.
657@c man end
658
659@c man begin AUTHOR
660Daniel P. Berrange
661@c man end
662
663@end ignore