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