Blob Blame History Raw
From 613c26c910fb69cc7c69677f637b80e162250094 Mon Sep 17 00:00:00 2001
Message-Id: <613c26c910fb69cc7c69677f637b80e162250094@dist-git>
From: Prerna Saxena <prerna@linux.vnet.ibm.com>
Date: Thu, 15 Jan 2015 12:57:16 +0100
Subject: [PATCH] Format CPU features even for host-model
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

https://bugzilla.redhat.com/show_bug.cgi?id=1182448

Partial backport of the upstream commit:
PowerPC : Add support for launching VM in 'compat' mode.

PowerISA allows processors to run VMs in binary compatibility ("compat")
mode supporting an older version of ISA. QEMU has recently added support to
explicitly denote a VM running in compatibility mode through commit 6d9412ea
& 8dfa3a5e85. Now, a "compat" mode VM can be run by invoking this qemu
commandline on a POWER8 host:  -cpu host,compat=power7.

This patch allows libvirt to exploit cpu mode 'host-model' to describe this
new mode for PowerKVM guests. For example, when a user wants to request a
power7 vm to run in compatibility mode on a Power8 host, this can be
described in XML as follows :

  <cpu mode='host-model'>
    <model>power7</model>
  </cpu>

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit addce06c9221f948072cd222b56ea9c3f70ec066)
Signed-off-by: Ján Tomko <jtomko@redhat.com>

My upstream commit dd324bb2703b9cf619c521b2a04f186cd9734f0a
    Do not format CPU features without a model
for bug https://bugzilla.redhat.com/show_bug.cgi?id=1151885 only formats
the features if 'formatModel' is set if we need to format features, but
without this patch, it's not done for host-model.

Conflicts:
	src/qemu/qemu_command.c (in the part omitted from this backport)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/conf/cpu_conf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 95e04c7..8388f44 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -622,6 +622,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
         return 0;
 
     formatModel = (def->mode == VIR_CPU_MODE_CUSTOM ||
+                   def->mode == VIR_CPU_MODE_HOST_MODEL ||
                    (flags & VIR_DOMAIN_XML_UPDATE_CPU));
     formatFallback = (def->type == VIR_CPU_TYPE_GUEST &&
                       (def->mode == VIR_CPU_MODE_HOST_MODEL ||
-- 
2.2.1