[libvirt] [Patch v6 0/5] Libvirt CPU enhancements for Power KVM

This patch series is a collection of enhancements for PowerPC CPUs on PowerKVM. The v5 of this series has been acked. I have just rebased the patches on top of latest master and added a testcase. Series Summary: ========== Patch 1/5 : Introduce a new architecture 'ppc64le' for libvirt. Patch 2/5 : Add libvirt support for VMs running in 'compat' mode on Power KVM. Patch 3/5 : Improve PVR handling to fall back to cpu generation. Patch 4/5 : Add documentation describing compat mode usage for PowerPC guests. Patch 5/5 : Add a test case for compat mode. Detail: ==== * PowerPC has traditionally been a Big-endian architecture. However, with PowerPC ISA version 2.07, it can run in Little-endian mode as well. IBM Power8 processors, compliant with ISA 2.07 allow launching VMs in little-endian mode. This is signified by 'ppc64le' architecture. Patch 1 adds this support to libvirt, to allow running VMs based on ppc64le architecture. * Patch 2,3 tweak libvirt to correctly model PowerPC CPUs based on recent PowerKVM implementation. PowerKVM permits VMs with vcpus in the following allowed modes : i) Host native mode: where the vcpu seen in the VM belongs to the same processor generation as the host. Example: A POWER7 host, conforming to PowerISA version 2.06, will run VMs with "power7" vcpus. ii) Binary Compatibility ("compat") mode: PowerISA allows processors to run VMs in binary compatibility ("compat") mode supporting an older version of ISA. As an example: In compatibility mode, a POWER7 host can run a "power6" VM, conforming to power ISA v2.05. Similarly, a POWER8 host can run a "power7" VM conforming to PowerISA v2.06. QEMU has recently added support to explicitly denote a VM running in compatibility mode through commits 6d9412ea & 8dfa3a5e85. Henceforth, VMs of type (i) will be invoked with the QEMU invocation "-cpu host", while VMs of type (ii) will be invoked using "-cpu host, compat=power6". Now, an explicit cpu selection using "-cpu POWER6" is not valid. Instead, the recommended practice is to use the matching compat mode, if the requested cpu type differs from the host. Patches 2-3 address various aspects of this change. * Patch 2 : Adds support for generating the correct command line for QEMU. Existing xml semantics of 'host-model' are interpreted differently on PowerPc architecture to signify this type. * Patch 3 : PowerKVM vCPUs differ uniquely across generations ( such as power6, power7, power8). Each generation signifies a new PowerISA version that exhibits features unique to that generation. The higher order 16 bits of PVR denote the processor generation and the lower order 16 bits denote the cpu chip (sub)version. For all practical purposes of launching a VM, we care about the generation the vCPU will belong to, and not specifically the chip version. In fact, PowerKVM does not seek out specification of a unique chip version(such as POWER7_v2.3) for running a vCPU. This patch updates the libvirt PVR check to reflect this relationship. * Patch 4 : Documentation is added to explain functionality introduced by Patch 2. * Patch 5 : Added a test case for patch 2. Changelog: ========= v1 : https://www.redhat.com/archives/libvir-list/2014-June/msg01338.html v2 : http://www.redhat.com/archives/libvir-list/2014-October/msg00351.html v3 : http://www.mail-archive.com/libvir-list@redhat.com/msg104010.html v4 : http://www.mail-archive.com/libvir-list@redhat.com/msg104067.html v5 : http://www.mail-archive.com/libvir-list@redhat.com/msg104311.html Changes since v5: ================ * Added a new patch which introduces a test case for compat mode. * Fixed a whitespace in documentation patch #4. * Added listing for Power8e cpu model in cpu_map.xml Regards, -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

From 0c8b80da2f3ea85f65d5b6a7b841433d5162a3bd Mon Sep 17 00:00:00 2001 From: "Pradipta Kr. Banerjee" <bpradip@in.ibm.com> Date: Tue, 28 Oct 2014 14:41:59 +0530 Subject: [PATCH 1/5] Cpu: Add support for Power LE Architecture.
This adds support for PowerPC Little Endian architecture., and allows libvirt to spawn VMs based on 'ppc64le' architecture. Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com> Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> Acked-by: Michal Privoznik <mprivozn@redhat.com> --- src/conf/domain_conf.c | 2 +- src/cpu/cpu_powerpc.c | 2 +- src/qemu/qemu_capabilities.c | 6 +++--- src/qemu/qemu_command.c | 22 +++++++++++----------- src/qemu/qemu_domain.c | 1 + src/util/virarch.h | 3 +++ 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1b8efb1..21309b0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10043,7 +10043,7 @@ virDomainVideoDefaultType(const virDomainDef *def) (STREQ(def->os.type, "xen") || STREQ(def->os.type, "linux"))) return VIR_DOMAIN_VIDEO_TYPE_XEN; - else if (def->os.arch == VIR_ARCH_PPC64) + else if ARCH_IS_PPC64(def->os.arch) return VIR_DOMAIN_VIDEO_TYPE_VGA; else return VIR_DOMAIN_VIDEO_TYPE_CIRRUS; diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c index 67cb9ff..d591c18 100644 --- a/src/cpu/cpu_powerpc.c +++ b/src/cpu/cpu_powerpc.c @@ -38,7 +38,7 @@ VIR_LOG_INIT("cpu.cpu_powerpc"); -static const virArch archs[] = { VIR_ARCH_PPC64 }; +static const virArch archs[] = { VIR_ARCH_PPC64, VIR_ARCH_PPC64LE }; struct ppc_vendor { char *name; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ec6614a..2505d32 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -633,7 +633,7 @@ virQEMUCapsProbeCPUModels(virQEMUCapsPtr qemuCaps, uid_t runUid, gid_t runGid) if (qemuCaps->arch == VIR_ARCH_I686 || qemuCaps->arch == VIR_ARCH_X86_64) { parse = virQEMUCapsParseX86Models; - } else if (qemuCaps->arch == VIR_ARCH_PPC64) { + } else if ARCH_IS_PPC64(qemuCaps->arch) { parse = virQEMUCapsParsePPCModels; } else { VIR_DEBUG("don't know how to parse %s CPU models", @@ -2003,7 +2003,7 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps, return true; if (def->os.arch == VIR_ARCH_PPC || - def->os.arch == VIR_ARCH_PPC64) { + ARCH_IS_PPC64(def->os.arch)) { /* * Usage of pci.0 naming: * @@ -3575,7 +3575,7 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def, !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) return false; - if ((def->os.arch == VIR_ARCH_PPC) || (def->os.arch == VIR_ARCH_PPC64)) { + if ((def->os.arch == VIR_ARCH_PPC) || ARCH_IS_PPC64(def->os.arch)) { /* only pseries need -device spapr-vty with -chardev */ return (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 917639e..96071d8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -714,7 +714,7 @@ qemuSetSCSIControllerModel(virDomainDefPtr def, return -1; } } else { - if ((def->os.arch == VIR_ARCH_PPC64) && + if (ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) { *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI; } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) { @@ -1265,7 +1265,7 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def, for (i = 0; i < def->nserials; i++) { if (def->serials[i]->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && - (def->os.arch == VIR_ARCH_PPC64) && + ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) def->serials[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; if (qemuAssignSpaprVIOAddress(def, &def->serials[i]->info, @@ -1274,7 +1274,7 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def, } if (def->nvram) { - if (def->os.arch == VIR_ARCH_PPC64 && + if (ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) def->nvram->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; if (qemuAssignSpaprVIOAddress(def, &def->nvram->info, @@ -4196,7 +4196,7 @@ qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef, model = def->model; if (model == -1) { - if (domainDef->os.arch == VIR_ARCH_PPC64) + if ARCH_IS_PPC64(domainDef->os.arch) model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI; else model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI; @@ -8579,7 +8579,7 @@ qemuBuildCommandLine(virConnectPtr conn, !qemuDomainMachineIsQ35(def) && (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) || (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI) && - def->os.arch == VIR_ARCH_PPC64))) { + ARCH_IS_PPC64(def->os.arch)))) { if (usblegacy) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Multiple legacy USB controllers are " @@ -9777,7 +9777,7 @@ qemuBuildCommandLine(virConnectPtr conn, } if (def->nvram) { - if (def->os.arch == VIR_ARCH_PPC64 && + if (ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVRAM)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -9900,7 +9900,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, { virBuffer cmd = VIR_BUFFER_INITIALIZER; - if ((arch == VIR_ARCH_PPC64) && STRPREFIX(machine, "pseries")) { + if (ARCH_IS_PPC64(arch) && STRPREFIX(machine, "pseries")) { if (serial->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) { virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s", @@ -10322,7 +10322,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, if (VIR_ALLOC(def->src) < 0) goto error; - if (((dom->os.arch == VIR_ARCH_PPC64) && + if ((ARCH_IS_PPC64(dom->os.arch) && dom->os.machine && STRPREFIX(dom->os.machine, "pseries"))) def->bus = VIR_DOMAIN_DISK_BUS_SCSI; else @@ -10415,7 +10415,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, } else if (STREQ(keywords[i], "if")) { if (STREQ(values[i], "ide")) { def->bus = VIR_DOMAIN_DISK_BUS_IDE; - if (((dom->os.arch == VIR_ARCH_PPC64) && + if ((ARCH_IS_PPC64(dom->os.arch) && dom->os.machine && STRPREFIX(dom->os.machine, "pseries"))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("pseries systems do not support ide devices '%s'"), val); @@ -11660,7 +11660,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps, } if (STREQ(arg, "-cdrom")) { disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM; - if (((def->os.arch == VIR_ARCH_PPC64) && + if ((ARCH_IS_PPC64(def->os.arch) && def->os.machine && STRPREFIX(def->os.machine, "pseries"))) disk->bus = VIR_DOMAIN_DISK_BUS_SCSI; if (VIR_STRDUP(disk->dst, "hdc") < 0) @@ -11676,7 +11676,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps, disk->bus = VIR_DOMAIN_DISK_BUS_IDE; else disk->bus = VIR_DOMAIN_DISK_BUS_SCSI; - if (((def->os.arch == VIR_ARCH_PPC64) && + if ((ARCH_IS_PPC64(def->os.arch) && def->os.machine && STRPREFIX(def->os.machine, "pseries"))) disk->bus = VIR_DOMAIN_DISK_BUS_SCSI; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0caf1c0..8e91a48 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -980,6 +980,7 @@ qemuDomainDefPostParse(virDomainDefPtr def, break; case VIR_ARCH_PPC64: + case VIR_ARCH_PPC64LE: addPCIRoot = true; addDefaultUSBKBD = true; addDefaultUSBMouse = true; diff --git a/src/util/virarch.h b/src/util/virarch.h index d395e58..3206ce2 100644 --- a/src/util/virarch.h +++ b/src/util/virarch.h @@ -79,6 +79,9 @@ typedef enum { (arch) == VIR_ARCH_PPC64LE ||\ (arch) == VIR_ARCH_PPCEMB) +# define ARCH_IS_PPC64(arch) ((arch) == VIR_ARCH_PPC64 ||\ + (arch) == VIR_ARCH_PPC64LE) + # define ARCH_IS_ARM(arch) ((arch) == VIR_ARCH_ARMV6L ||\ (arch) == VIR_ARCH_ARMV7L ||\ (arch) == VIR_ARCH_ARMV7B ||\ -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

From 3ad5caf37bfa48e43c88660255e6a3bbb8afddeb Mon Sep 17 00:00:00 2001 From: Prerna Saxena <prerna@linux.vnet.ibm.com> Date: Tue, 28 Oct 2014 15:05:59 +0530
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. As an 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> --- src/conf/cpu_conf.c | 1 + src/cpu/cpu_powerpc.c | 11 ++--------- src/qemu/qemu_command.c | 10 +++++++++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 9b7fbb0..0e7a979 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -619,6 +619,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 || diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c index d591c18..4ea1835 100644 --- a/src/cpu/cpu_powerpc.c +++ b/src/cpu/cpu_powerpc.c @@ -562,8 +562,8 @@ ppcUpdate(virCPUDefPtr guest, static virCPUDefPtr ppcBaseline(virCPUDefPtr *cpus, unsigned int ncpus, - const char **models, - unsigned int nmodels, + const char **models ATTRIBUTE_UNUSED, + unsigned int nmodels ATTRIBUTE_UNUSED, unsigned int flags) { struct ppc_map *map = NULL; @@ -583,13 +583,6 @@ ppcBaseline(virCPUDefPtr *cpus, goto error; } - if (!cpuModelIsAllowed(model->name, models, nmodels)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("CPU model %s is not supported by hypervisor"), - model->name); - goto error; - } - for (i = 0; i < ncpus; i++) { const struct ppc_vendor *vnd; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 96071d8..1333c35 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6222,7 +6222,9 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver, *hasHwVirt = hasSVM > 0 ? true : false; } - if (cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) { + if ((cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) || + ((cpu->mode == VIR_CPU_MODE_HOST_MODEL) && + ARCH_IS_PPC64(def->os.arch))) { const char *mode = virCPUModeTypeToString(cpu->mode); if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_HOST)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -6237,6 +6239,12 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver, goto cleanup; } virBufferAddLit(buf, "host"); + + if (ARCH_IS_PPC64(def->os.arch) && + cpu->mode == VIR_CPU_MODE_HOST_MODEL) { + virBufferAsprintf(buf, ",compat=%s", def->cpu->model); + } + } else { if (VIR_ALLOC(guest) < 0) goto cleanup; -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

From eebc1544e28a134ce99d39b663f09ffa89b8064a Mon Sep 17 00:00:00 2001 From: Prerna Saxena <prerna@linux.vnet.ibm.com> Date: Tue, 28 Oct 2014 15:30:05 +0530
IBM Power processors differ uniquely across generations (such as power6, power7, power8). Each generation signifies a new PowerISA version that exhibits features unique to that generation. The higher 16 bits of PVR for IBM Power processors encode the CPU generation, while the CPU chip (sub)version is encoded in lower 16 bits. For all practical purposes of launching a VM, we care about the generation which the vCPU will belong to, and not specifically the chip version. This patch updates the libvirt PVR check to reflect this relationship. It allows libvirt to select the right CPU generation in case the exact match for a a specific CPU is not found. Hence, there will no longer be a need to add each PowerPC CPU model to cpu_map.xml; just adding entry for the matching ISA generation will suffice. It also contains changes to cpu_map.xml since processor generations as understood by QEMU compat mode go as "power6", "power7" or "power8" [Reference : QEMU commit 8dfa3a5e85 ] Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com> Signed-off-by: Anton Blanchard <anton@samba.org> Acked-by: Michal Privoznik <mprivozn@redhat.com> --- src/cpu/cpu_map.xml | 30 ++++++++++++++++++++++++++++++ src/cpu/cpu_powerpc.c | 8 ++++++++ 2 files changed, 38 insertions(+) diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml index 18c7b0d..bd9b056 100644 --- a/src/cpu/cpu_map.xml +++ b/src/cpu/cpu_map.xml @@ -627,5 +627,35 @@ <pvr value='0x004b0100'/> </model> + <model name='power6'> + <vendor name='IBM'/> + <compat isa='2.05'/> + <pvr value='0x003e0000'/> + </model> + + <model name='power7'> + <vendor name='IBM'/> + <compat isa='2.06'/> + <pvr value='0x003f0000'/> + </model> + + <model name='power7+'> + <vendor name='IBM'/> + <compat isa='2.06B'/> + <pvr value='0x004a0000'/> + </model> + + <model name='power8e'> + <vendor name='IBM'/> + <compat isa='2.07'/> + <pvr value='0x004b0000'/> + </model> + + <model name='power8'> + <vendor name='IBM'/> + <compat isa='2.07'/> + <pvr value='0x004d0000'/> + </model> + </arch> </cpus> diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c index 4ea1835..531868c 100644 --- a/src/cpu/cpu_powerpc.c +++ b/src/cpu/cpu_powerpc.c @@ -99,6 +99,14 @@ ppcModelFindPVR(const struct ppc_map *map, model = model->next; } + /* PowerPC Processor Version Register is interpreted as follows : + * Higher order 16 bits : Power ISA generation. + * Lower order 16 bits : CPU chip version number. + * If the exact CPU isnt found, return the nearest matching CPU generation + */ + if (pvr & 0x0000FFFFul) + return ppcModelFindPVR(map, (pvr & 0xFFFF0000ul)); + return NULL; } -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

From 23f49711d74fae7905defa1524d7e4ab838c7838 Mon Sep 17 00:00:00 2001 From: Prerna Saxena <prerna@linux.vnet.ibm.com> Date: Fri, 31 Oct 2014 15:13:16 +0530
Add documentation to explain how compat-mode can be invoked with libvirt running on PowerPC architecture. It also mentions that this change is available libvirt 1.2.11 onwards. Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- docs/formatdomain.html.in | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 0099ce7..bdaf808 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1047,7 +1047,20 @@ (such as CPUID level) that don't work. Until these issues are fixed, it's a good idea to avoid using <code>host-model</code> and use <code>custom</code> mode with just the CPU model from host - capabilities XML.</dd> + capabilities XML. + <span class="since">(Since 1.2.11)</span>. PowerISA allows + processors to run VMs in binary compatibility mode supporting an + older version of ISA. Libvirt on PowerPC architecture uses the + <code>host-model</code> to signify a guest mode CPU running in + binary compatibility mode. Example: + When a user needs a power7 VM to run in compatibility mode + on a Power8 host, this can be described in XML as follows : +<pre> + <cpu mode='host-model'> + <model>power7</model> + </cpu> + ...</pre> + </dd> <dt><code>host-passthrough</code></dt> <dd>With this mode, the CPU visible to the guest should be exactly the same as the host CPU even in the aspects that libvirt does not -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

From 88879d7eac1237b2f6ef67cb5890cb46055d56dc Mon Sep 17 00:00:00 2001 From: Prerna Saxena <prerna@linux.vnet.ibm.com> Date: Mon, 3 Nov 2014 15:53:08 +0530
This introduces a testcase for PowerPC compat mode cpu specification. Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- .../qemuxml2argv-pseries-cpu-compat.args | 8 ++++++++ .../qemuxml2argv-pseries-cpu-compat.xml | 20 ++++++++++++++++++++ tests/qemuxml2argvtest.c | 2 ++ 3 files changed, 30 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args new file mode 100644 index 0000000..64df406 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args @@ -0,0 +1,8 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \ +QEMU_AUDIO_DRV=none /usr/bin/qemu-system-ppc64 -S -M pseries \ +-cpu host,compat=power7 \ +-m 214 -smp 4 -nographic -nodefconfig -nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb \ +-chardev pty,id=charserial0 \ +-device spapr-vty,chardev=charserial0,reg=0x30000000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.xml new file mode 100644 index 0000000..e34a8ad --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.xml @@ -0,0 +1,20 @@ +<domain type='kvm'> + <name>QEMUGuest1</name> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>4</vcpu> + <os> + <type arch='ppc64' machine='pseries'>hvm</type> + </os> + <cpu mode='host-model'> + <model>power7</model> + </cpu> + <clock offset='utc'/> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <console type='pty'> + <address type="spapr-vio"/> + </console> + <memballoon model="none"/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index abdf516..2a1ca4b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1308,6 +1308,8 @@ mymain(void) QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); DO_TEST("pseries-cpu-exact", QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); + DO_TEST("pseries-cpu-compat", QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST, + QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); DO_TEST("disk-ide-drive-split", QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_IDE_CD); -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

On 04.11.2014 18:19, Prerna Saxena wrote:
This patch series is a collection of enhancements for PowerPC CPUs on PowerKVM. The v5 of this series has been acked. I have just rebased the patches on top of latest master and added a testcase.
Series Summary: ========== Patch 1/5 : Introduce a new architecture 'ppc64le' for libvirt. Patch 2/5 : Add libvirt support for VMs running in 'compat' mode on Power KVM. Patch 3/5 : Improve PVR handling to fall back to cpu generation. Patch 4/5 : Add documentation describing compat mode usage for PowerPC guests. Patch 5/5 : Add a test case for compat mode.
ACKed and pushed. Michal
participants (2)
-
Michal Privoznik
-
Prerna Saxena