[libvirt] [PATCH v2 4/4] qemu: Add check for PCI bridge placement if there are too many PCI devices

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


On 01/23/2015 01:17 PM, Erik Skultety wrote:
> Previous patch of this series fixed the issue with adding a new PCI bridge
> when all the slots were reserved by devices with user specified addresses.
> In case there are still some PCI devices waiting to get a slot reserved
> by qemuAssignDevicePCISlots, this means a new bus needs to be
> created along with a corresponding bridge controller. By adding an
> additional check, this scenario now results in a reasonable error
> instead of generating wrong qemu command line.
> ---
>  src/qemu/qemu_command.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 

ACK

> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index a3dedbf..870771f 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1982,6 +1982,25 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
>              if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
>                  goto cleanup;
>          }
> +
> +        for (i = 0; i < def->ncontrollers; i++) {
> +            /* check if every PCI bridge controller's ID is greater than
> +             * the bus it is placed onto
> +             */
> +            virDomainControllerDefPtr cont = def->controllers[i];
> +            int idx = cont->idx;
> +            int bus = cont->info.addr.pci.bus;
> +            if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
> +                cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE &&
> +                idx <= bus) {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                               _("failed to create PCI bridge "
> +                                 "on bus %d: too many devices with fixed "
> +                                 "addresses"),
> +                               bus);
> +                goto cleanup;
> +            }
> +        }
>      }
>  
>      if (obj && obj->privateData) {
> 

I have moved the check into if (qemuDomainSupportsPCI) and pushed the patch.

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/b4a68801/attachment-0001.sig>


More information about the libvir-list mailing list