[libvirt] [PATCH v2 RESEND 03/12] conf: Introduce a new PCI address extension flag

Yi Min Zhao zyimin at linux.ibm.com
Wed Jul 25 08:58:44 UTC 2018



在 2018/7/24 下午9:54, Andrea Bolognani 写道:
> 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?
Yes, I did. But how far can zPCI be used is a question. I make sure that 
if their address
type can be PCI type zPCI address could be expanded. But we don't 
guarantee they can
be really used in qemu. Like RNG device can't be used because it doesn't 
support MSIx
which is required on S390.
>
> 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.
Will update this as your comment.
>
> [...]
>> +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
I see a lot of code in libvirt use this style. Is it new guideline?




More information about the libvir-list mailing list