qemu: implement address for isa-serial

I needed to specify the iobase address for certain exotic mips configurations.

Signed-off-by: James Cowgill <james410@cowgill.org.uk>
This commit is contained in:
James Cowgill 2015-06-16 14:07:59 +01:00 committed by John Ferlan
parent cb7e13ffbf
commit f486bb0494
4 changed files with 55 additions and 2 deletions

View File

@ -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:

View File

@ -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

View File

@ -0,0 +1,36 @@
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
<currentMemory unit='KiB'>219100</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu</emulator>
<disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest1'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='dev'>
<source path='/dev/ttyS2'/>
<target port='0'/>
<address type='isa' iobase='0x3f8' irq='0x4'/>
</serial>
<console type='dev'>
<source path='/dev/ttyS2'/>
<target port='0'/>
<address type='isa' iobase='0x3f8' irq='0x4'/>
</console>
<memballoon model='virtio'/>
</devices>
</domain>

View File

@ -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",