[libvirt] [PATCH 01/41] cpu_x86: Propagate vendor to guest's virCPUData

Jiri Denemark jdenemar at redhat.com
Wed Jun 8 08:22:15 UTC 2016


When computing CPU data for a given guest CPU we should set CPUID vendor
bits appropriately so that we don't lose the vendor when transforming
CPU data back to XML description.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/cpu/cpu_x86.c                                                   | 5 +++++
 tests/cputestdata/x86-host+host+host-model,models,Penryn-result.xml | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index d0cb653..a05cea6 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1488,6 +1488,11 @@ x86Compute(virCPUDefPtr host,
         if (!(guest_model = x86ModelCopy(host_model)))
             goto error;
 
+        if (cpu->vendor &&
+            virCPUx86DataAddCPUID(guest_model->data,
+                                  &host_model->vendor->cpuid) < 0)
+            goto error;
+
         if (cpu->type == VIR_CPU_TYPE_GUEST
             && cpu->match == VIR_CPU_MATCH_EXACT)
             x86DataSubtract(guest_model->data, diff->data);
diff --git a/tests/cputestdata/x86-host+host+host-model,models,Penryn-result.xml b/tests/cputestdata/x86-host+host+host-model,models,Penryn-result.xml
index 2696356..63d5e90 100644
--- a/tests/cputestdata/x86-host+host+host-model,models,Penryn-result.xml
+++ b/tests/cputestdata/x86-host+host+host-model,models,Penryn-result.xml
@@ -1,6 +1,7 @@
 <cpu mode='custom' match='exact'>
   <arch>x86_64</arch>
   <model fallback='allow'>core2duo</model>
+  <vendor>Intel</vendor>
   <feature policy='require' name='ds'/>
   <feature policy='require' name='acpi'/>
   <feature policy='require' name='ss'/>
-- 
2.8.3




More information about the libvir-list mailing list