On Tue, 2018-07-10 at 16:02 +0800, Yi Min Zhao wrote: [...] > +static bool > +qemuDomainDeviceSupportZPCI(virDomainDeviceDefPtr device) > +{ > + switch ((virDomainDeviceType) device->type) { > + case VIR_DOMAIN_DEVICE_CHR: > + return false; > + > + case VIR_DOMAIN_DEVICE_CONTROLLER: > + case VIR_DOMAIN_DEVICE_NONE: > + case VIR_DOMAIN_DEVICE_DISK: > + case VIR_DOMAIN_DEVICE_LEASE: > + case VIR_DOMAIN_DEVICE_FS: > + case VIR_DOMAIN_DEVICE_NET: > + case VIR_DOMAIN_DEVICE_INPUT: > + case VIR_DOMAIN_DEVICE_SOUND: > + case VIR_DOMAIN_DEVICE_VIDEO: > + case VIR_DOMAIN_DEVICE_HOSTDEV: > + case VIR_DOMAIN_DEVICE_WATCHDOG: > + case VIR_DOMAIN_DEVICE_GRAPHICS: > + case VIR_DOMAIN_DEVICE_HUB: > + case VIR_DOMAIN_DEVICE_REDIRDEV: > + case VIR_DOMAIN_DEVICE_SMARTCARD: > + case VIR_DOMAIN_DEVICE_MEMBALLOON: > + case VIR_DOMAIN_DEVICE_NVRAM: > + case VIR_DOMAIN_DEVICE_RNG: > + case VIR_DOMAIN_DEVICE_SHMEM: > + case VIR_DOMAIN_DEVICE_TPM: > + case VIR_DOMAIN_DEVICE_PANIC: > + case VIR_DOMAIN_DEVICE_MEMORY: > + case VIR_DOMAIN_DEVICE_IOMMU: > + case VIR_DOMAIN_DEVICE_VSOCK: > + case VIR_DOMAIN_DEVICE_LAST: > + break; Did you validate that all of the above can be used with zPCI? Either way, at least _NONE and _LAST should definitely result in an error being reported, as well as the default case which should be included; use virReportEnumRangeError() for convenience. [...] > +static virDomainPCIAddressExtensionFlags > +qemuDomainDeviceCalculatePCIAddressExtensionFlags(virQEMUCapsPtr qemuCaps, > + virDomainDeviceDefPtr dev) > +{ > + virDomainPCIAddressExtensionFlags extFlags = 0; > + > + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ZPCI) && > + qemuDomainDeviceSupportZPCI(dev)) > + extFlags |= VIR_PCI_ADDRESS_EXTENSION_ZPCI; The libvirt code style guidelines[1] state that this should be formatted as if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ZPCI) && qemuDomainDeviceSupportZPCI(dev)) { extFlags |= VIR_PCI_ADDRESS_EXTENSION_ZPCI; } [1] https://libvirt.org/hacking.html -- Andrea Bolognani / Red Hat / Virtualization -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list