[libvirt] [PATCH 1/5] s390: Cpu driver support for getModels, update and compare

Jason J. Herne jjherne at linux.vnet.ibm.com
Wed Nov 2 20:34:31 UTC 2016


Implement getModels for s390. It returns an empty list. This means libvirt
supports all models Qemu knows about.

Implement compare for s390. Required to test the guest against the host for
guest cpu model runnability checking. We always return IDENTICAL to bypass
Libvirt's checking. s390 will rely on Qemu to perform the runnability checking.

Implement update for s390. required to support use of cpu "host-model" mode.

Signed-off-by: Jason J. Herne <jjherne at linux.vnet.ibm.com>
---
 src/cpu/cpu_s390.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c
index fb352a0..0f94084 100644
--- a/src/cpu/cpu_s390.c
+++ b/src/cpu/cpu_s390.c
@@ -71,16 +71,43 @@ s390DataFree(virCPUDataPtr data)
     VIR_FREE(data);
 }
 
+static int
+s390GetModels(char ***models ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
+
+static virCPUCompareResult
+virCPUs390Compare(virCPUDefPtr host ATTRIBUTE_UNUSED,
+                 virCPUDefPtr cpu ATTRIBUTE_UNUSED,
+                 bool failMessages ATTRIBUTE_UNUSED)
+{
+    return VIR_CPU_COMPARE_IDENTICAL;
+}
+
+static int
+virCPUs390Update(virCPUDefPtr guest ATTRIBUTE_UNUSED,
+                 const virCPUDef *host ATTRIBUTE_UNUSED)
+{
+    /*
+     * - host-passthrough not yet supported
+     * - host-model needs no changes
+     * - custom mode ... ???
+     */
+    return 0;
+}
+
 struct cpuArchDriver cpuDriverS390 = {
     .name = "s390",
     .arch = archs,
     .narch = ARRAY_CARDINALITY(archs),
-    .compare    = NULL,
+    .compare    = virCPUs390Compare,
     .decode     = s390Decode,
     .encode     = NULL,
     .free       = s390DataFree,
     .nodeData   = s390NodeData,
     .guestData  = NULL,
     .baseline   = NULL,
-    .update     = NULL,
+    .update     = virCPUs390Update,
+    .getModels  = s390GetModels,
 };
-- 
1.9.1




More information about the libvir-list mailing list