From f486bb0494f71d316639ccc57141698d34e5101a Mon Sep 17 00:00:00 2001 From: James Cowgill Date: Tue, 16 Jun 2015 14:07:59 +0100 Subject: [PATCH] qemu: implement address for isa-serial I needed to specify the iobase address for certain exotic mips configurations. Signed-off-by: James Cowgill --- src/qemu/qemu_command.c | 12 +++++-- ...emuxml2argv-serial-dev-chardev-iobase.args | 7 ++++ ...qemuxml2argv-serial-dev-chardev-iobase.xml | 36 +++++++++++++++++++ tests/qemuxml2argvtest.c | 2 ++ 4 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev-iobase.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev-iobase.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5dabd5e848..b547dc8af3 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2691,6 +2691,10 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, info->addr.ccw.cssid, info->addr.ccw.ssid, info->addr.ccw.devno); + } else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) { + virBufferAsprintf(buf, ",iobase=0x%x,irq=0x%x", + info->addr.isa.iobase, + info->addr.isa.irq); } ret = 0; @@ -11071,11 +11075,15 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, break; case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: - if (serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { + if (serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("no addresses are supported for isa-serial")); + _("isa-serial requires address of isa type")); goto error; } + + if (qemuBuildDeviceAddressStr(&cmd, def, &serial->info, qemuCaps) < 0) + goto error; break; case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev-iobase.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev-iobase.args new file mode 100644 index 0000000000..9d5de02ae6 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev-iobase.args @@ -0,0 +1,7 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M \ +pc -m 214 -smp 1 -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 -hda /dev/HostVG/QEMUGuest1 -chardev \ +tty,id=charserial0,path=/dev/ttyS2 -device isa-serial,chardev=charserial0,\ +id=serial0,iobase=0x3f8,irq=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev-iobase.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev-iobase.xml new file mode 100644 index 0000000000..eb84574611 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev-iobase.xml @@ -0,0 +1,36 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +
+ + + + + + +
+ + + + +
+ + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a90f9a66e4..56b18eb2e5 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1045,6 +1045,8 @@ mymain(void) QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); DO_TEST("serial-dev-chardev", QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); + DO_TEST("serial-dev-chardev-iobase", + QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); DO_TEST("serial-file-chardev", QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); DO_TEST("serial-unix-chardev",