Re: [PATCH v3 7/8] conf: aggregate multiple devices on a slot when assigning PCI addresses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2016-12-19 at 10:23 -0500, Laine Stump wrote:
> If a PCI device has VIR_PCI_CONNECT_AGGREGATE_SLOT set in its
> pciConnectFlags, then during address assignment we allow multiple
> instances of this type of device to be auto-assigned to multiple
> functions on the same device. A slot is used for aggregating multiple
> devices only if the first device assigned to that slot had
> VIR_PCI_CONNECT_AGGREGATE_SLOT set. but any device types that have
> AGGREGATE_SLOT set might be mix/matched on the same slot.

[...]
> @@ -717,6 +729,33 @@ virDomainPCIAddressFindUnusedFunctionOnBus(virDomainPCIAddressBusPtr bus,
>                  break;
>              }
>  
> +            if (flags & VIR_PCI_CONNECT_AGGREGATE_SLOT &&
> +                bus->slot[searchAddr->slot].aggregate) {
> +                /* slot and device are okay with aggregating devices */
> +                if ((bus->slot[searchAddr->slot].functions &
> +                     (1 << searchAddr->function)) == 0) {
> +                    *found = true;
> +                    break;
> +                }
> +
> +                /* also check for *any* unused function if caller
> +                 * sent function = -1
> +                 */
> +                if (function == -1) {
> +                    while (searchAddr->function < 8) {

We know this works because virDomainPCIAddressGetNextSlot()
will set 'searchAddr->function = 0' when 'function == -1',
but I'd rather see...

> +                        if ((bus->slot[searchAddr->slot].functions &
> +                             (1 << searchAddr->function)) == 0) {
> +                            *found = true;
> +                            break; /* out of inner while */
> +                        }
> +                        searchAddr->function++;
> +                    }
> +                    if (*found)
> +                       break; /* out of outer while */
> +                    searchAddr->function = 0; /* reset for next try */

... this line moved right before the while() loop to get
rid of that dependency entirely.


ACK with that changed.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux