mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-30 16:35:24 +00:00
cpu_map: Add <decode> element to x86 CPU model definitions
The element specifies whether a particular CPU model can be used when creating a CPU definition from raw CPUID/MSR data. The @host attribute determines whether the CPU model can be used (host='on') for creating CPU definition for host capabilities. Usability of the model for domain capabilities and host-model CPU definitions is controlled by the @guest attribute. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com> Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
This commit is contained in:
parent
dd17a4eba8
commit
f4914045c2
@ -125,6 +125,8 @@ typedef struct _virCPUx86Model virCPUx86Model;
|
||||
typedef virCPUx86Model *virCPUx86ModelPtr;
|
||||
struct _virCPUx86Model {
|
||||
char *name;
|
||||
bool decodeHost;
|
||||
bool decodeGuest;
|
||||
virCPUx86VendorPtr vendor;
|
||||
size_t nsignatures;
|
||||
uint32_t *signatures;
|
||||
@ -1347,6 +1349,44 @@ x86ModelCompare(virCPUx86ModelPtr model1,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
x86ModelParseDecode(virCPUx86ModelPtr model,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
g_autofree char *host = NULL;
|
||||
g_autofree char *guest = NULL;
|
||||
int val;
|
||||
|
||||
if ((host = virXPathString("string(./decode/@host)", ctxt)))
|
||||
val = virTristateSwitchTypeFromString(host);
|
||||
else
|
||||
val = VIR_TRISTATE_SWITCH_ABSENT;
|
||||
|
||||
if (val <= 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("invalid or missing decode/host attribute in CPU model %s"),
|
||||
model->name);
|
||||
return -1;
|
||||
}
|
||||
model->decodeHost = val == VIR_TRISTATE_SWITCH_ON;
|
||||
|
||||
if ((guest = virXPathString("string(./decode/@guest)", ctxt)))
|
||||
val = virTristateSwitchTypeFromString(guest);
|
||||
else
|
||||
val = VIR_TRISTATE_SWITCH_ABSENT;
|
||||
|
||||
if (val <= 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("invalid or missing decode/guest attribute in CPU model %s"),
|
||||
model->name);
|
||||
return -1;
|
||||
}
|
||||
model->decodeGuest = val == VIR_TRISTATE_SWITCH_ON;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
x86ModelParseAncestor(virCPUx86ModelPtr model,
|
||||
xmlXPathContextPtr ctxt,
|
||||
@ -1521,6 +1561,9 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
|
||||
model->name = g_strdup(name);
|
||||
|
||||
if (x86ModelParseDecode(model, ctxt) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (x86ModelParseAncestor(model, ctxt, map) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='486'>
|
||||
<decode host='on' guest='on'/>
|
||||
<feature name='fpu'/>
|
||||
<feature name='pse'/>
|
||||
<feature name='vme'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Broadwell-IBRS'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='61'/> <!-- 0306d0 -->
|
||||
<signature family='6' model='71'/> <!-- 040670 -->
|
||||
<signature family='6' model='79'/> <!-- 0406f0 -->
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Broadwell-noTSX-IBRS'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='61'/> <!-- 0306d0 -->
|
||||
<signature family='6' model='71'/> <!-- 040670 -->
|
||||
<signature family='6' model='79'/> <!-- 0406f0 -->
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Broadwell-noTSX'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='61'/> <!-- 0306d0 -->
|
||||
<signature family='6' model='71'/> <!-- 040670 -->
|
||||
<signature family='6' model='79'/> <!-- 0406f0 -->
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Broadwell'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='61'/> <!-- 0306d0 -->
|
||||
<signature family='6' model='71'/> <!-- 040670 -->
|
||||
<signature family='6' model='79'/> <!-- 0406f0 -->
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Cascadelake-Server-noTSX'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='85'/> <!-- 050654 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Cascadelake-Server'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='85'/> <!-- 050654 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Conroe'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='15'/> <!-- 0006f0 -->
|
||||
<signature family='6' model='22'/> <!-- 010660 -->
|
||||
<vendor name='Intel'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Dhyana'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='24' model='0'/> <!-- 900f00 -->
|
||||
<vendor name='Hygon'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='EPYC-IBPB'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='23' model='1'/> <!-- 800f10 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='EPYC'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='23' model='1'/> <!-- 800f10 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Haswell-IBRS'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='60'/> <!-- 0306c0 -->
|
||||
<signature family='6' model='63'/> <!-- 0306f0 -->
|
||||
<signature family='6' model='69'/> <!-- 040650 -->
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Haswell-noTSX-IBRS'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='60'/> <!-- 0306c0 -->
|
||||
<signature family='6' model='63'/> <!-- 0306f0 -->
|
||||
<signature family='6' model='69'/> <!-- 040650 -->
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Haswell-noTSX'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='60'/> <!-- 0306c0 -->
|
||||
<signature family='6' model='63'/> <!-- 0306f0 -->
|
||||
<signature family='6' model='69'/> <!-- 040650 -->
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Haswell'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='60'/> <!-- 0306c0 -->
|
||||
<signature family='6' model='63'/> <!-- 0306f0 -->
|
||||
<signature family='6' model='69'/> <!-- 040650 -->
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Icelake-Client-noTSX'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='126'/> <!-- 0706e0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Icelake-Client'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='126'/> <!-- 0706e0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Icelake-Server-noTSX'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='134'/> <!-- 080660 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Icelake-Server'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='134'/> <!-- 080660 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='IvyBridge-IBRS'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='58'/> <!-- 0306a0 -->
|
||||
<signature family='6' model='62'/> <!-- 0306e0 -->
|
||||
<vendor name='Intel'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='IvyBridge'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='58'/> <!-- 0306a0 -->
|
||||
<signature family='6' model='62'/> <!-- 0306e0 -->
|
||||
<vendor name='Intel'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Nehalem-IBRS'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='26'/> <!-- 0106a0 -->
|
||||
<signature family='6' model='30'/> <!-- 0106e0 -->
|
||||
<signature family='6' model='31'/> <!-- 0106f0 -->
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Nehalem'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='26'/> <!-- 0106a0 -->
|
||||
<signature family='6' model='30'/> <!-- 0106e0 -->
|
||||
<signature family='6' model='31'/> <!-- 0106f0 -->
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Opteron_G1'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='15' model='6'/> <!-- 100e60 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='apic'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Opteron_G2'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='15' model='6'/> <!-- 100e60 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='apic'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Opteron_G3'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='15' model='6'/> <!-- 100e60 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='abm'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Opteron_G4'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='21' model='1'/> <!-- 600f10 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Opteron_G5'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='21' model='2'/> <!-- 600f20 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Penryn'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='23'/> <!-- 010670 -->
|
||||
<signature family='6' model='29'/> <!-- 0106d0 -->
|
||||
<vendor name='Intel'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='SandyBridge-IBRS'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='42'/> <!-- 0206a0 -->
|
||||
<signature family='6' model='45'/> <!-- 0206d0 -->
|
||||
<vendor name='Intel'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='SandyBridge'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='42'/> <!-- 0206a0 -->
|
||||
<signature family='6' model='45'/> <!-- 0206d0 -->
|
||||
<vendor name='Intel'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Skylake-Client-IBRS'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='94'/> <!-- 0506e0 -->
|
||||
<signature family='6' model='78'/> <!-- 0406e0 -->
|
||||
<!-- These are Kaby Lake and Coffee Lake successors to Skylake,
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Skylake-Client-noTSX-IBRS'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='94'/> <!-- 0506e0 -->
|
||||
<signature family='6' model='78'/> <!-- 0406e0 -->
|
||||
<!-- These are Kaby Lake and Coffee Lake successors to Skylake,
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Skylake-Client'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='94'/> <!-- 0506e0 -->
|
||||
<signature family='6' model='78'/> <!-- 0406e0 -->
|
||||
<!-- These are Kaby Lake and Coffee Lake successors to Skylake,
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Skylake-Server-IBRS'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='85'/> <!-- 050654 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Skylake-Server-noTSX-IBRS'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='85'/> <!-- 050654 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Skylake-Server'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='85'/> <!-- 050654 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Westmere-IBRS'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='44'/> <!-- 0206c0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='Westmere'>
|
||||
<decode host='on' guest='on'/>
|
||||
<signature family='6' model='44'/> <!-- 0206c0 -->
|
||||
<signature family='6' model='47'/> <!-- 0206f0 -->
|
||||
<signature family='6' model='37'/> <!-- 020650 -->
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='athlon'>
|
||||
<decode host='on' guest='on'/>
|
||||
<vendor name='AMD'/>
|
||||
<feature name='3dnow'/>
|
||||
<feature name='3dnowext'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='core2duo'>
|
||||
<decode host='on' guest='on'/>
|
||||
<vendor name='Intel'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='coreduo'>
|
||||
<decode host='on' guest='on'/>
|
||||
<vendor name='Intel'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='cpu64-rhel5'>
|
||||
<decode host='on' guest='on'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
<feature name='cmov'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='cpu64-rhel6'>
|
||||
<decode host='on' guest='on'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
<feature name='cmov'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='kvm32'>
|
||||
<decode host='on' guest='on'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
<feature name='cmov'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='kvm64'>
|
||||
<decode host='on' guest='on'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
<feature name='cmov'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='n270'>
|
||||
<decode host='on' guest='on'/>
|
||||
<vendor name='Intel'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='pentium'>
|
||||
<decode host='on' guest='on'/>
|
||||
<feature name='cx8'/>
|
||||
<feature name='de'/>
|
||||
<feature name='fpu'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='pentium2'>
|
||||
<decode host='on' guest='on'/>
|
||||
<feature name='cmov'/>
|
||||
<feature name='cx8'/>
|
||||
<feature name='de'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='pentium3'>
|
||||
<decode host='on' guest='on'/>
|
||||
<feature name='cmov'/>
|
||||
<feature name='cx8'/>
|
||||
<feature name='de'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='pentiumpro'>
|
||||
<decode host='on' guest='on'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='cmov'/>
|
||||
<feature name='cx8'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='phenom'>
|
||||
<decode host='on' guest='on'/>
|
||||
<vendor name='AMD'/>
|
||||
<feature name='3dnow'/>
|
||||
<feature name='3dnowext'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='qemu32'>
|
||||
<decode host='on' guest='on'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='cmov'/>
|
||||
<feature name='cx8'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<cpus>
|
||||
<model name='qemu64'>
|
||||
<decode host='on' guest='on'/>
|
||||
<!-- These are supported only by TCG. KVM supports them only if the
|
||||
host does. So we leave them out:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user