diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 86e911f641..d6d35803b8 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -445,6 +445,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "virtio-blk.num-queues", "machine.pseries.resize-hpt", "vmcoreinfo", + "spapr-vty", ); @@ -1673,6 +1674,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { "qemu-xhci", QEMU_CAPS_DEVICE_QEMU_XHCI }, { "spapr-pci-host-bridge", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE }, { "vmcoreinfo", QEMU_CAPS_DEVICE_VMCOREINFO }, + { "spapr-vty", QEMU_CAPS_DEVICE_SPAPR_VTY }, }; static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 17daa67a5c..3358ce202c 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -431,6 +431,7 @@ typedef enum { QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES, /* virtio-blk-*.num-queues */ QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT, /* -machine pseries,resize-hpt */ QEMU_CAPS_DEVICE_VMCOREINFO, /* -device vmcoreinfo */ + QEMU_CAPS_DEVICE_SPAPR_VTY, /* -device spapr-vty */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e3c2d7e24f..e200b77ab1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10221,6 +10221,12 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, if (qemuDomainIsPSeries(def)) { if (serial->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_VTY)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("spapr-vty not supported in this QEMU binary")); + goto error; + } + virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s", serial->info.alias); } diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml index b0ee3f1523..b7b80799c0 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml @@ -178,6 +178,7 @@ + 2010000 0 (v2.10.0) diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml index f1c9fc98a4..5ff8598fc8 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml @@ -167,6 +167,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml index 786cea8eab..e1b0074c9f 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml @@ -173,6 +173,7 @@ + 2009000 0 (v2.9.0) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b3e71aa1b7..8bd29eb79e 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1753,50 +1753,62 @@ mymain(void) DO_TEST_PARSE_ERROR("seclabel-device-duplicates", NONE); DO_TEST("pseries-basic", + QEMU_CAPS_DEVICE_SPAPR_VTY, QEMU_CAPS_NODEFCONFIG); DO_TEST("pseries-vio", + QEMU_CAPS_DEVICE_SPAPR_VTY, QEMU_CAPS_NODEFCONFIG); DO_TEST("pseries-usb-default", QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_SPAPR_VTY, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION); DO_TEST("pseries-usb-multi", QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_SPAPR_VTY, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION); DO_TEST("pseries-vio-user-assigned", + QEMU_CAPS_DEVICE_SPAPR_VTY, QEMU_CAPS_NODEFCONFIG); DO_TEST_PARSE_ERROR("pseries-vio-address-clash", QEMU_CAPS_NODEFCONFIG); DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_NVRAM); DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI, QEMU_CAPS_DEVICE_USB_KBD, + QEMU_CAPS_DEVICE_SPAPR_VTY, QEMU_CAPS_NODEFCONFIG); DO_TEST("pseries-cpu-exact", + QEMU_CAPS_DEVICE_SPAPR_VTY, QEMU_CAPS_NODEFCONFIG); DO_TEST_PARSE_ERROR("pseries-no-parallel", QEMU_CAPS_NODEFCONFIG); qemuTestSetHostArch(driver.caps, VIR_ARCH_PPC64); DO_TEST("pseries-cpu-compat", QEMU_CAPS_KVM, + QEMU_CAPS_DEVICE_SPAPR_VTY, QEMU_CAPS_NODEFCONFIG); DO_TEST("pseries-cpu-le", QEMU_CAPS_KVM, + QEMU_CAPS_DEVICE_SPAPR_VTY, QEMU_CAPS_NODEFCONFIG); DO_TEST_FAILURE("pseries-cpu-compat-power9", QEMU_CAPS_KVM); qemuTestSetHostCPU(driver.caps, cpuPower9); DO_TEST("pseries-cpu-compat-power9", QEMU_CAPS_KVM, + QEMU_CAPS_DEVICE_SPAPR_VTY, QEMU_CAPS_NODEFCONFIG); qemuTestSetHostCPU(driver.caps, NULL); qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE); DO_TEST("pseries-panic-missing", + QEMU_CAPS_DEVICE_SPAPR_VTY, QEMU_CAPS_NODEFCONFIG); DO_TEST("pseries-panic-no-address", + QEMU_CAPS_DEVICE_SPAPR_VTY, QEMU_CAPS_NODEFCONFIG); DO_TEST_FAILURE("pseries-panic-address", QEMU_CAPS_NODEFCONFIG);