[libvirt] [PATCH v3 01/12] conf: Add definitions for 'uid' and 'fid' PCI address attributes

Yi Min Zhao zyimin at linux.ibm.com
Tue Aug 21 09:35:20 UTC 2018



在 2018/8/21 下午4:06, Andrea Bolognani 写道:
> On Tue, 2018-08-21 at 11:24 +0800, Yi Min Zhao wrote:
>> 在 2018/8/20 下午6:35, Andrea Bolognani 写道:
>>> You could do the same thing those functions do:
>>>
>>>     * the zPCI address is empty if both uid and fid are zero;
>> uid=0 and fid=0 can't mean zPCI address is empty, because the user might
>> only define fid with 0. If fid=0 has been assigned, we should report
>> error. If
>> it is not defined by user, fid is also 0, then we should allocate a
>> valid value
>> for fid.
> For the PCI part
>
>    <address type='pci' domain='0x0000' bus='0x00'
>                        slot='0x00' function='0x0'/>
>
> behaves the same as
>
>    <address type='pci'/>
>
> and results in a PCI address being allocated automatically by
> libvirt rather than an error being reported.
>
> As with zPCI, zero is a valid value for some, but not all, of the
> attributes: validation is performed if at least one of them is
> non-zero and might result in an error being reported.
>
> Doing the same with the zPCI part would not only allow you to get
> rid of the extra booleans but would also guarantee a consistent
> behavior, which is a worthy goal in and of itself.
>
I want to ask a question. For pci address, any pci device can't use slot 0.
Is that a reason why PCI part could treat all zeros as empty address?

For zPCI address, if we use the same strategy as PCI part and user
wants to assign fid=0 to the specific device, he might encounter
assignment failure. At least, according to the doc, 0 shoud be a valid
value to assign to fid.

Anyway, when I wrote this code, I also wanted to use the similar logic to
check if zPCI address is empty.




More information about the libvir-list mailing list