|
|
a41c76 |
From ba2f2a8c39f2e7fe5684d9b84a0a832be482a3ab Mon Sep 17 00:00:00 2001
|
|
|
a41c76 |
Message-Id: <ba2f2a8c39f2e7fe5684d9b84a0a832be482a3ab@dist-git>
|
|
|
a41c76 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
a41c76 |
Date: Tue, 26 May 2020 10:58:57 +0200
|
|
|
a41c76 |
Subject: [PATCH] cpu_x86: Honor CPU models' <decode> element
|
|
|
a41c76 |
MIME-Version: 1.0
|
|
|
a41c76 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a41c76 |
Content-Transfer-Encoding: 8bit
|
|
|
a41c76 |
|
|
|
a41c76 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
|
|
|
a41c76 |
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
|
|
|
a41c76 |
(cherry picked from commit 7cd896ef31d33f78d40df918a33fe3867e251509)
|
|
|
a41c76 |
|
|
|
a41c76 |
https://bugzilla.redhat.com/show_bug.cgi?id=1840008
|
|
|
a41c76 |
|
|
|
a41c76 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
a41c76 |
Message-Id: <15f1eedf2c0df29a3942b4b28bc4575fa51ca19a.1590483392.git.jdenemar@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
a41c76 |
---
|
|
|
a41c76 |
src/cpu/cpu_x86.c | 22 +++++++++++++++++-----
|
|
|
a41c76 |
1 file changed, 17 insertions(+), 5 deletions(-)
|
|
|
a41c76 |
|
|
|
a41c76 |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
a41c76 |
index 7fbb4c9a6c..b4d5c795f7 100644
|
|
|
a41c76 |
--- a/src/cpu/cpu_x86.c
|
|
|
a41c76 |
+++ b/src/cpu/cpu_x86.c
|
|
|
a41c76 |
@@ -2044,10 +2044,23 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
|
|
|
a41c76 |
virCPUx86ModelPtr candidate,
|
|
|
a41c76 |
virCPUDefPtr cpuCandidate,
|
|
|
a41c76 |
uint32_t signature,
|
|
|
a41c76 |
- const char *preferred,
|
|
|
a41c76 |
- bool checkPolicy)
|
|
|
a41c76 |
+ const char *preferred)
|
|
|
a41c76 |
{
|
|
|
a41c76 |
- if (checkPolicy) {
|
|
|
a41c76 |
+ if (cpuCandidate->type == VIR_CPU_TYPE_HOST &&
|
|
|
a41c76 |
+ !candidate->decodeHost) {
|
|
|
a41c76 |
+ VIR_DEBUG("%s is not supposed to be used for host CPU definition",
|
|
|
a41c76 |
+ cpuCandidate->model);
|
|
|
a41c76 |
+ return 0;
|
|
|
a41c76 |
+ }
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (cpuCandidate->type == VIR_CPU_TYPE_GUEST &&
|
|
|
a41c76 |
+ !candidate->decodeGuest) {
|
|
|
a41c76 |
+ VIR_DEBUG("%s is not supposed to be used for guest CPU definition",
|
|
|
a41c76 |
+ cpuCandidate->model);
|
|
|
a41c76 |
+ return 0;
|
|
|
a41c76 |
+ }
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (cpuCandidate->type == VIR_CPU_TYPE_HOST) {
|
|
|
a41c76 |
size_t i;
|
|
|
a41c76 |
for (i = 0; i < cpuCandidate->nfeatures; i++) {
|
|
|
a41c76 |
if (cpuCandidate->features[i].policy == VIR_CPU_FEATURE_DISABLE)
|
|
|
a41c76 |
@@ -2209,8 +2222,7 @@ x86Decode(virCPUDefPtr cpu,
|
|
|
a41c76 |
|
|
|
a41c76 |
if ((rc = x86DecodeUseCandidate(model, cpuModel,
|
|
|
a41c76 |
candidate, cpuCandidate,
|
|
|
a41c76 |
- signature, preferred,
|
|
|
a41c76 |
- cpu->type == VIR_CPU_TYPE_HOST))) {
|
|
|
a41c76 |
+ signature, preferred))) {
|
|
|
a41c76 |
virCPUDefFree(cpuModel);
|
|
|
a41c76 |
cpuModel = cpuCandidate;
|
|
|
a41c76 |
model = candidate;
|
|
|
a41c76 |
--
|
|
|
a41c76 |
2.26.2
|
|
|
a41c76 |
|