[libvirt] [PATCH] qemu: Implement a stub cpuArchDriver.baseline() handler for arm

Oleg Strikov oleg.strikov at canonical.com
Mon Mar 3 13:41:03 UTC 2014


Openstack Nova calls virConnectBaselineCPU() during initialization
of the instance to get a full list of CPU features.
This patch adds a stub to arm-specific code to handle
this request (no actual work is done).

Signed-off-by: Oleg Strikov <oleg.strikov at canonical.com>
---

This is a port of the following aarch64-specific change:                         
http://libvirt.org/git/?p=libvirt.git;a=commit;h=69fba97f631c26a322bf9f2949d05c4b7c60c58a
Only function names were changed.

---
 src/cpu/cpu_arm.c |   25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index 5baff42..ec80b35 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -86,6 +86,29 @@ ArmGuestData(virCPUDefPtr host ATTRIBUTE_UNUSED,
     return VIR_CPU_COMPARE_IDENTICAL;
 }
 
+static virCPUDefPtr
+ArmBaseline(virCPUDefPtr *cpus,
+            unsigned int ncpus ATTRIBUTE_UNUSED,
+            const char **models ATTRIBUTE_UNUSED,
+            unsigned int nmodels ATTRIBUTE_UNUSED,
+            unsigned int flags)
+{
+    virCPUDefPtr cpu = NULL;
+
+    virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, NULL);
+
+    if (VIR_ALLOC(cpu) < 0 ||
+        VIR_STRDUP(cpu->model, cpus[0]->model) < 0) {
+        virCPUDefFree(cpu);
+        return NULL;
+    }
+
+    cpu->type = VIR_CPU_TYPE_GUEST;
+    cpu->match = VIR_CPU_MATCH_EXACT;
+
+    return cpu;
+}
+
 struct cpuArchDriver cpuDriverArm = {
     .name = "arm",
     .arch = archs,
@@ -96,7 +119,7 @@ struct cpuArchDriver cpuDriverArm = {
     .free = ArmDataFree,
     .nodeData = ArmNodeData,
     .guestData = ArmGuestData,
-    .baseline = NULL,
+    .baseline = ArmBaseline,
     .update = ArmUpdate,
     .hasFeature = NULL,
 };
-- 
1.7.9.5




More information about the libvir-list mailing list