mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
cpu_x86: Honor CPU models' <decode> element
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
f4914045c2
commit
7cd896ef31
@ -2044,10 +2044,23 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
|
|||||||
virCPUx86ModelPtr candidate,
|
virCPUx86ModelPtr candidate,
|
||||||
virCPUDefPtr cpuCandidate,
|
virCPUDefPtr cpuCandidate,
|
||||||
uint32_t signature,
|
uint32_t signature,
|
||||||
const char *preferred,
|
const char *preferred)
|
||||||
bool checkPolicy)
|
|
||||||
{
|
{
|
||||||
if (checkPolicy) {
|
if (cpuCandidate->type == VIR_CPU_TYPE_HOST &&
|
||||||
|
!candidate->decodeHost) {
|
||||||
|
VIR_DEBUG("%s is not supposed to be used for host CPU definition",
|
||||||
|
cpuCandidate->model);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cpuCandidate->type == VIR_CPU_TYPE_GUEST &&
|
||||||
|
!candidate->decodeGuest) {
|
||||||
|
VIR_DEBUG("%s is not supposed to be used for guest CPU definition",
|
||||||
|
cpuCandidate->model);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cpuCandidate->type == VIR_CPU_TYPE_HOST) {
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < cpuCandidate->nfeatures; i++) {
|
for (i = 0; i < cpuCandidate->nfeatures; i++) {
|
||||||
if (cpuCandidate->features[i].policy == VIR_CPU_FEATURE_DISABLE)
|
if (cpuCandidate->features[i].policy == VIR_CPU_FEATURE_DISABLE)
|
||||||
@ -2209,8 +2222,7 @@ x86Decode(virCPUDefPtr cpu,
|
|||||||
|
|
||||||
if ((rc = x86DecodeUseCandidate(model, cpuModel,
|
if ((rc = x86DecodeUseCandidate(model, cpuModel,
|
||||||
candidate, cpuCandidate,
|
candidate, cpuCandidate,
|
||||||
signature, preferred,
|
signature, preferred))) {
|
||||||
cpu->type == VIR_CPU_TYPE_HOST))) {
|
|
||||||
virCPUDefFree(cpuModel);
|
virCPUDefFree(cpuModel);
|
||||||
cpuModel = cpuCandidate;
|
cpuModel = cpuCandidate;
|
||||||
model = candidate;
|
model = candidate;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user