forked from rpms/libvirt
102 lines
3.1 KiB
Diff
102 lines
3.1 KiB
Diff
|
From 693d01f00b9608a4f4cac3b91e38b5537eff754f Mon Sep 17 00:00:00 2001
|
||
|
Message-Id: <693d01f00b9608a4f4cac3b91e38b5537eff754f@dist-git>
|
||
|
From: Jiri Denemark <jdenemar@redhat.com>
|
||
|
Date: Tue, 26 May 2020 10:59:28 +0200
|
||
|
Subject: [PATCH] cpu_x86: Move and rename x86ModelHasSignature
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
Later in this series the function will work on a newly introduced
|
||
|
virCPUx86Signatures structure. Let's move it to the place were all
|
||
|
related functions will be added and rename the function as
|
||
|
virCPUx86SignaturesMatch for easier review of the virCPUx86Signatures
|
||
|
patch.
|
||
|
|
||
|
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||
|
(cherry picked from commit 782be9f0af2e02e725fca45b7674e8b2f008dc6c)
|
||
|
|
||
|
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
|
||
|
|
||
|
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||
|
Message-Id: <7662ee03449ae588a5381c546eb7e8a3b64cadb3.1590483392.git.jdenemar@redhat.com>
|
||
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||
|
---
|
||
|
src/cpu/cpu_x86.c | 38 +++++++++++++++++++-------------------
|
||
|
1 file changed, 19 insertions(+), 19 deletions(-)
|
||
|
|
||
|
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||
|
index 16e6aa73d2..65a99876a9 100644
|
||
|
--- a/src/cpu/cpu_x86.c
|
||
|
+++ b/src/cpu/cpu_x86.c
|
||
|
@@ -1110,6 +1110,21 @@ virCPUx86SignaturesCopy(virCPUx86ModelPtr dst,
|
||
|
}
|
||
|
|
||
|
|
||
|
+static bool
|
||
|
+virCPUx86SignaturesMatch(virCPUx86ModelPtr model,
|
||
|
+ uint32_t signature)
|
||
|
+{
|
||
|
+ size_t i;
|
||
|
+
|
||
|
+ for (i = 0; i < model->nsignatures; i++) {
|
||
|
+ if (model->signatures[i] == signature)
|
||
|
+ return true;
|
||
|
+ }
|
||
|
+
|
||
|
+ return false;
|
||
|
+}
|
||
|
+
|
||
|
+
|
||
|
static void
|
||
|
x86ModelFree(virCPUx86ModelPtr model)
|
||
|
{
|
||
|
@@ -1875,21 +1890,6 @@ virCPUx86Compare(virCPUDefPtr host,
|
||
|
}
|
||
|
|
||
|
|
||
|
-static bool
|
||
|
-x86ModelHasSignature(virCPUx86ModelPtr model,
|
||
|
- uint32_t signature)
|
||
|
-{
|
||
|
- size_t i;
|
||
|
-
|
||
|
- for (i = 0; i < model->nsignatures; i++) {
|
||
|
- if (model->signatures[i] == signature)
|
||
|
- return true;
|
||
|
- }
|
||
|
-
|
||
|
- return false;
|
||
|
-}
|
||
|
-
|
||
|
-
|
||
|
static char *
|
||
|
x86FormatSignatures(virCPUx86ModelPtr model)
|
||
|
{
|
||
|
@@ -1961,8 +1961,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
|
||
|
* consider candidates with matching family/model.
|
||
|
*/
|
||
|
if (signature &&
|
||
|
- x86ModelHasSignature(current, signature) &&
|
||
|
- !x86ModelHasSignature(candidate, signature)) {
|
||
|
+ virCPUx86SignaturesMatch(current, signature) &&
|
||
|
+ !virCPUx86SignaturesMatch(candidate, signature)) {
|
||
|
VIR_DEBUG("%s differs in signature from matching %s",
|
||
|
cpuCandidate->model, cpuCurrent->model);
|
||
|
return 0;
|
||
|
@@ -1978,8 +1978,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
|
||
|
* result in longer list of features.
|
||
|
*/
|
||
|
if (signature &&
|
||
|
- x86ModelHasSignature(candidate, signature) &&
|
||
|
- !x86ModelHasSignature(current, signature)) {
|
||
|
+ virCPUx86SignaturesMatch(candidate, signature) &&
|
||
|
+ !virCPUx86SignaturesMatch(current, signature)) {
|
||
|
VIR_DEBUG("%s provides matching signature", cpuCandidate->model);
|
||
|
return 1;
|
||
|
}
|
||
|
--
|
||
|
2.26.2
|
||
|
|