Message ID | 928a81ffa60f891b2ae9a908d763bfe1e9ccc27b.1498499391.git.crobinso@redhat.com |
---|---|
State | New |
Headers | show |
Series | qemu: support chardev for all machvirt config | expand |
On Mon, 2017-06-26 at 14:01 -0400, Cole Robinson wrote: > @@ -5568,17 +5568,22 @@ virQEMUCapsSupportsChardev(const virDomainDef *def, > if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && > chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) > return false; > + return true; This is unnecessary, since the last statement causes the function to return 'true' in any case. > } > > - 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)) { You can keep the condition on a single line, and drop the pointless parentheses while you're at it. > + /* TARGET_TYPE_ISA here really means 'the default', which we > + treat as whatever the built in platform serial device is on. > + And for platform devices we can't use -chardev */ Very minor thing, but usually all lines in a multi-line comments start with an asterisk. > + if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && > + chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA) > + return false; > + > return true; This return statement can be left out like the one I commented on above. Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 61c9a1066..d0bc50bd7 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5568,17 +5568,22 @@ virQEMUCapsSupportsChardev(const virDomainDef *def, if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) return false; + return true; } - 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)) { + /* TARGET_TYPE_ISA here really means 'the default', which we + treat as whatever the built in platform serial device is on. + And for platform devices we can't use -chardev */ + if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA) + return false; + 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. */ - 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)); + return true; }
Rather than try to whitelist all device configs that can't use -chardev, blacklist the only one that really can't, which is the default serial/console target type=isa case. ISA specifically isn't a valid config for arm/aarch64, but we've always implicitly treated it to mean 'default platform device'. Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/qemu/qemu_capabilities.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) -- 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list