Build commandlines for character devices via JSON.

For devices using 'VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL' address
type 'qemuBuildDeviceAddressProps' will now generate the address. The
only special property is 'nr'. QEMU declares it as:

  nr=<uint32>            -  (default: 4294967295)

The test fallout is caused by formatting addresses as decimal numbers
instead of hex as described in the commit which added
'qemuBuildDeviceAddressProps'.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 src/qemu/qemu_command.c                       | 224 ++++++++++--------
 src/qemu/qemu_command.h                       |  10 +-
 src/qemu/qemu_hotplug.c                       |   8 +-
 ...ault-cpu-kvm-pseries-2.7.ppc64-latest.args |   2 +-
 ...ault-cpu-kvm-pseries-3.1.ppc64-latest.args |   2 +-
 ...ault-cpu-kvm-pseries-4.2.ppc64-latest.args |   2 +-
 ...ault-cpu-tcg-pseries-2.7.ppc64-latest.args |   2 +-
 ...ault-cpu-tcg-pseries-3.1.ppc64-latest.args |   2 +-
 ...ault-cpu-tcg-pseries-4.2.ppc64-latest.args |   2 +-
 .../ppc64-pseries-graphics.ppc64-latest.args  |   2 +-
 .../ppc64-pseries-headless.ppc64-latest.args  |   2 +-
 tests/qemuxml2argvdata/pseries-basic.args     |   2 +-
 .../pseries-cpu-compat-power9.args            |   2 +-
 .../qemuxml2argvdata/pseries-cpu-compat.args  |   2 +-
 tests/qemuxml2argvdata/pseries-cpu-exact.args |   2 +-
 tests/qemuxml2argvdata/pseries-cpu-le.args    |   2 +-
 .../pseries-panic-missing.args                |   2 +-
 .../pseries-panic-no-address.args             |   2 +-
 .../pseries-serial-native.args                |   2 +-
 .../qemuxml2argvdata/pseries-usb-default.args |   2 +-
 tests/qemuxml2argvdata/pseries-usb-kbd.args   |   2 +-
 tests/qemuxml2argvdata/pseries-usb-multi.args |   2 +-
 .../pseries-vio-user-assigned.args            |   4 +-
 tests/qemuxml2argvdata/pseries-vio.args       |   4 +-
 .../qemuxml2argvdata/s390-panic-missing.args  |   2 +-
 .../serial-dev-chardev-iobase.args            |   2 +-
 .../tpm-emulator-spapr.ppc64-latest.args      |   4 +-
 27 files changed, 163 insertions(+), 133 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 81b1eb5980..954513ce83 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -745,8 +745,27 @@ qemuBuildDeviceAddressProps(virJSONValue *props,
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE:
         return qemuBuildDeviceAddresDriveProps(props, domainDef, info);

+    case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL: {
+        const char *contAlias;
+        g_autofree char *bus = NULL;
+
+        if (!(contAlias = virDomainControllerAliasFind(domainDef,
+                                                       
VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
+                                                       
info->addr.vioserial.controller)))
+            return -1;
+
+        bus = g_strdup_printf("%s.%d", contAlias, info->addr.vioserial.bus);
+
+        if (virJSONValueObjectAdd(props,
+                                  "s:bus", bus,
+                                  "i:nr", info->addr.vioserial.port,
+                                  NULL) < 0)
+            return -1;
+
+        return 0;
+    }
+
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE:
-    case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL:
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID:
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390:
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
@@ -5658,19 +5677,21 @@ qemuBuildMonitorCommandLine(virLogManager *logManager,
 }


-static char *
-qemuBuildVirtioSerialPortDevStr(const virDomainDef *def,
-                                virDomainChrDef *dev)
+static virJSONValue *
+qemuBuildVirtioSerialPortDevProps(const virDomainDef *def,
+                                  virDomainChrDef *dev)
 {
-    g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
-    const char *contAlias;
+    g_autoptr(virJSONValue) props = NULL;
+    const char *driver;
+    const char *targetname = NULL;
+    g_autofree char *chardev = NULL;

     switch (dev->deviceType) {
     case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
-        virBufferAddLit(&buf, "virtconsole");
+        driver = "virtconsole";
         break;
     case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL:
-        virBufferAddLit(&buf, "virtserialport");
+        driver = "virtserialport";
         break;
     default:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -5687,14 +5708,6 @@ qemuBuildVirtioSerialPortDevStr(const virDomainDef *def,
             return NULL;
         }

-        contAlias = virDomainControllerAliasFind(def, 
VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
-                                                 
dev->info.addr.vioserial.controller);
-        if (!contAlias)
-            return NULL;
-
-        virBufferAsprintf(&buf, ",bus=%s.%d,nr=%d", contAlias,
-                          dev->info.addr.vioserial.bus,
-                          dev->info.addr.vioserial.port);
     }

     if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
@@ -5707,29 +5720,50 @@ qemuBuildVirtioSerialPortDevStr(const virDomainDef *def,
         return NULL;
     }

-    virBufferAsprintf(&buf, ",chardev=char%s,id=%s",
-                      dev->info.alias, dev->info.alias);
+    if (virJSONValueObjectCreate(&props,
+                                 "s:driver", driver,
+                                 NULL) < 0)
+        return NULL;
+
+    if (qemuBuildDeviceAddressProps(props, def, &dev->info) < 0)
+        return NULL;
+
+    chardev = g_strdup_printf("char%s", dev->info.alias);
+
     if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
         (dev->source->type == VIR_DOMAIN_CHR_TYPE_SPICEVMC ||
          dev->target.name)) {
-        virBufferAsprintf(&buf, ",name=%s", dev->target.name
-                          ? dev->target.name : "com.redhat.spice.0");
+        if (dev->target.name)
+            targetname = dev->target.name;
+        else
+            targetname = "com.redhat.spice.0";
     }

-    return virBufferContentAndReset(&buf);
+    if (virJSONValueObjectAdd(props,
+                              "s:chardev", chardev,
+                              "s:id", dev->info.alias,
+                              "S:name", targetname,
+                              NULL) < 0)
+        return NULL;
+
+    return g_steal_pointer(&props);
 }

-static char *
-qemuBuildSclpDevStr(virDomainChrDef *dev)
+
+static virJSONValue *
+qemuBuildSclpDevProps(virDomainChrDef *dev)
 {
-    g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+    g_autoptr(virJSONValue) props = NULL;
+    g_autofree char *chardev = g_strdup_printf("char%s", dev->info.alias);
+    const char *driver = NULL;
+
     if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE) {
         switch (dev->targetType) {
         case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP:
-            virBufferAddLit(&buf, "sclpconsole");
+            driver = "sclpconsole";
             break;
         case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM:
-            virBufferAddLit(&buf, "sclplmconsole");
+            driver = "sclplmconsole";
             break;
         }
     } else {
@@ -5737,10 +5771,15 @@ qemuBuildSclpDevStr(virDomainChrDef *dev)
                        _("Cannot use slcp with devices other than console"));
         return NULL;
     }
-    virBufferAsprintf(&buf, ",chardev=char%s,id=%s",
-                      dev->info.alias, dev->info.alias);

-    return virBufferContentAndReset(&buf);
+    if (virJSONValueObjectCreate(&props,
+                                 "s:driver", driver,
+                                 "s:chardev", chardev,
+                                 "s:id", dev->info.alias,
+                                 NULL) < 0)
+        return NULL;
+
+    return g_steal_pointer(&props);
 }


@@ -9460,12 +9499,14 @@ qemuBuildChrDeviceCommandLine(virCommand *cmd,
                               virDomainChrDef *chr,
                               virQEMUCaps *qemuCaps)
 {
-    g_autofree char *devstr = NULL;
+    g_autoptr(virJSONValue) props = NULL;

-    if (qemuBuildChrDeviceStr(&devstr, def, chr, qemuCaps) < 0)
+    if (!(props = qemuBuildChrDeviceProps(def, chr, qemuCaps)))
+        return -1;
+
+    if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0)
         return -1;

-    virCommandAddArgList(cmd, "-device", devstr, NULL);
     return 0;
 }

@@ -10914,16 +10955,13 @@ qemuBuildCommandLine(virQEMUDriver *driver,
 }


-/* This function generates the correct '-device' string for character
- * devices of each architecture.
- */
-static int
-qemuBuildSerialChrDeviceStr(char **deviceStr,
-                            const virDomainDef *def,
-                            virDomainChrDef *serial,
-                            virQEMUCaps *qemuCaps)
+static virJSONValue *
+qemuBuildSerialChrDeviceProps(const virDomainDef *def,
+                              virDomainChrDef *serial,
+                              virQEMUCaps *qemuCaps)
 {
-    g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+    g_autoptr(virJSONValue) props = NULL;
+    g_autofree char *chardev = g_strdup_printf("char%s", serial->info.alias);
     virQEMUCapsFlags caps;

     switch ((virDomainChrSerialTargetModel) serial->targetModel) {
@@ -10940,7 +10978,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("'%s' is not supported in this QEMU binary"),
                            
virDomainChrSerialTargetModelTypeToString(serial->targetModel));
-            return -1;
+            return NULL;
         }
         break;

@@ -10954,27 +10992,37 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
          * branch and we will not have ended up here. */
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Invalid target model for serial device"));
-        return -1;
+        return NULL;
     }

-    virBufferAsprintf(&buf, "%s,chardev=char%s,id=%s",
-                      
virDomainChrSerialTargetModelTypeToString(serial->targetModel),
-                      serial->info.alias, serial->info.alias);
+    if (virJSONValueObjectCreate(&props,
+                                 "s:driver", 
virDomainChrSerialTargetModelTypeToString(serial->targetModel),
+                                 "s:chardev", chardev,
+                                 "s:id", serial->info.alias,
+                                 NULL) < 0)
+        return NULL;

-    if (qemuBuildDeviceAddressStr(&buf, def, &serial->info) < 0)
-        return -1;
+    if (qemuBuildDeviceAddressProps(props, def, &serial->info) < 0)
+        return NULL;

-    *deviceStr = virBufferContentAndReset(&buf);
-    return 0;
+    return g_steal_pointer(&props);
 }

-static int
-qemuBuildParallelChrDeviceStr(char **deviceStr,
-                              virDomainChrDef *chr)
+
+static virJSONValue *
+qemuBuildParallelChrDeviceProps(virDomainChrDef *chr)
 {
-    *deviceStr = g_strdup_printf("isa-parallel,chardev=char%s,id=%s",
-                                 chr->info.alias, chr->info.alias);
-    return 0;
+    g_autoptr(virJSONValue) props = NULL;
+    g_autofree char *chardev = g_strdup_printf("char%s", chr->info.alias);
+
+    if (virJSONValueObjectCreate(&props,
+                                 "s:driver", "isa-parallel",
+                                 "s:chardev", chardev,
+                                 "s:id", chr->info.alias,
+                                 NULL) < 0)
+        return NULL;
+
+    return g_steal_pointer(&props);
 }


@@ -11013,48 +11061,38 @@ qemuBuildChannelGuestfwdNetdevProps(virDomainChrDef 
*chr)
 }


-static int
-qemuBuildChannelChrDeviceStr(char **deviceStr,
-                             const virDomainDef *def,
-                             virDomainChrDef *chr)
+static virJSONValue *
+qemuBuildChannelChrDeviceProps(const virDomainDef *def,
+                               virDomainChrDef *chr)
 {
     switch ((virDomainChrChannelTargetType)chr->targetType) {
     case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
-        if (!(*deviceStr = qemuBuildVirtioSerialPortDevStr(def, chr)))
-            return -1;
-        break;
+        return qemuBuildVirtioSerialPortDevProps(def, chr);

     case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD:
         /* guestfwd is as a netdev handled separately */
     case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN:
     case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE:
     case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST:
-        return -1;
+        break;
     }

-    return 0;
+    return NULL;
 }

-static int
-qemuBuildConsoleChrDeviceStr(char **deviceStr,
-                             const virDomainDef *def,
-                             virDomainChrDef *chr)
+static virJSONValue *
+qemuBuildConsoleChrDeviceProps(const virDomainDef *def,
+                               virDomainChrDef *chr)
 {
     switch ((virDomainChrConsoleTargetType)chr->targetType) {
     case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP:
     case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM:
-        if (!(*deviceStr = qemuBuildSclpDevStr(chr)))
-            return -1;
-        break;
+        return qemuBuildSclpDevProps(chr);

     case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO:
-        if (!(*deviceStr = qemuBuildVirtioSerialPortDevStr(def, chr)))
-            return -1;
-        break;
+        return qemuBuildVirtioSerialPortDevProps(def, chr);

     case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL:
-        break;
-
     case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE:
     case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN:
     case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML:
@@ -11064,42 +11102,36 @@ qemuBuildConsoleChrDeviceStr(char **deviceStr,
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("unsupported console target type %s"),
                        
NULLSTR(virDomainChrConsoleTargetTypeToString(chr->targetType)));
-        return -1;
+        break;
     }

-    return 0;
+    return NULL;
 }

-int
-qemuBuildChrDeviceStr(char **deviceStr,
-                      const virDomainDef *vmdef,
-                      virDomainChrDef *chr,
-                      virQEMUCaps *qemuCaps)
-{
-    int ret = -1;

+virJSONValue *
+qemuBuildChrDeviceProps(const virDomainDef *vmdef,
+                        virDomainChrDef *chr,
+                        virQEMUCaps *qemuCaps)
+{
     switch ((virDomainChrDeviceType)chr->deviceType) {
     case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL:
-        ret = qemuBuildSerialChrDeviceStr(deviceStr, vmdef, chr, qemuCaps);
-        break;
+        return qemuBuildSerialChrDeviceProps(vmdef, chr, qemuCaps);

     case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL:
-        ret = qemuBuildParallelChrDeviceStr(deviceStr, chr);
-        break;
+        return qemuBuildParallelChrDeviceProps(chr);

     case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL:
-        ret = qemuBuildChannelChrDeviceStr(deviceStr, vmdef, chr);
-        break;
+        return qemuBuildChannelChrDeviceProps(vmdef, chr);

     case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
-        ret = qemuBuildConsoleChrDeviceStr(deviceStr, vmdef, chr);
-        break;
+        return qemuBuildConsoleChrDeviceProps(vmdef, chr);

     case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST:
-        return ret;
+        break;
     }

-    return ret;
+    return NULL;
 }


diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index cf57fc9a41..65e896b634 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -79,12 +79,10 @@ int qemuBuildTLSx509BackendProps(const char *tlspath,
 int
 qemuOpenChrChardevUNIXSocket(const virDomainChrSourceDef *dev) 
G_GNUC_NO_INLINE;

-/* Generate '-device' string for chardev device */
-int
-qemuBuildChrDeviceStr(char **deviceStr,
-                      const virDomainDef *vmdef,
-                      virDomainChrDef *chr,
-                      virQEMUCaps *qemuCaps);
+virJSONValue *
+qemuBuildChrDeviceProps(const virDomainDef *vmdef,
+                        virDomainChrDef *chr,
+                        virQEMUCaps *qemuCaps);

 virJSONValue *
 qemuBuildChannelGuestfwdNetdevProps(virDomainChrDef *chr);
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index f55cedc784..c7da38b49b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2181,7 +2181,7 @@ int qemuDomainAttachChrDevice(virQEMUDriver *driver,
     qemuDomainObjPrivate *priv = vm->privateData;
     virErrorPtr orig_err;
     virDomainDef *vmdef = vm->def;
-    g_autofree char *devstr = NULL;
+    g_autoptr(virJSONValue) devprops = NULL;
     g_autoptr(virJSONValue) netdevprops = NULL;
     virDomainChrSourceDef *dev = chr->source;
     g_autofree char *charAlias = NULL;
@@ -2224,7 +2224,7 @@ int qemuDomainAttachChrDevice(virQEMUDriver *driver,
         if (!(netdevprops = qemuBuildChannelGuestfwdNetdevProps(chr)))
             goto cleanup;
     } else {
-        if (qemuBuildChrDeviceStr(&devstr, vmdef, chr, priv->qemuCaps) < 0)
+        if (!(devprops = qemuBuildChrDeviceProps(vmdef, chr, priv->qemuCaps)))
             goto cleanup;
     }

@@ -2251,8 +2251,8 @@ int qemuDomainAttachChrDevice(virQEMUDriver *driver,
             goto exit_monitor;
     }

-    if (devstr) {
-        if (qemuMonitorAddDevice(priv->mon, devstr) < 0)
+    if (devprops) {
+        if (qemuMonitorAddDeviceProps(priv->mon, &devprops) < 0)
             goto exit_monitor;
     }

diff --git 
a/tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-2.7.ppc64-latest.args 
b/tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-2.7.ppc64-latest.args
index dde5d44d45..8a6f0a94fb 100644
--- a/tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-2.7.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-2.7.ppc64-latest.args
@@ -30,7 +30,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
 -blockdev 
'{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage"}'
 \
 -device 
virtio-blk-pci,bus=pci.0,addr=0x2,drive=libvirt-1-format,id=virtio-disk0,bootindex=1
 \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -audiodev id=audio1,driver=none \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
 -sandbox 
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
diff --git 
a/tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-3.1.ppc64-latest.args 
b/tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-3.1.ppc64-latest.args
index a4aaea7571..2362c5a057 100644
--- a/tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-3.1.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-3.1.ppc64-latest.args
@@ -30,7 +30,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
 -blockdev 
'{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage"}'
 \
 -device 
virtio-blk-pci,bus=pci.0,addr=0x2,drive=libvirt-1-format,id=virtio-disk0,bootindex=1
 \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -audiodev id=audio1,driver=none \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
 -sandbox 
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
diff --git 
a/tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-4.2.ppc64-latest.args 
b/tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-4.2.ppc64-latest.args
index a8b22d3e48..ed62c92c12 100644
--- a/tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-4.2.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-4.2.ppc64-latest.args
@@ -30,7 +30,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
 -blockdev 
'{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage"}'
 \
 -device 
virtio-blk-pci,bus=pci.0,addr=0x2,drive=libvirt-1-format,id=virtio-disk0,bootindex=1
 \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -audiodev id=audio1,driver=none \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
 -sandbox 
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
diff --git 
a/tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-2.7.ppc64-latest.args 
b/tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-2.7.ppc64-latest.args
index 576f97261b..5b9d07c46e 100644
--- a/tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-2.7.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-2.7.ppc64-latest.args
@@ -30,7 +30,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
 -blockdev 
'{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage"}'
 \
 -device 
virtio-blk-pci,bus=pci.0,addr=0x2,drive=libvirt-1-format,id=virtio-disk0,bootindex=1
 \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -audiodev id=audio1,driver=none \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
 -sandbox 
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
diff --git 
a/tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-3.1.ppc64-latest.args 
b/tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-3.1.ppc64-latest.args
index e3ca4a8465..7324e69410 100644
--- a/tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-3.1.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-3.1.ppc64-latest.args
@@ -30,7 +30,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
 -blockdev 
'{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage"}'
 \
 -device 
virtio-blk-pci,bus=pci.0,addr=0x2,drive=libvirt-1-format,id=virtio-disk0,bootindex=1
 \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -audiodev id=audio1,driver=none \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
 -sandbox 
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
diff --git 
a/tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-4.2.ppc64-latest.args 
b/tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-4.2.ppc64-latest.args
index 1762e8f5f5..6591810bf8 100644
--- a/tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-4.2.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-4.2.ppc64-latest.args
@@ -30,7 +30,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
 -blockdev 
'{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage"}'
 \
 -device 
virtio-blk-pci,bus=pci.0,addr=0x2,drive=libvirt-1-format,id=virtio-disk0,bootindex=1
 \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -audiodev id=audio1,driver=none \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
 -sandbox 
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
diff --git a/tests/qemuxml2argvdata/ppc64-pseries-graphics.ppc64-latest.args 
b/tests/qemuxml2argvdata/ppc64-pseries-graphics.ppc64-latest.args
index 2d3be80be3..61a9c458d4 100644
--- a/tests/qemuxml2argvdata/ppc64-pseries-graphics.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/ppc64-pseries-graphics.ppc64-latest.args
@@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
 -netdev user,id=hostnet0 \
 -device 
virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:a2:44:92,bus=pci.0,addr=0x1 
\
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -chardev socket,id=charchannel0,fd=1729,server=on,wait=off \
 -device 
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0
 \
 -device usb-tablet,id=input0,bus=usb.0,port=1 \
diff --git a/tests/qemuxml2argvdata/ppc64-pseries-headless.ppc64-latest.args 
b/tests/qemuxml2argvdata/ppc64-pseries-headless.ppc64-latest.args
index e46978c0d2..819ad483a4 100644
--- a/tests/qemuxml2argvdata/ppc64-pseries-headless.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/ppc64-pseries-headless.ppc64-latest.args
@@ -33,7 +33,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
 -netdev user,id=hostnet0 \
 -device 
virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:09:a4:37,bus=pci.0,addr=0x1 
\
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -chardev socket,id=charchannel0,fd=1729,server=on,wait=off \
 -device 
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0
 \
 -audiodev id=audio1,driver=none \
diff --git a/tests/qemuxml2argvdata/pseries-basic.args 
b/tests/qemuxml2argvdata/pseries-basic.args
index 241850399f..ebb289fe31 100644
--- a/tests/qemuxml2argvdata/pseries-basic.args
+++ b/tests/qemuxml2argvdata/pseries-basic.args
@@ -26,5 +26,5 @@ QEMU_AUDIO_DRV=none \
 -boot strict=on \
 -usb \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-cpu-compat-power9.args 
b/tests/qemuxml2argvdata/pseries-cpu-compat-power9.args
index 29dd9bc29e..abc3421565 100644
--- a/tests/qemuxml2argvdata/pseries-cpu-compat-power9.args
+++ b/tests/qemuxml2argvdata/pseries-cpu-compat-power9.args
@@ -27,5 +27,5 @@ QEMU_AUDIO_DRV=none \
 -boot strict=on \
 -usb \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-cpu-compat.args 
b/tests/qemuxml2argvdata/pseries-cpu-compat.args
index c54088c505..18dbc62dc5 100644
--- a/tests/qemuxml2argvdata/pseries-cpu-compat.args
+++ b/tests/qemuxml2argvdata/pseries-cpu-compat.args
@@ -27,5 +27,5 @@ QEMU_AUDIO_DRV=none \
 -boot strict=on \
 -usb \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-cpu-exact.args 
b/tests/qemuxml2argvdata/pseries-cpu-exact.args
index 1d11f5fa93..7ee7ee4b34 100644
--- a/tests/qemuxml2argvdata/pseries-cpu-exact.args
+++ b/tests/qemuxml2argvdata/pseries-cpu-exact.args
@@ -27,5 +27,5 @@ QEMU_AUDIO_DRV=none \
 -boot strict=on \
 -usb \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-cpu-le.args 
b/tests/qemuxml2argvdata/pseries-cpu-le.args
index 1247f3af8e..1325a0edd2 100644
--- a/tests/qemuxml2argvdata/pseries-cpu-le.args
+++ b/tests/qemuxml2argvdata/pseries-cpu-le.args
@@ -26,5 +26,5 @@ QEMU_AUDIO_DRV=none \
 -boot strict=on \
 -usb \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-panic-missing.args 
b/tests/qemuxml2argvdata/pseries-panic-missing.args
index 241850399f..ebb289fe31 100644
--- a/tests/qemuxml2argvdata/pseries-panic-missing.args
+++ b/tests/qemuxml2argvdata/pseries-panic-missing.args
@@ -26,5 +26,5 @@ QEMU_AUDIO_DRV=none \
 -boot strict=on \
 -usb \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-panic-no-address.args 
b/tests/qemuxml2argvdata/pseries-panic-no-address.args
index 241850399f..ebb289fe31 100644
--- a/tests/qemuxml2argvdata/pseries-panic-no-address.args
+++ b/tests/qemuxml2argvdata/pseries-panic-no-address.args
@@ -26,5 +26,5 @@ QEMU_AUDIO_DRV=none \
 -boot strict=on \
 -usb \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-serial-native.args 
b/tests/qemuxml2argvdata/pseries-serial-native.args
index 9c2e3c156a..1c89689f9f 100644
--- a/tests/qemuxml2argvdata/pseries-serial-native.args
+++ b/tests/qemuxml2argvdata/pseries-serial-native.args
@@ -25,5 +25,5 @@ QEMU_AUDIO_DRV=none \
 -no-shutdown \
 -boot strict=on \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-usb-default.args 
b/tests/qemuxml2argvdata/pseries-usb-default.args
index b3b57320c5..dadab3fe10 100644
--- a/tests/qemuxml2argvdata/pseries-usb-default.args
+++ b/tests/qemuxml2argvdata/pseries-usb-default.args
@@ -26,5 +26,5 @@ QEMU_AUDIO_DRV=none \
 -boot strict=on \
 -device pci-ohci,id=usb,bus=pci.0,addr=0x1 \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-usb-kbd.args 
b/tests/qemuxml2argvdata/pseries-usb-kbd.args
index 7e0623eef8..a650420cff 100644
--- a/tests/qemuxml2argvdata/pseries-usb-kbd.args
+++ b/tests/qemuxml2argvdata/pseries-usb-kbd.args
@@ -26,6 +26,6 @@ QEMU_AUDIO_DRV=none \
 -boot strict=on \
 -device pci-ohci,id=usb,bus=pci.0,addr=0x1 \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -device usb-kbd,id=input0,bus=usb.0,port=1 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-usb-multi.args 
b/tests/qemuxml2argvdata/pseries-usb-multi.args
index 2d4ef84838..34651b8ec4 100644
--- a/tests/qemuxml2argvdata/pseries-usb-multi.args
+++ b/tests/qemuxml2argvdata/pseries-usb-multi.args
@@ -27,5 +27,5 @@ QEMU_AUDIO_DRV=none \
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1 \
 -device pci-ohci,id=usb1,bus=pci.0,addr=0x2 \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-vio-user-assigned.args 
b/tests/qemuxml2argvdata/pseries-vio-user-assigned.args
index dfc3ad0d1b..80ded18692 100644
--- a/tests/qemuxml2argvdata/pseries-vio-user-assigned.args
+++ b/tests/qemuxml2argvdata/pseries-vio-user-assigned.args
@@ -30,7 +30,7 @@ QEMU_AUDIO_DRV=none \
 -drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi1-0-0-0 \
 -device 
scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi1-0-0-0,id=scsi1-0-0-0,bootindex=1
 \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x20000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=536870912 \
 -chardev pty,id=charserial1 \
--device spapr-vty,chardev=charserial1,id=serial1,reg=0x30001000 \
+-device spapr-vty,chardev=charserial1,id=serial1,reg=805310464 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-vio.args 
b/tests/qemuxml2argvdata/pseries-vio.args
index a8e18fae5a..e266d4c01b 100644
--- a/tests/qemuxml2argvdata/pseries-vio.args
+++ b/tests/qemuxml2argvdata/pseries-vio.args
@@ -30,7 +30,7 @@ QEMU_AUDIO_DRV=none \
 -drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi1-0-0-0 \
 -device 
scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi1-0-0-0,id=scsi1-0-0-0,bootindex=1
 \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -chardev pty,id=charserial1 \
--device spapr-vty,chardev=charserial1,id=serial1,reg=0x30001000 \
+-device spapr-vty,chardev=charserial1,id=serial1,reg=805310464 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/s390-panic-missing.args 
b/tests/qemuxml2argvdata/s390-panic-missing.args
index be0873ced9..a1c1731f0c 100644
--- a/tests/qemuxml2argvdata/s390-panic-missing.args
+++ b/tests/qemuxml2argvdata/s390-panic-missing.args
@@ -26,6 +26,6 @@ QEMU_AUDIO_DRV=none \
 -boot strict=on \
 -device virtio-serial-ccw,id=virtio-serial0,devno=fe.0.0000 \
 -chardev pty,id=charconsole0 \
--device virtconsole,chardev=charconsole0,id=console0 \
+-device virtconsole,devno=fe.0.0001,chardev=charconsole0,id=console0 \
 -device virtio-balloon-ccw,id=balloon0,devno=fe.0.0002 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args 
b/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
index ecaa342a26..27de77305e 100644
--- a/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
+++ b/tests/qemuxml2argvdata/serial-dev-chardev-iobase.args
@@ -29,6 +29,6 @@ QEMU_AUDIO_DRV=none \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
 -chardev tty,id=charserial0,path=/dev/ttyS2 \
--device isa-serial,chardev=charserial0,id=serial0,iobase=0x3f8,irq=0x4 \
+-device isa-serial,chardev=charserial0,id=serial0,iobase=1016,irq=4 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/tpm-emulator-spapr.ppc64-latest.args 
b/tests/qemuxml2argvdata/tpm-emulator-spapr.ppc64-latest.args
index 04d632c091..c8dc4c74fe 100644
--- a/tests/qemuxml2argvdata/tpm-emulator-spapr.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/tpm-emulator-spapr.ppc64-latest.args
@@ -32,9 +32,9 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-TPM-VM/.config \
 -blockdev 
'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}'
 \
 -device 
scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,device_id=drive-scsi1-0-0-0,drive=libvirt-1-format,id=scsi1-0-0-0,bootindex=1
 \
 -chardev pty,id=charserial0 \
--device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
 -chardev pty,id=charserial1 \
--device spapr-vty,chardev=charserial1,id=serial1,reg=0x30001000 \
+-device spapr-vty,chardev=charserial1,id=serial1,reg=805310464 \
 -tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
 -chardev socket,id=chrtpm,path=/dev/test \
 -device tpm-spapr,tpmdev=tpm-tpm0,id=tpm0,reg=0x00005000 \
-- 
2.31.1

Reply via email to