|
Pablo Greco |
40546a |
From e7b8b38fe1fe7e7d8eb9fab6cb3ded16652f60f8 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <e7b8b38fe1fe7e7d8eb9fab6cb3ded16652f60f8@dist-git>
|
|
Pablo Greco |
40546a |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Date: Fri, 21 Jun 2019 09:24:55 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] cpu_x86: Separate signature parsing from x86ModelParse
|
|
Pablo Greco |
40546a |
MIME-Version: 1.0
|
|
Pablo Greco |
40546a |
Content-Type: text/plain; charset=UTF-8
|
|
Pablo Greco |
40546a |
Content-Transfer-Encoding: 8bit
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
The code is separated into a new x86ModelParseSignature function.
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
(cherry picked from commit fe78d2fda9f2dd67eb9daa98e48fbffa468d271e)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Message-Id: <616b60991bfdaa735804b839e258f6f1fa409a7b.1561068591.git.jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
---
|
|
Pablo Greco |
40546a |
src/cpu/cpu_x86.c | 58 ++++++++++++++++++++++++++++-------------------
|
|
Pablo Greco |
40546a |
1 file changed, 35 insertions(+), 23 deletions(-)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
Pablo Greco |
40546a |
index 64788d60b3..119ece4758 100644
|
|
Pablo Greco |
40546a |
--- a/src/cpu/cpu_x86.c
|
|
Pablo Greco |
40546a |
+++ b/src/cpu/cpu_x86.c
|
|
Pablo Greco |
40546a |
@@ -1184,6 +1184,39 @@ x86ModelParseAncestor(virCPUx86ModelPtr model,
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+static int
|
|
Pablo Greco |
40546a |
+x86ModelParseSignature(virCPUx86ModelPtr model,
|
|
Pablo Greco |
40546a |
+ xmlXPathContextPtr ctxt)
|
|
Pablo Greco |
40546a |
+{
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ if (virXPathBoolean("boolean(./signature)", ctxt)) {
|
|
Pablo Greco |
40546a |
+ unsigned int sigFamily = 0;
|
|
Pablo Greco |
40546a |
+ unsigned int sigModel = 0;
|
|
Pablo Greco |
40546a |
+ int rc;
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ rc = virXPathUInt("string(./signature/@family)", ctxt, &sigFamily);
|
|
Pablo Greco |
40546a |
+ if (rc < 0 || sigFamily == 0) {
|
|
Pablo Greco |
40546a |
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
Pablo Greco |
40546a |
+ _("Invalid CPU signature family in model %s"),
|
|
Pablo Greco |
40546a |
+ model->name);
|
|
Pablo Greco |
40546a |
+ return -1;
|
|
Pablo Greco |
40546a |
+ }
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ rc = virXPathUInt("string(./signature/@model)", ctxt, &sigModel);
|
|
Pablo Greco |
40546a |
+ if (rc < 0 || sigModel == 0) {
|
|
Pablo Greco |
40546a |
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
Pablo Greco |
40546a |
+ _("Invalid CPU signature model in model %s"),
|
|
Pablo Greco |
40546a |
+ model->name);
|
|
Pablo Greco |
40546a |
+ return -1;
|
|
Pablo Greco |
40546a |
+ }
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ model->signature = x86MakeSignature(sigFamily, sigModel, 0);
|
|
Pablo Greco |
40546a |
+ }
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ return 0;
|
|
Pablo Greco |
40546a |
+}
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
static int
|
|
Pablo Greco |
40546a |
x86ModelParse(xmlXPathContextPtr ctxt,
|
|
Pablo Greco |
40546a |
const char *name,
|
|
Pablo Greco |
40546a |
@@ -1206,29 +1239,8 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
|
Pablo Greco |
40546a |
if (x86ModelParseAncestor(model, ctxt, map) < 0)
|
|
Pablo Greco |
40546a |
goto cleanup;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- if (virXPathBoolean("boolean(./signature)", ctxt)) {
|
|
Pablo Greco |
40546a |
- unsigned int sigFamily = 0;
|
|
Pablo Greco |
40546a |
- unsigned int sigModel = 0;
|
|
Pablo Greco |
40546a |
- int rc;
|
|
Pablo Greco |
40546a |
-
|
|
Pablo Greco |
40546a |
- rc = virXPathUInt("string(./signature/@family)", ctxt, &sigFamily);
|
|
Pablo Greco |
40546a |
- if (rc < 0 || sigFamily == 0) {
|
|
Pablo Greco |
40546a |
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
Pablo Greco |
40546a |
- _("Invalid CPU signature family in model %s"),
|
|
Pablo Greco |
40546a |
- model->name);
|
|
Pablo Greco |
40546a |
- goto cleanup;
|
|
Pablo Greco |
40546a |
- }
|
|
Pablo Greco |
40546a |
-
|
|
Pablo Greco |
40546a |
- rc = virXPathUInt("string(./signature/@model)", ctxt, &sigModel);
|
|
Pablo Greco |
40546a |
- if (rc < 0 || sigModel == 0) {
|
|
Pablo Greco |
40546a |
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
Pablo Greco |
40546a |
- _("Invalid CPU signature model in model %s"),
|
|
Pablo Greco |
40546a |
- model->name);
|
|
Pablo Greco |
40546a |
- goto cleanup;
|
|
Pablo Greco |
40546a |
- }
|
|
Pablo Greco |
40546a |
-
|
|
Pablo Greco |
40546a |
- model->signature = x86MakeSignature(sigFamily, sigModel, 0);
|
|
Pablo Greco |
40546a |
- }
|
|
Pablo Greco |
40546a |
+ if (x86ModelParseSignature(model, ctxt) < 0)
|
|
Pablo Greco |
40546a |
+ goto cleanup;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
if (virXPathBoolean("boolean(./vendor)", ctxt)) {
|
|
Pablo Greco |
40546a |
vendor = virXPathString("string(./vendor/@name)", ctxt);
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.0
|
|
Pablo Greco |
40546a |
|