diff --git a/0001-qemu-Don-t-try-to-parse-help-for-new-QEMU.patch b/0001-qemu-Don-t-try-to-parse-help-for-new-QEMU.patch new file mode 100644 index 0000000..1575e47 --- /dev/null +++ b/0001-qemu-Don-t-try-to-parse-help-for-new-QEMU.patch @@ -0,0 +1,573 @@ +From: Jiri Denemark +Date: Wed, 12 Nov 2014 16:49:59 +0100 +Subject: [PATCH] qemu: Don't try to parse -help for new QEMU + +Since QEMU 1.2.0, we switched to QMP probing instead of parsing -help +(and other commands, such as -cpu ?) output. However, if QMP probing +failed, we still tried starting QEMU with various options and parsing +the output, which was guaranteed to fail because the output changed. +Let's just refuse parsing -help for QEMU >= 1.2.0. + +https://bugzilla.redhat.com/show_bug.cgi?id=1160318 +Signed-off-by: Jiri Denemark +(cherry picked from commit ae3e29e6e7a9a208732f22721e735d238b2aa8cb) +--- + src/qemu/qemu_capabilities.c | 10 ++ + tests/qemuhelpdata/qemu-kvm-1.2.0-device | 238 ------------------------------ + tests/qemuhelptest.c | 246 ++----------------------------- + 3 files changed, 24 insertions(+), 470 deletions(-) + delete mode 100644 tests/qemuhelpdata/qemu-kvm-1.2.0-device + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index b6c0f1b..6eb2955 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -1383,6 +1383,16 @@ int virQEMUCapsParseHelpStr(const char *qemu, + + *version = (major * 1000 * 1000) + (minor * 1000) + micro; + ++ /* Refuse to parse -help output for QEMU releases >= 1.2.0 that should be ++ * using QMP probing. ++ */ ++ if (*version >= 1002000) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("QEMU %u.%u.%u is too new for help parsing"), ++ major, minor, micro); ++ goto cleanup; ++ } ++ + if (virQEMUCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version, + qemuCaps, check_yajl) < 0) + goto cleanup; +diff --git a/tests/qemuhelpdata/qemu-kvm-1.2.0-device b/tests/qemuhelpdata/qemu-kvm-1.2.0-device +deleted file mode 100644 +index f4bfd68..0000000 +--- a/tests/qemuhelpdata/qemu-kvm-1.2.0-device ++++ /dev/null +@@ -1,238 +0,0 @@ +-name "VGA", bus PCI +-name "usb-storage", bus usb-bus +-name "scsi-hd", bus SCSI, desc "virtual SCSI disk" +-name "i82559a", bus PCI, desc "Intel i82559A Ethernet" +-name "i82559b", bus PCI, desc "Intel i82559B Ethernet" +-name "i82559c", bus PCI, desc "Intel i82559C Ethernet" +-name "esp", bus System +-name "sysbus-ohci", bus System, desc "OHCI USB Controller" +-name "virtio-blk-pci", bus PCI, alias "virtio-blk" +-name "usb-uas", bus usb-bus +-name "qxl-vga", bus PCI, desc "Spice QXL GPU (primary, vga compatible)" +-name "ide-drive", bus IDE, desc "virtual IDE disk or CD-ROM (legacy)" +-name "x3130-upstream", bus PCI, desc "TI X3130 Upstream Port of PCI Express Switch" +-name "cirrus-vga", bus PCI, desc "Cirrus CLGD 54xx VGA" +-name "ide-hd", bus IDE, desc "virtual IDE disk" +-name "ES1370", bus PCI, desc "ENSONIQ AudioPCI ES1370" +-name "ioh3420", bus PCI, desc "Intel IOH device id 3420 PCIE Root Port" +-name "sga", bus ISA, desc "Serial Graphics Adapter" +-name "scsi-block", bus SCSI, desc "SCSI block device passthrough" +-name "usb-serial", bus usb-bus +-name "pc-sysfw", bus System, desc "PC System Firmware" +-name "usb-mouse", bus usb-bus +-name "usb-net", bus usb-bus +-name "usb-hub", bus usb-bus +-name "ccid-card-emulated", bus ccid-bus, desc "emulated smartcard" +-name "ne2k_isa", bus ISA +-name "pci-assign", bus PCI +-name "scsi-generic", bus SCSI, desc "pass through generic scsi device (/dev/sg*)" +-name "pcnet", bus PCI +-name "lsi53c895a", bus PCI, alias "lsi" +-name "scsi-disk", bus SCSI, desc "virtual SCSI disk or CD-ROM (legacy)" +-name "hda-micro", bus HDA, desc "HDA Audio Codec, duplex (speaker, microphone)" +-name "pci-ohci", bus PCI, desc "Apple USB Controller" +-name "nec-usb-xhci", bus PCI +-name "xio3130-downstream", bus PCI, desc "TI X3130 Downstream Port of PCI Express Switch" +-name "virtserialport", bus virtio-serial-bus +-name "usb-redir", bus usb-bus +-name "usb-braille", bus usb-bus +-name "scsi-cd", bus SCSI, desc "virtual SCSI CD-ROM" +-name "usb-wacom-tablet", bus usb-bus, desc "QEMU PenPartner Tablet" +-name "isa-serial", bus ISA +-name "i82550", bus PCI, desc "Intel i82550 Ethernet" +-name "i82551", bus PCI, desc "Intel i82551 Ethernet" +-name "isa-debugcon", bus ISA +-name "ide-cd", bus IDE, desc "virtual IDE CD-ROM" +-name "SUNW,fdtwo", bus System +-name "ich9-usb-uhci2", bus PCI +-name "ich9-usb-uhci3", bus PCI +-name "ich9-usb-uhci1", bus PCI +-name "isa-parallel", bus ISA +-name "virtconsole", bus virtio-serial-bus +-name "ne2k_pci", bus PCI +-name "virtio-serial-pci", bus PCI, alias "virtio-serial" +-name "hda-duplex", bus HDA, desc "HDA Audio Codec, duplex (line-out, line-in)" +-name "intel-hda", bus PCI, desc "Intel HD Audio Controller" +-name "megasas", bus PCI, desc "LSI MegaRAID SAS 1078" +-name "i82559er", bus PCI, desc "Intel i82559ER Ethernet" +-name "hda-output", bus HDA, desc "HDA Audio Codec, output-only (line-out)" +-name "i82562", bus PCI, desc "Intel i82562 Ethernet" +-name "sysbus-ahci", bus System +-name "usb-ccid", bus usb-bus, desc "CCID Rev 1.1 smartcard reader" +-name "ivshmem", bus PCI +-name "AC97", bus PCI, desc "Intel 82801AA AC97 Audio" +-name "e1000", bus PCI, desc "Intel Gigabit Ethernet" +-name "sysbus-fdc", bus System +-name "usb-bt-dongle", bus usb-bus +-name "usb-tablet", bus usb-bus +-name "isa-vga", bus ISA +-name "usb-kbd", bus usb-bus +-name "isa-applesmc", bus ISA +-name "rtl8139", bus PCI +-name "qxl", bus PCI, desc "Spice QXL GPU (secondary)" +-name "i82557a", bus PCI, desc "Intel i82557A Ethernet" +-name "i82557c", bus PCI, desc "Intel i82557C Ethernet" +-name "usb-audio", bus usb-bus +-name "ib700", bus ISA +-name "piix3-usb-uhci", bus PCI +-name "i82557b", bus PCI, desc "Intel i82557B Ethernet" +-name "piix4-usb-uhci", bus PCI +-name "ccid-card-passthru", bus ccid-bus, desc "passthrough smartcard" +-name "i82801", bus PCI, desc "Intel i82801 Ethernet" +-name "smbus-eeprom", bus i2c-bus +-name "vmware-svga", bus PCI +-name "dc390", bus PCI, desc "Tekram DC-390 SCSI adapter" +-name "isa-cirrus-vga", bus ISA +-name "sb16", bus ISA, desc "Creative Sound Blaster 16" +-name "am53c974", bus PCI, desc "AMD Am53c974 PCscsi-PCI SCSI adapter" +-name "pci-bridge", bus PCI, desc "Standard PCI Bridge" +-name "i82558a", bus PCI, desc "Intel i82558A Ethernet" +-name "i82558b", bus PCI, desc "Intel i82558B Ethernet" +-name "virtio-net-pci", bus PCI, alias "virtio-net" +-name "virtio-balloon-pci", bus PCI, alias "virtio-balloon" +-name "ich9-usb-ehci1", bus PCI +-name "isa-ide", bus ISA +-name "usb-host", bus usb-bus +-name "ich9-ahci", bus PCI, alias "ahci" +-name "vt82c686b-usb-uhci", bus PCI +-name "usb-ehci", bus PCI +-name "testdev", bus ISA +-name "i6300esb", bus PCI +-name "virtio-scsi-pci", bus PCI +-pci-assign.host=pci-host-devaddr +-pci-assign.prefer_msi=on/off +-pci-assign.share_intx=on/off +-pci-assign.bootindex=int32 +-pci-assign.configfd=string +-pci-assign.addr=pci-devfn +-pci-assign.romfile=string +-pci-assign.rombar=uint32 +-pci-assign.multifunction=on/off +-pci-assign.command_serr_enable=on/off +-virtio-blk-pci.class=hex32 +-virtio-blk-pci.drive=drive +-virtio-blk-pci.logical_block_size=blocksize +-virtio-blk-pci.physical_block_size=blocksize +-virtio-blk-pci.min_io_size=uint16 +-virtio-blk-pci.opt_io_size=uint32 +-virtio-blk-pci.bootindex=int32 +-virtio-blk-pci.discard_granularity=uint32 +-virtio-blk-pci.cyls=uint32 +-virtio-blk-pci.heads=uint32 +-virtio-blk-pci.secs=uint32 +-virtio-blk-pci.serial=string +-virtio-blk-pci.scsi=on/off +-virtio-blk-pci.config-wce=on/off +-virtio-blk-pci.ioeventfd=on/off +-virtio-blk-pci.vectors=uint32 +-virtio-blk-pci.indirect_desc=on/off +-virtio-blk-pci.event_idx=on/off +-virtio-blk-pci.config-wce=on/off +-virtio-blk-pci.addr=pci-devfn +-virtio-blk-pci.romfile=string +-virtio-blk-pci.rombar=uint32 +-virtio-blk-pci.multifunction=on/off +-virtio-blk-pci.command_serr_enable=on/off +-virtio-net-pci.ioeventfd=on/off +-virtio-net-pci.vectors=uint32 +-virtio-net-pci.indirect_desc=on/off +-virtio-net-pci.event_idx=on/off +-virtio-net-pci.csum=on/off +-virtio-net-pci.guest_csum=on/off +-virtio-net-pci.gso=on/off +-virtio-net-pci.guest_tso4=on/off +-virtio-net-pci.guest_tso6=on/off +-virtio-net-pci.guest_ecn=on/off +-virtio-net-pci.guest_ufo=on/off +-virtio-net-pci.host_tso4=on/off +-virtio-net-pci.host_tso6=on/off +-virtio-net-pci.host_ecn=on/off +-virtio-net-pci.host_ufo=on/off +-virtio-net-pci.mrg_rxbuf=on/off +-virtio-net-pci.status=on/off +-virtio-net-pci.ctrl_vq=on/off +-virtio-net-pci.ctrl_rx=on/off +-virtio-net-pci.ctrl_vlan=on/off +-virtio-net-pci.ctrl_rx_extra=on/off +-virtio-net-pci.mac=macaddr +-virtio-net-pci.vlan=vlan +-virtio-net-pci.netdev=netdev +-virtio-net-pci.bootindex=int32 +-virtio-net-pci.x-txtimer=uint32 +-virtio-net-pci.x-txburst=int32 +-virtio-net-pci.tx=string +-virtio-net-pci.addr=pci-devfn +-virtio-net-pci.romfile=string +-virtio-net-pci.rombar=uint32 +-virtio-net-pci.multifunction=on/off +-virtio-net-pci.command_serr_enable=on/off +-scsi-disk.drive=drive +-scsi-disk.logical_block_size=blocksize +-scsi-disk.physical_block_size=blocksize +-scsi-disk.min_io_size=uint16 +-scsi-disk.opt_io_size=uint32 +-scsi-disk.bootindex=int32 +-scsi-disk.discard_granularity=uint32 +-scsi-disk.ver=string +-scsi-disk.serial=string +-scsi-disk.vendor=string +-scsi-disk.product=string +-scsi-disk.removable=on/off +-scsi-disk.dpofua=on/off +-scsi-disk.wwn=hex64 +-scsi-disk.channel=uint32 +-scsi-disk.scsi-id=uint32 +-scsi-disk.lun=uint32 +-PIIX4_PM.smb_io_base=uint32 +-PIIX4_PM.disable_s3=uint8 +-PIIX4_PM.disable_s4=uint8 +-PIIX4_PM.s4_val=uint8 +-PIIX4_PM.addr=pci-devfn +-PIIX4_PM.romfile=string +-PIIX4_PM.rombar=uint32 +-PIIX4_PM.multifunction=on/off +-PIIX4_PM.command_serr_enable=on/off +-usb-redir.chardev=chr +-usb-redir.debug=uint8 +-usb-redir.filter=string +-usb-redir.bootindex=int32 +-usb-redir.port=string +-usb-redir.full-path=on/off +-ide-drive.drive=drive +-ide-drive.logical_block_size=blocksize +-ide-drive.physical_block_size=blocksize +-ide-drive.min_io_size=uint16 +-ide-drive.opt_io_size=uint32 +-ide-drive.bootindex=int32 +-ide-drive.discard_granularity=uint32 +-ide-drive.ver=string +-ide-drive.wwn=hex64 +-ide-drive.serial=string +-ide-drive.model=string +-ide-drive.unit=uint32 +-usb-host.hostbus=uint32 +-usb-host.hostaddr=uint32 +-usb-host.hostport=string +-usb-host.vendorid=hex32 +-usb-host.productid=hex32 +-usb-host.isobufs=uint32 +-usb-host.bootindex=int32 +-usb-host.pipeline=on/off +-usb-host.port=string +-usb-host.full-path=on/off +-scsi-generic.drive=drive +-scsi-generic.bootindex=int32 +-scsi-generic.channel=uint32 +-scsi-generic.scsi-id=uint32 +-scsi-generic.lun=uint32 +-usb-storage.drive=drive +-usb-storage.logical_block_size=blocksize +-usb-storage.physical_block_size=blocksize +-usb-storage.min_io_size=uint16 +-usb-storage.opt_io_size=uint32 +-usb-storage.bootindex=int32 +-usb-storage.discard_granularity=uint32 +-usb-storage.serial=string +-usb-storage.removable=on/off +-usb-storage.port=string +-usb-storage.full-path=on/off +diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c +index 7e62a50..0c68367 100644 +--- a/tests/qemuhelptest.c ++++ b/tests/qemuhelptest.c +@@ -19,6 +19,7 @@ struct testInfo { + unsigned int version; + bool is_kvm; + unsigned int kvm_version; ++ int error; + }; + + static void printMismatchedFlags(virQEMUCapsPtr got, +@@ -58,8 +59,11 @@ static int testHelpStrParsing(const void *data) + goto cleanup; + + if (virQEMUCapsParseHelpStr("QEMU", help, flags, +- &version, &is_kvm, &kvm_version, false) == -1) ++ &version, &is_kvm, &kvm_version, false) == -1) { ++ if (info->error && virGetLastError()->code == info->error) ++ ret = 0; + goto cleanup; ++ } + + # ifndef WITH_YAJL + if (virQEMUCapsGet(info->flags, QEMU_CAPS_MONITOR_JSON)) +@@ -132,10 +136,10 @@ mymain(void) + { + int ret = 0; + +-# define DO_TEST(name, version, is_kvm, kvm_version, ...) \ ++# define DO_TEST_FULL(name, version, is_kvm, kvm_version, error, ...) \ + do { \ + struct testInfo info = { \ +- name, NULL, version, is_kvm, kvm_version \ ++ name, NULL, version, is_kvm, kvm_version, error \ + }; \ + if (!(info.flags = virQEMUCapsNew())) \ + return EXIT_FAILURE; \ +@@ -146,6 +150,9 @@ mymain(void) + virObjectUnref(info.flags); \ + } while (0) + ++# define DO_TEST(name, version, is_kvm, kvm_version, ...) \ ++ DO_TEST_FULL(name, version, is_kvm, kvm_version, VIR_ERR_OK, __VA_ARGS__) ++ + DO_TEST("qemu-0.9.1", 9001, 0, 0, + QEMU_CAPS_KQEMU, + QEMU_CAPS_VNC_COLON, +@@ -849,235 +856,10 @@ mymain(void) + QEMU_CAPS_OBJECT_USB_AUDIO, + QEMU_CAPS_SPLASH_TIMEOUT, + QEMU_CAPS_DEVICE_IVSHMEM); +- DO_TEST("qemu-1.2.0", 1002000, 0, 0, +- QEMU_CAPS_VNC_COLON, +- QEMU_CAPS_NO_REBOOT, +- QEMU_CAPS_DRIVE, +- QEMU_CAPS_NAME, +- QEMU_CAPS_UUID, +- QEMU_CAPS_MIGRATE_QEMU_TCP, +- QEMU_CAPS_MIGRATE_QEMU_EXEC, +- QEMU_CAPS_DRIVE_CACHE_V2, +- QEMU_CAPS_DRIVE_CACHE_UNSAFE, +- QEMU_CAPS_DRIVE_FORMAT, +- QEMU_CAPS_DRIVE_SERIAL, +- QEMU_CAPS_XEN_DOMID, +- QEMU_CAPS_DRIVE_READONLY, +- QEMU_CAPS_VGA, +- QEMU_CAPS_0_10, +- QEMU_CAPS_MEM_PATH, +- QEMU_CAPS_SDL, +- QEMU_CAPS_MIGRATE_QEMU_UNIX, +- QEMU_CAPS_CHARDEV, +- QEMU_CAPS_ENABLE_KVM, +- QEMU_CAPS_MONITOR_JSON, +- QEMU_CAPS_BALLOON, +- QEMU_CAPS_DEVICE, +- QEMU_CAPS_SMP_TOPOLOGY, +- QEMU_CAPS_NETDEV, +- QEMU_CAPS_RTC, +- QEMU_CAPS_VHOST_NET, +- QEMU_CAPS_NO_HPET, +- QEMU_CAPS_NODEFCONFIG, +- QEMU_CAPS_BOOT_MENU, +- QEMU_CAPS_FSDEV, +- QEMU_CAPS_NAME_PROCESS, +- QEMU_CAPS_SMBIOS_TYPE, +- QEMU_CAPS_VGA_QXL, +- QEMU_CAPS_SPICE, +- QEMU_CAPS_VGA_NONE, +- QEMU_CAPS_MIGRATE_QEMU_FD, +- QEMU_CAPS_BOOTINDEX, +- QEMU_CAPS_HDA_DUPLEX, +- QEMU_CAPS_DRIVE_AIO, +- QEMU_CAPS_CCID_EMULATED, +- QEMU_CAPS_CCID_PASSTHRU, +- QEMU_CAPS_CHARDEV_SPICEVMC, +- QEMU_CAPS_VIRTIO_TX_ALG, +- QEMU_CAPS_DEVICE_QXL_VGA, +- QEMU_CAPS_PCI_MULTIFUNCTION, +- QEMU_CAPS_VIRTIO_IOEVENTFD, +- QEMU_CAPS_SGA, +- QEMU_CAPS_VIRTIO_BLK_EVENT_IDX, +- QEMU_CAPS_VIRTIO_NET_EVENT_IDX, +- QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC, +- QEMU_CAPS_PIIX3_USB_UHCI, +- QEMU_CAPS_PIIX4_USB_UHCI, +- QEMU_CAPS_USB_EHCI, +- QEMU_CAPS_ICH9_USB_EHCI1, +- QEMU_CAPS_VT82C686B_USB_UHCI, +- QEMU_CAPS_PCI_OHCI, +- QEMU_CAPS_USB_REDIR, +- QEMU_CAPS_USB_HUB, +- QEMU_CAPS_NO_SHUTDOWN, +- QEMU_CAPS_PCI_ROMBAR, +- QEMU_CAPS_ICH9_AHCI, +- QEMU_CAPS_NO_ACPI, +- QEMU_CAPS_FSDEV_READONLY, +- QEMU_CAPS_VIRTIO_BLK_SCSI, +- QEMU_CAPS_VIRTIO_BLK_SG_IO, +- QEMU_CAPS_DRIVE_COPY_ON_READ, +- QEMU_CAPS_CPU_HOST, +- QEMU_CAPS_FSDEV_WRITEOUT, +- QEMU_CAPS_DRIVE_IOTUNE, +- QEMU_CAPS_SCSI_DISK_CHANNEL, +- QEMU_CAPS_SCSI_BLOCK, +- QEMU_CAPS_SCSI_CD, +- QEMU_CAPS_IDE_CD, +- QEMU_CAPS_NO_USER_CONFIG, +- QEMU_CAPS_HDA_MICRO, +- QEMU_CAPS_NEC_USB_XHCI, +- QEMU_CAPS_NETDEV_BRIDGE, +- QEMU_CAPS_SCSI_LSI, +- QEMU_CAPS_VIRTIO_SCSI, +- QEMU_CAPS_BLOCKIO, +- QEMU_CAPS_DISABLE_S3, +- QEMU_CAPS_DISABLE_S4, +- QEMU_CAPS_USB_REDIR_FILTER, +- QEMU_CAPS_IDE_DRIVE_WWN, +- QEMU_CAPS_SCSI_DISK_WWN, +- QEMU_CAPS_SECCOMP_SANDBOX, +- QEMU_CAPS_DUMP_GUEST_CORE, +- QEMU_CAPS_VNC, +- QEMU_CAPS_MACHINE_OPT, +- QEMU_CAPS_USB_REDIR_BOOTINDEX, +- QEMU_CAPS_USB_HOST_BOOTINDEX, +- QEMU_CAPS_DEVICE_QXL, +- QEMU_CAPS_DEVICE_VGA, +- QEMU_CAPS_DEVICE_CIRRUS_VGA, +- QEMU_CAPS_DEVICE_VMWARE_SVGA, +- QEMU_CAPS_DEVICE_USB_SERIAL, +- QEMU_CAPS_DEVICE_USB_NET, +- QEMU_CAPS_DTB, +- QEMU_CAPS_SCSI_MEGASAS, +- QEMU_CAPS_IPV6_MIGRATION, +- QEMU_CAPS_DEVICE_PCI_BRIDGE, +- QEMU_CAPS_DEVICE_SCSI_GENERIC, +- QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX, +- QEMU_CAPS_VNC_SHARE_POLICY, +- QEMU_CAPS_DEVICE_USB_STORAGE, +- QEMU_CAPS_DEVICE_USB_KBD, +- QEMU_CAPS_USB_STORAGE_REMOVABLE, +- QEMU_CAPS_OBJECT_USB_AUDIO, +- QEMU_CAPS_SPLASH_TIMEOUT, +- QEMU_CAPS_DEVICE_IVSHMEM); +- DO_TEST("qemu-kvm-1.2.0", 1002000, 1, 0, +- QEMU_CAPS_VNC_COLON, +- QEMU_CAPS_NO_REBOOT, +- QEMU_CAPS_DRIVE, +- QEMU_CAPS_NAME, +- QEMU_CAPS_UUID, +- QEMU_CAPS_VNET_HDR, +- QEMU_CAPS_MIGRATE_QEMU_TCP, +- QEMU_CAPS_MIGRATE_QEMU_EXEC, +- QEMU_CAPS_DRIVE_CACHE_V2, +- QEMU_CAPS_KVM, +- QEMU_CAPS_DRIVE_CACHE_UNSAFE, +- QEMU_CAPS_DRIVE_FORMAT, +- QEMU_CAPS_DRIVE_SERIAL, +- QEMU_CAPS_XEN_DOMID, +- QEMU_CAPS_DRIVE_READONLY, +- QEMU_CAPS_VGA, +- QEMU_CAPS_0_10, +- QEMU_CAPS_MEM_PATH, +- QEMU_CAPS_SDL, +- QEMU_CAPS_MIGRATE_QEMU_UNIX, +- QEMU_CAPS_CHARDEV, +- QEMU_CAPS_ENABLE_KVM, +- QEMU_CAPS_MONITOR_JSON, +- QEMU_CAPS_BALLOON, +- QEMU_CAPS_DEVICE, +- QEMU_CAPS_SMP_TOPOLOGY, +- QEMU_CAPS_NETDEV, +- QEMU_CAPS_RTC, +- QEMU_CAPS_VHOST_NET, +- QEMU_CAPS_NO_HPET, +- QEMU_CAPS_NO_KVM_PIT, +- QEMU_CAPS_PCI_CONFIGFD, +- QEMU_CAPS_NODEFCONFIG, +- QEMU_CAPS_BOOT_MENU, +- QEMU_CAPS_FSDEV, +- QEMU_CAPS_NAME_PROCESS, +- QEMU_CAPS_SMBIOS_TYPE, +- QEMU_CAPS_VGA_QXL, +- QEMU_CAPS_SPICE, +- QEMU_CAPS_VGA_NONE, +- QEMU_CAPS_MIGRATE_QEMU_FD, +- QEMU_CAPS_BOOTINDEX, +- QEMU_CAPS_HDA_DUPLEX, +- QEMU_CAPS_DRIVE_AIO, +- QEMU_CAPS_PCI_BOOTINDEX, +- QEMU_CAPS_CCID_EMULATED, +- QEMU_CAPS_CCID_PASSTHRU, +- QEMU_CAPS_CHARDEV_SPICEVMC, +- QEMU_CAPS_VIRTIO_TX_ALG, +- QEMU_CAPS_DEVICE_QXL_VGA, +- QEMU_CAPS_PCI_MULTIFUNCTION, +- QEMU_CAPS_VIRTIO_IOEVENTFD, +- QEMU_CAPS_SGA, +- QEMU_CAPS_VIRTIO_BLK_EVENT_IDX, +- QEMU_CAPS_VIRTIO_NET_EVENT_IDX, +- QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC, +- QEMU_CAPS_PIIX3_USB_UHCI, +- QEMU_CAPS_PIIX4_USB_UHCI, +- QEMU_CAPS_USB_EHCI, +- QEMU_CAPS_ICH9_USB_EHCI1, +- QEMU_CAPS_VT82C686B_USB_UHCI, +- QEMU_CAPS_PCI_OHCI, +- QEMU_CAPS_USB_REDIR, +- QEMU_CAPS_USB_HUB, +- QEMU_CAPS_NO_SHUTDOWN, +- QEMU_CAPS_PCI_ROMBAR, +- QEMU_CAPS_ICH9_AHCI, +- QEMU_CAPS_NO_ACPI, +- QEMU_CAPS_FSDEV_READONLY, +- QEMU_CAPS_VIRTIO_BLK_SCSI, +- QEMU_CAPS_VIRTIO_BLK_SG_IO, +- QEMU_CAPS_DRIVE_COPY_ON_READ, +- QEMU_CAPS_CPU_HOST, +- QEMU_CAPS_FSDEV_WRITEOUT, +- QEMU_CAPS_DRIVE_IOTUNE, +- QEMU_CAPS_SCSI_DISK_CHANNEL, +- QEMU_CAPS_SCSI_BLOCK, +- QEMU_CAPS_SCSI_CD, +- QEMU_CAPS_IDE_CD, +- QEMU_CAPS_NO_USER_CONFIG, +- QEMU_CAPS_HDA_MICRO, +- QEMU_CAPS_NEC_USB_XHCI, +- QEMU_CAPS_NETDEV_BRIDGE, +- QEMU_CAPS_SCSI_LSI, +- QEMU_CAPS_VIRTIO_SCSI, +- QEMU_CAPS_BLOCKIO, +- QEMU_CAPS_DISABLE_S3, +- QEMU_CAPS_DISABLE_S4, +- QEMU_CAPS_USB_REDIR_FILTER, +- QEMU_CAPS_IDE_DRIVE_WWN, +- QEMU_CAPS_SCSI_DISK_WWN, +- QEMU_CAPS_SECCOMP_SANDBOX, +- QEMU_CAPS_DUMP_GUEST_CORE, +- QEMU_CAPS_VNC, +- QEMU_CAPS_MACHINE_OPT, +- QEMU_CAPS_USB_REDIR_BOOTINDEX, +- QEMU_CAPS_USB_HOST_BOOTINDEX, +- QEMU_CAPS_DEVICE_QXL, +- QEMU_CAPS_DEVICE_VGA, +- QEMU_CAPS_DEVICE_CIRRUS_VGA, +- QEMU_CAPS_DEVICE_VMWARE_SVGA, +- QEMU_CAPS_DEVICE_USB_SERIAL, +- QEMU_CAPS_DEVICE_USB_NET, +- QEMU_CAPS_DTB, +- QEMU_CAPS_SCSI_MEGASAS, +- QEMU_CAPS_IPV6_MIGRATION, +- QEMU_CAPS_DEVICE_PCI_BRIDGE, +- QEMU_CAPS_DEVICE_SCSI_GENERIC, +- QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX, +- QEMU_CAPS_VNC_SHARE_POLICY, +- QEMU_CAPS_DEVICE_USB_STORAGE, +- QEMU_CAPS_DEVICE_USB_KBD, +- QEMU_CAPS_USB_STORAGE_REMOVABLE, +- QEMU_CAPS_OBJECT_USB_AUDIO, +- QEMU_CAPS_SPLASH_TIMEOUT, +- QEMU_CAPS_DEVICE_IVSHMEM); ++ DO_TEST_FULL("qemu-1.2.0", 1002000, 0, 0, VIR_ERR_CONFIG_UNSUPPORTED, ++ QEMU_CAPS_LAST); ++ DO_TEST_FULL("qemu-kvm-1.2.0", 1002000, 1, 0, VIR_ERR_CONFIG_UNSUPPORTED, ++ QEMU_CAPS_LAST); + + return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; + } diff --git a/0002-Cpu-Add-support-for-Power-LE-Architecture.patch b/0002-Cpu-Add-support-for-Power-LE-Architecture.patch new file mode 100644 index 0000000..722ab91 --- /dev/null +++ b/0002-Cpu-Add-support-for-Power-LE-Architecture.patch @@ -0,0 +1,206 @@ +From: Prerna Saxena +Date: Tue, 4 Nov 2014 22:51:26 +0530 +Subject: [PATCH] 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 +Signed-off-by: Prerna Saxena +Reviewed-by: Michal Privoznik +(cherry picked from commit da636d83dc6b1d070a705786b4daef8644eaca13) +--- + 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 6eb2955..a48f668 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", +@@ -2013,7 +2013,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: + * +@@ -3583,7 +3583,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 ||\ diff --git a/0003-PowerPC-Add-support-for-launching-VM-in-compat-mode.patch b/0003-PowerPC-Add-support-for-launching-VM-in-compat-mode.patch new file mode 100644 index 0000000..8f971a6 --- /dev/null +++ b/0003-PowerPC-Add-support-for-launching-VM-in-compat-mode.patch @@ -0,0 +1,99 @@ +From: Prerna Saxena +Date: Tue, 4 Nov 2014 22:52:44 +0530 +Subject: [PATCH] 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 : + + + power7 + + +Signed-off-by: Prerna Saxena +Signed-off-by: Li Zhang +Signed-off-by: Pradipta Kr. Banerjee +Acked-by: Michal Privoznik +(cherry picked from commit addce06c9221f948072cd222b56ea9c3f70ec066) +--- + 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 d60f274..34f6535 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -6221,7 +6221,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, +@@ -6236,6 +6238,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; diff --git a/0004-PowerPC-Improve-PVR-handling-to-fall-back-to-cpu-gen.patch b/0004-PowerPC-Improve-PVR-handling-to-fall-back-to-cpu-gen.patch new file mode 100644 index 0000000..ff133ed --- /dev/null +++ b/0004-PowerPC-Improve-PVR-handling-to-fall-back-to-cpu-gen.patch @@ -0,0 +1,92 @@ +From: Prerna Saxena +Date: Tue, 4 Nov 2014 22:58:33 +0530 +Subject: [PATCH] PowerPC:Improve PVR handling to fall back to cpu generation. + +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 +Signed-off-by: Pradipta Kr. Banerjee +Signed-off-by: Anton Blanchard +Reviewed-by: Michal Privoznik +(cherry picked from commit 1e911742287d964055f33ab76d53e673a9b4477f) +--- + 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 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + +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; + } + diff --git a/0005-docs-Add-documentation-for-compat-mode.patch b/0005-docs-Add-documentation-for-compat-mode.patch new file mode 100644 index 0000000..9c6e526 --- /dev/null +++ b/0005-docs-Add-documentation-for-compat-mode.patch @@ -0,0 +1,41 @@ +From: Prerna Saxena +Date: Tue, 4 Nov 2014 23:00:36 +0530 +Subject: [PATCH] docs: Add documentation for compat mode. + +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 +Reviewed-by: Michal Privoznik +(cherry picked from commit 9265fd19b68d787e478f5e490524da794965a5f1) +--- + 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 host-model and use + custom mode with just the CPU model from host +- capabilities XML. ++ capabilities XML. ++ (Since 1.2.11). PowerISA allows ++ processors to run VMs in binary compatibility mode supporting an ++ older version of ISA. Libvirt on PowerPC architecture uses the ++ host-model 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 : ++
++  <cpu mode='host-model'>
++    <model>power7</model>
++  </cpu>
++  ...
++ +
host-passthrough
+
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 diff --git a/0006-Test-Add-a-testcase-for-PowerPC-compat-mode-cpu-spec.patch b/0006-Test-Add-a-testcase-for-PowerPC-compat-mode-cpu-spec.patch new file mode 100644 index 0000000..99cdd06 --- /dev/null +++ b/0006-Test-Add-a-testcase-for-PowerPC-compat-mode-cpu-spec.patch @@ -0,0 +1,71 @@ +From: Prerna Saxena +Date: Tue, 4 Nov 2014 23:02:15 +0530 +Subject: [PATCH] Test: Add a testcase for PowerPC compat mode cpu + specification. + +This introduces a testcase for PowerPC compat mode cpu specification. + +Signed-off-by: Prerna Saxena +Reviewed-by: Michal Privoznik +(cherry picked from commit 12c381114ce362e49cadb730b5faabbc150a8878) +--- + .../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 @@ ++ ++ QEMUGuest1 ++ 219100 ++ 219100 ++ 4 ++ ++ hvm ++ ++ ++ power7 ++ ++ ++ ++ /usr/bin/qemu-system-ppc64 ++ ++
++ ++ ++ ++ +diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c +index 0e9fab9..90f053e 100644 +--- a/tests/qemuxml2argvtest.c ++++ b/tests/qemuxml2argvtest.c +@@ -1305,6 +1305,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); diff --git a/libvirt.spec b/libvirt.spec index 03b59d5..0402013 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -363,7 +363,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 1.2.10 -Release: 1%{?dist}%{?extra_release} +Release: 2%{?dist}%{?extra_release} License: LGPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -374,6 +374,15 @@ URL: http://libvirt.org/ %endif Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.gz +# Fix caps probing when KVM is disabled (bz #1160318) +Patch0001: 0001-qemu-Don-t-try-to-parse-help-for-new-QEMU.patch +# ppc64le fixes (bz #1163439) +Patch0002: 0002-Cpu-Add-support-for-Power-LE-Architecture.patch +Patch0003: 0003-PowerPC-Add-support-for-launching-VM-in-compat-mode.patch +Patch0004: 0004-PowerPC-Improve-PVR-handling-to-fall-back-to-cpu-gen.patch +Patch0005: 0005-docs-Add-documentation-for-compat-mode.patch +Patch0006: 0006-Test-Add-a-testcase-for-PowerPC-compat-mode-cpu-spec.patch + %if %{with_libvirtd} Requires: libvirt-daemon = %{version}-%{release} %if %{with_network} @@ -1198,6 +1207,15 @@ driver %prep %setup -q +# Fix caps probing when KVM is disabled (bz #1160318) +%patch0001 -p1 +# ppc64le fixes (bz #1163439) +%patch0002 -p1 +%patch0003 -p1 +%patch0004 -p1 +%patch0005 -p1 +%patch0006 -p1 + %build %if ! %{with_xen} %define _without_xen --without-xen @@ -2285,6 +2303,10 @@ exit 0 %doc examples/systemtap %changelog +* Sat Nov 15 2014 Cole Robinson - 1.2.10-2 +- Fix caps probing when KVM is disabled (bz #1160318) +- ppc64le fixes (bz #1163439) + * Mon Nov 3 2014 Daniel Veillard - 1.2.10 - upstream release