]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Fix specifying char devs for PPC
authorOlivia Yin <Hong-Hua.Yin@freescale.com>
Tue, 27 May 2014 05:44:14 +0000 (13:44 +0800)
committerJán Tomko <jtomko@redhat.com>
Tue, 27 May 2014 06:48:57 +0000 (08:48 +0200)
QEMU ppce500 board uses the legacy -serial option.

Other PPC boards don't give any way to explicitly wire in a -chardev
except pseries which uses -device spapr-vty with -chardev.

Add test case for -serial option for ppce500

Signed-off-by: Olivia Yin <Hong-Hua.Yin@freescale.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_capabilities.c
tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c

index 03d88426aa5f1b83ca901e829f4ae65ea56afac3..08c3d04c77e558e75b21eee3a9093f2d22ec2f63 100644 (file)
@@ -3466,6 +3466,12 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def,
         !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
         return false;
 
+    if ((def->os.arch == VIR_ARCH_PPC) || (def->os.arch == VIR_ARCH_PPC64)) {
+        /* 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);
+    }
+
     if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64))
         return true;
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args
new file mode 100644 (file)
index 0000000..a23ae41
--- /dev/null
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-ppc -S -M ppce500 -m 256 -smp 1 -nographic -nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \
+-kernel /media/ram/uImage -initrd /media/ram/ramdisk \
+-append 'root=/dev/ram rw console=ttyS0,115200' \
+-usb -serial pty -device virtio-balloon-pci,id=balloon0,bus=pci,addr=0x2
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml
new file mode 100644 (file)
index 0000000..397aadc
--- /dev/null
@@ -0,0 +1,26 @@
+<domain type='kvm'>
+  <name>QEMUGuest1</name>
+  <memory unit='KiB'>262144</memory>
+  <currentMemory unit='KiB'>262144</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc' machine='ppce500'>hvm</type>
+    <kernel>/media/ram/uImage</kernel>
+    <initrd>/media/ram/ramdisk</initrd>
+    <cmdline>root=/dev/ram rw console=ttyS0,115200</cmdline>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc</emulator>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
index 1ea7bf87165a5c469b5b6794c0f4d50ff61ef8e1..24d104e2c0d227c68d250c37106b48e00ab47eb7 100644 (file)
@@ -1279,6 +1279,7 @@ mymain(void)
             QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
 
     DO_TEST("ppc-dtb", QEMU_CAPS_KVM, QEMU_CAPS_DTB);
+    DO_TEST("ppce500-serial", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV);
 
     DO_TEST("tpm-passthrough", QEMU_CAPS_DEVICE,
             QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);