[libvirt] [PATCH v2 3/4] qemu: Fix auto-adding PCI bridge when all slots are reserved

Ján Tomko jtomko at redhat.com
Fri Jan 23 13:38:27 UTC 2015


On 01/23/2015 01:17 PM, Erik Skultety wrote:
> Commit 93c8ca tried to fix the issue with auto-adding of a PCI bridge
> controller, but didn't work properly in all scenarios.
> 
> This patch provides a better fix of the issue when all slots on a PCI bus
> are reserved by devices with user specified addresses and no additional
> bridges need to be created.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1132900
> ---
>  src/qemu/qemu_command.c | 23 ++++++++++++++---------
>  1 file changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 457c777..a3dedbf 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1910,6 +1910,8 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
>          int nbuses = 0;
>          size_t i;
>          int rv;
> +        bool buses_reserved = true;
> +
>          virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCI;
>  
>          for (i = 0; i < def->ncontrollers; i++) {
> @@ -1932,18 +1934,21 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
>              if (qemuValidateDevicePCISlotsChipsets(def, qemuCaps, addrs) < 0)
>                  goto cleanup;
>  
> -            if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
> -                goto cleanup;
> -
>              for (i = 0; i < addrs->nbuses; i++) {
> -                if (!qemuDomainPCIBusFullyReserved(&addrs->buses[i])) {
> -
> -                    /* Reserve 1 extra slot for a (potential) bridge */
> -                    if (virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0)
> -                        goto cleanup;
> -                }
> +                if (!qemuDomainPCIBusFullyReserved(&addrs->buses[i]))
> +                    buses_reserved = false;
>              }
>  
> +             /* Reserve 1 extra slot for a (potential) bridge only if buses

Indentation is off here.

> +             * are not fully reserved yet
> +             */
> +            if (!buses_reserved &&
> +                virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0)
> +                goto cleanup;
> +
> +            if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
> +                goto cleanup;
> +
>              for (i = 1; i < addrs->nbuses; i++) {
>                  virDomainPCIAddressBusPtr bus = &addrs->buses[i];
>  
> 

ACK and pushed.

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150123/8e5a4e41/attachment-0001.sig>


More information about the libvir-list mailing list