9119d9
From 613c26c910fb69cc7c69677f637b80e162250094 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <613c26c910fb69cc7c69677f637b80e162250094@dist-git>
9119d9
From: Prerna Saxena <prerna@linux.vnet.ibm.com>
9119d9
Date: Thu, 15 Jan 2015 12:57:16 +0100
9119d9
Subject: [PATCH] Format CPU features even for host-model
9119d9
MIME-Version: 1.0
9119d9
Content-Type: text/plain; charset=UTF-8
9119d9
Content-Transfer-Encoding: 8bit
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1182448
9119d9
9119d9
Partial backport of the upstream commit:
9119d9
PowerPC : Add support for launching VM in 'compat' mode.
9119d9
9119d9
PowerISA allows processors to run VMs in binary compatibility ("compat")
9119d9
mode supporting an older version of ISA. QEMU has recently added support to
9119d9
explicitly denote a VM running in compatibility mode through commit 6d9412ea
9119d9
& 8dfa3a5e85. Now, a "compat" mode VM can be run by invoking this qemu
9119d9
commandline on a POWER8 host:  -cpu host,compat=power7.
9119d9
9119d9
This patch allows libvirt to exploit cpu mode 'host-model' to describe this
9119d9
new mode for PowerKVM guests. For example, when a user wants to request a
9119d9
power7 vm to run in compatibility mode on a Power8 host, this can be
9119d9
described in XML as follows :
9119d9
9119d9
  <cpu mode='host-model'>
9119d9
    <model>power7</model>
9119d9
  </cpu>
9119d9
9119d9
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
9119d9
Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
9119d9
Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com>
9119d9
Acked-by: Michal Privoznik <mprivozn@redhat.com>
9119d9
(cherry picked from commit addce06c9221f948072cd222b56ea9c3f70ec066)
9119d9
Signed-off-by: Ján Tomko <jtomko@redhat.com>
9119d9
9119d9
My upstream commit dd324bb2703b9cf619c521b2a04f186cd9734f0a
9119d9
    Do not format CPU features without a model
9119d9
for bug https://bugzilla.redhat.com/show_bug.cgi?id=1151885 only formats
9119d9
the features if 'formatModel' is set if we need to format features, but
9119d9
without this patch, it's not done for host-model.
9119d9
9119d9
Conflicts:
9119d9
	src/qemu/qemu_command.c (in the part omitted from this backport)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/conf/cpu_conf.c | 1 +
9119d9
 1 file changed, 1 insertion(+)
9119d9
9119d9
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
9119d9
index 95e04c7..8388f44 100644
9119d9
--- a/src/conf/cpu_conf.c
9119d9
+++ b/src/conf/cpu_conf.c
9119d9
@@ -622,6 +622,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
9119d9
         return 0;
9119d9
 
9119d9
     formatModel = (def->mode == VIR_CPU_MODE_CUSTOM ||
9119d9
+                   def->mode == VIR_CPU_MODE_HOST_MODEL ||
9119d9
                    (flags & VIR_DOMAIN_XML_UPDATE_CPU));
9119d9
     formatFallback = (def->type == VIR_CPU_TYPE_GUEST &&
9119d9
                       (def->mode == VIR_CPU_MODE_HOST_MODEL ||
9119d9
-- 
9119d9
2.2.1
9119d9