|
|
fbe740 |
From 760e248164be819bebc03893ace58e0ddae7e440 Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <760e248164be819bebc03893ace58e0ddae7e440@dist-git>
|
|
|
fbe740 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
fbe740 |
Date: Tue, 26 May 2020 10:58:52 +0200
|
|
|
fbe740 |
Subject: [PATCH] cpu_x86: Prepare virCPUx86UpdateLive for easier extension
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
Adding more checks into the existing if statements would turn them into
|
|
|
fbe740 |
an unreadable mess.
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit 8dc791b5d3b20552cc0b8d6c04e34dd0f3ebe2ff)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1839999
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
fbe740 |
Message-Id: <169ed0334144715b52575ca3f7e67ce3170ba91a.1590483392.git.jdenemar@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
src/cpu/cpu_x86.c | 12 +++++++++---
|
|
|
fbe740 |
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
fbe740 |
index 9b7981d574..9e686a86d2 100644
|
|
|
fbe740 |
--- a/src/cpu/cpu_x86.c
|
|
|
fbe740 |
+++ b/src/cpu/cpu_x86.c
|
|
|
fbe740 |
@@ -3036,9 +3036,15 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
|
|
|
fbe740 |
|
|
|
fbe740 |
for (i = 0; i < map->nfeatures; i++) {
|
|
|
fbe740 |
virCPUx86FeaturePtr feature = map->features[i];
|
|
|
fbe740 |
+ virCPUFeaturePolicy expected = VIR_CPU_FEATURE_LAST;
|
|
|
fbe740 |
|
|
|
fbe740 |
- if (x86DataIsSubset(&enabled, &feature->data) &&
|
|
|
fbe740 |
- !x86DataIsSubset(&model->data, &feature->data)) {
|
|
|
fbe740 |
+ if (x86DataIsSubset(&model->data, &feature->data))
|
|
|
fbe740 |
+ expected = VIR_CPU_FEATURE_REQUIRE;
|
|
|
fbe740 |
+ else
|
|
|
fbe740 |
+ expected = VIR_CPU_FEATURE_DISABLE;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (expected == VIR_CPU_FEATURE_DISABLE &&
|
|
|
fbe740 |
+ x86DataIsSubset(&enabled, &feature->data)) {
|
|
|
fbe740 |
VIR_DEBUG("Feature '%s' enabled by the hypervisor", feature->name);
|
|
|
fbe740 |
if (cpu->check == VIR_CPU_CHECK_FULL)
|
|
|
fbe740 |
virBufferAsprintf(&bufAdded, "%s,", feature->name);
|
|
|
fbe740 |
@@ -3048,7 +3054,7 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
if (x86DataIsSubset(&disabled, &feature->data) ||
|
|
|
fbe740 |
- (x86DataIsSubset(&model->data, &feature->data) &&
|
|
|
fbe740 |
+ (expected == VIR_CPU_FEATURE_REQUIRE &&
|
|
|
fbe740 |
!x86DataIsSubset(&enabled, &feature->data))) {
|
|
|
fbe740 |
VIR_DEBUG("Feature '%s' disabled by the hypervisor", feature->name);
|
|
|
fbe740 |
if (cpu->check == VIR_CPU_CHECK_FULL)
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.26.2
|
|
|
fbe740 |
|