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