qemu: Fix specifying char devs for PPC

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>
This commit is contained in:
Olivia Yin 2014-05-27 13:44:14 +08:00 committed by Ján Tomko
parent 61b1c681e0
commit fd0f22ed41
4 changed files with 40 additions and 0 deletions

View 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;

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

View File

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

View 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);