[libvirt] [PATCH 0/3] use -serial for ppce500 board and add test case

Machine name ppce500 is used to replace ppce500v2 supported by QEMU. QEMU ppce500 board uses the old style -serial options. Test case ppce500-serial is used to verify this change. Olivia Yin (3): change machine name ppce500v2 as ppce500 qemu: Fix specifying char devs for PPC tests: add test case for -serial option for ppce500 docs/schemas/domaincommon.rng | 2 +- src/qemu/qemu_capabilities.c | 10 ++++++--- tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml | 2 +- .../qemuxml2argv-ppce500-serial.args | 7 ++++++ .../qemuxml2argv-ppce500-serial.xml | 26 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + tests/testutilsqemu.c | 2 +- 8 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml -- 1.8.5

--- docs/schemas/domaincommon.rng | 2 +- tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml | 2 +- tests/testutilsqemu.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 4249ed5..af67123 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -371,7 +371,7 @@ <value>g3beige</value> <value>mac99</value> <value>prep</value> - <value>ppce500v2</value> + <value>ppce500</value> </choice> </attribute> </optional> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args index fd7e994..5d6dc45 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args @@ -1,5 +1,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-ppc -S -M ppce500v2 -m 256 -smp 1 -nographic \ +/usr/bin/qemu-system-ppc -S -M ppce500 -m 256 -smp 1 -nographic \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ -kernel /media/ram/uImage -initrd /media/ram/ramdisk \ -append 'root=/dev/ram rw console=ttyS0,115200' -dtb /media/ram/test.dtb \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml index 3674621..04f0eb6 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml @@ -5,7 +5,7 @@ <currentMemory unit='KiB'>262144</currentMemory> <vcpu placement='static'>1</vcpu> <os> - <type arch='ppc' machine='ppce500v2'>hvm</type> + <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> diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index a8884ba..7e24909 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -91,7 +91,7 @@ static int testQemuAddPPCGuest(virCapsPtr caps) static const char *machine[] = { "g3beige", "mac99", "prep", - "ppce500v2" }; + "ppce500" }; virCapsGuestMachinePtr *machines = NULL; virCapsGuestPtr guest; -- 1.8.5

QEMU ppce500 board uses the old style -serial options. Other PPC boards don't give any way to explicitly wire in a -chardev except pseries which uses -device spapr-vty with -chardev. --- src/qemu/qemu_capabilities.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 03d8842..1cc37ad 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3466,13 +3466,17 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def, !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) return false; - if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64)) + if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64) + && (def->os.arch != VIR_ARCH_PPC) && (def->os.arch != VIR_ARCH_PPC64)) return true; /* This may not be true for all ARM machine types, but at least * the only supported non-virtio serial devices of vexpress and versatile - * don't have the -chardev property wired up. */ + * don't have the -chardev property wired up. + * For PPC machines, only pseries need -device spapr-vty with -chardev */ return (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO || (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && - chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO)); + chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) || + (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO)); } -- 1.8.5

--- .../qemuxml2argv-ppce500-serial.args | 7 ++++++ .../qemuxml2argv-ppce500-serial.xml | 26 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 34 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args new file mode 100644 index 0000000..c7b4819 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args @@ -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 \ +-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 -net none -serial pty -parallel none diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml new file mode 100644 index 0000000..397aadc --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml @@ -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> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1ea7bf8..b2aa22a 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -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_DRIVE, QEMU_CAPS_CHARDEV); DO_TEST("tpm-passthrough", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS); -- 1.8.5

On 05/22/2014 12:55 PM, Olivia Yin wrote:
--- .../qemuxml2argv-ppce500-serial.args | 7 ++++++ .../qemuxml2argv-ppce500-serial.xml | 26 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 34 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml
This test passes even without applying the previous patches...
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1ea7bf8..b2aa22a 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -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_DRIVE, QEMU_CAPS_CHARDEV);
... because the QEMU_CAPS_DEVICE capability is missing.
DO_TEST("tpm-passthrough", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
Jan

Hi Jan, You're right. It should be QEMU_CAPS_DEVICE other than QEMU_CAPS_DRIVE. Best Regards, Olivia
-----Original Message----- From: Ján Tomko [mailto:jtomko@redhat.com] Sent: Monday, May 26, 2014 7:37 PM To: Yin Olivia-R63875; libvir-list@redhat.com Subject: Re: [libvirt] [PATCH 3/3] tests: add test case for -serial option for ppce500
On 05/22/2014 12:55 PM, Olivia Yin wrote:
--- .../qemuxml2argv-ppce500-serial.args | 7 ++++++ .../qemuxml2argv-ppce500-serial.xml | 26 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 34 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml
This test passes even without applying the previous patches...
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1ea7bf8..b2aa22a 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -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_DRIVE, + QEMU_CAPS_CHARDEV);
... because the QEMU_CAPS_DEVICE capability is missing.
DO_TEST("tpm-passthrough", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
Jan

[meta-comment] On 05/22/2014 04:55 AM, Olivia Yin wrote: Your message came with deep threading (each message in the series in reply to the previous). Observe what happens to replies which are threaded as typical in most mail clients (all replies to a given message sorted by time received) - the replies get interleaved to the wrong patch: 0 + 1 | + 2 | + Re: 1 | + 3 | + Re: 2 | + Re: 3 + Re: 0 whereas we usually prefer shallow threading (the git send-email default, each message in the series in reply only to the cover letter). This time, the replies are easier to spot: 0 + 1 | + Re: 1 + 2 | + Re: 2 + 3 | + Re: 3 Re: 0 -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 05/22/2014 12:55 PM, Olivia Yin wrote:
QEMU ppce500 board uses the old style -serial options.
Other PPC boards don't give any way to explicitly wire in a -chardev except pseries which uses -device spapr-vty with -chardev. --- src/qemu/qemu_capabilities.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
I think this would be easier to read as: if (arch == ARM) { /* arm-specific code */ } else if (arch == PPC) { /* ppc-specific code */ } return true;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 03d8842..1cc37ad 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3466,13 +3466,17 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def, !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) return false;
- if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64)) + if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64) + && (def->os.arch != VIR_ARCH_PPC) && (def->os.arch != VIR_ARCH_PPC64)) return true;
/* This may not be true for all ARM machine types, but at least * the only supported non-virtio serial devices of vexpress and versatile - * don't have the -chardev property wired up. */ + * don't have the -chardev property wired up. + * For PPC machines, only pseries need -device spapr-vty with -chardev */ return (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO || (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && - chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO)); + chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) || + (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO)); }
Jan

Hi Jan, Thanks for comments. Could you please help review the v2 patches? Best Regards, Olivia
-----Original Message----- From: Ján Tomko [mailto:jtomko@redhat.com] Sent: Monday, May 26, 2014 7:37 PM To: Yin Olivia-R63875; libvir-list@redhat.com Subject: Re: [libvirt] [PATCH 2/3] qemu: Fix specifying char devs for PPC
On 05/22/2014 12:55 PM, Olivia Yin wrote:
QEMU ppce500 board uses the old style -serial options.
Other PPC boards don't give any way to explicitly wire in a -chardev except pseries which uses -device spapr-vty with -chardev. --- src/qemu/qemu_capabilities.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
I think this would be easier to read as:
if (arch == ARM) { /* arm-specific code */ } else if (arch == PPC) { /* ppc-specific code */ }
return true;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 03d8842..1cc37ad 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3466,13 +3466,17 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def, !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) return false;
- if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64)) + if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64) + && (def->os.arch != VIR_ARCH_PPC) && (def->os.arch != + VIR_ARCH_PPC64)) return true;
/* This may not be true for all ARM machine types, but at least * the only supported non-virtio serial devices of vexpress and versatile - * don't have the -chardev property wired up. */ + * don't have the -chardev property wired up. + * For PPC machines, only pseries need -device spapr-vty with + -chardev */ return (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO || (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && - chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO)); + chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) || + (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO)); }
Jan

On 05/22/2014 12:55 PM, Olivia Yin wrote:
--- docs/schemas/domaincommon.rng | 2 +- tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml | 2 +- tests/testutilsqemu.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
I don't see any mention of 'ppce500v2' in qemu git. If this got into libvirt by accident, it would be nice to mention it in the commit message. Jan

Ping. Cole, Jan & Li, Could you please help review the v2 patches? Best Regards, Olivia
-----Original Message----- From: Olivia Yin [mailto:Hong-Hua.Yin@freescale.com] Sent: Thursday, May 22, 2014 6:56 PM To: libvir-list@redhat.com Cc: Yin Olivia-R63875 Subject: [PATCH 0/3] use -serial for ppce500 board and add test case
Machine name ppce500 is used to replace ppce500v2 supported by QEMU. QEMU ppce500 board uses the old style -serial options. Test case ppce500-serial is used to verify this change.
Olivia Yin (3): change machine name ppce500v2 as ppce500 qemu: Fix specifying char devs for PPC tests: add test case for -serial option for ppce500
docs/schemas/domaincommon.rng | 2 +- src/qemu/qemu_capabilities.c | 10 ++++++--- tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml | 2 +- .../qemuxml2argv-ppce500-serial.args | 7 ++++++ .../qemuxml2argv-ppce500-serial.xml | 26 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + tests/testutilsqemu.c | 2 +- 8 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml
-- 1.8.5

Hi Olivia, I have looked through your code. It looks good to me. Thanks. Li On 2014年05月22日 18:55, Olivia Yin wrote:
Machine name ppce500 is used to replace ppce500v2 supported by QEMU. QEMU ppce500 board uses the old style -serial options. Test case ppce500-serial is used to verify this change.
Olivia Yin (3): change machine name ppce500v2 as ppce500 qemu: Fix specifying char devs for PPC tests: add test case for -serial option for ppce500
docs/schemas/domaincommon.rng | 2 +- src/qemu/qemu_capabilities.c | 10 ++++++--- tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml | 2 +- .../qemuxml2argv-ppce500-serial.args | 7 ++++++ .../qemuxml2argv-ppce500-serial.xml | 26 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + tests/testutilsqemu.c | 2 +- 8 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml
participants (5)
-
Eric Blake
-
Hong-Hua.Yin@freescale.com
-
Ján Tomko
-
Li Zhang
-
Olivia Yin