[libvirt] [PATCH v3 2/8] conf: eliminate concept of "reserveEntireSlot"

Andrea Bolognani abologna at redhat.com
Tue Dec 20 13:45:22 UTC 2016


On Mon, 2016-12-19 at 10:23 -0500, Laine Stump wrote:
> setting reserveEntireSlot really accomplishes nothing - instead of
> going to the trouble of computing the
value for reserveEntireSlot and
> then possibly setting *all* functions of the slot as in-use, we can
> just set the in-use bit only for the specific function
being used by a
> device.  Later we will know from the context (the PCI connect flags,
> and whether we are reserving a specific address or asking for "the
> next
available") whether or not it is okay to allocate other functions
> on the same slot.
> 
> Although it's not used yet, we allow specifying "-1" for the function
>
number when looking for the "next available slot" - this is going to
> end up meaning "return the lowest avaialable function in the slot, but

s/avaialable/available/

[...]
> @@ -562,33 +559,13 @@ virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs,
>  
>      bus = &addrs->buses[addr->bus];
>  
> -    if (reserveEntireSlot) {
> -        if (bus->slot[addr->slot].functions) {
> -            virReportError(errType,
> -                           _("Attempted double use of PCI slot %s "
> -                             "(may need \"multifunction='on'\" for "
> -                             "device on function 0)"), addrStr);
> -            goto cleanup;
> -        }
> -        bus->slot[addr->slot].functions = 0xFF; /* reserve all functions of slot */
> -        VIR_DEBUG("Reserving PCI slot %s (multifunction='off')", addrStr);
> -    } else {
> -        if (bus->slot[addr->slot].functions & (1 << addr->function)) {
> -            if (addr->function == 0) {
> -                virReportError(errType,
> -                               _("Attempted double use of PCI Address %s"),
> -                               addrStr);
> -            } else {
> -                virReportError(errType,
> -                               _("Attempted double use of PCI Address %s "
> -                                 "(may need \"multifunction='on'\" "
> -                                 "for device on function 0)"), addrStr);
> -            }
> -            goto cleanup;
> -        }
> -        bus->slot[addr->slot].functions |= (1 << addr->function);
> -        VIR_DEBUG("Reserving PCI address %s", addrStr);
> +    if (bus->slot[addr->slot].functions & (1 << addr->function)) {
> +        virReportError(errType, _("Attempted double use of PCI Address %s"),
> +                       addrStr);

I'd leave errType alone on the first line and put the remaining
arguments on the second one, but it's merely a suggestion :)


ACK

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list