>From cddaae164145043dd57546fa93ab49ada0e25ec1 Mon Sep 17 00:00:00 2001 From: "Pradipta Kr. Banerjee" <bpradip@xxxxxxxxxx> Date: Tue, 28 Oct 2014 14:41:59 +0530 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@xxxxxxxxxx> Signed-off-by: Prerna Saxena <prerna@xxxxxxxxxxxxxxxxxx> --- 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 39befb0..1d3b864 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10032,7 +10032,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 6fcb5c7..bb59a36 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: * @@ -3573,7 +3573,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 2e5af4f..d60f274 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -713,7 +713,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)) { @@ -1264,7 +1264,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, @@ -1273,7 +1273,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, @@ -4195,7 +4195,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; @@ -8573,7 +8573,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 " @@ -9771,7 +9771,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", @@ -9894,7 +9894,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", @@ -10316,7 +10316,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 @@ -10409,7 +10409,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); @@ -11654,7 +11654,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) @@ -11670,7 +11670,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 76fccce..e4edf34 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 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list