[libvirt] [PATCH v2 2/4] qemu: move PCI slot assignment for PIIX3, Q35 into a separate function
Ján Tomko
jtomko at redhat.com
Fri Jan 23 13:38:22 UTC 2015
On 01/23/2015 01:17 PM, Erik Skultety wrote:
> In order to be able to test for fully reserved PCI buses, assignment of
> PCI slots for integrated devices needs to be moved to a separate function.
> This also might be a good preparation if we decide to add support for
> other chipsets as well.
> ---
> src/qemu/qemu_command.c | 47 ++++++++++++++++++++++++++++++++---------------
> 1 file changed, 32 insertions(+), 15 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 336a3d3..457c777 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1874,6 +1874,27 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
> return ret;
> }
>
> +static int
> +qemuValidateDevicePCISlotsChipsets(virDomainDefPtr def,
> + virQEMUCapsPtr qemuCaps,
> + virDomainPCIAddressSetPtr addrs)
> +{
> + if ((STRPREFIX(def->os.machine, "pc-0.") ||
> + STRPREFIX(def->os.machine, "pc-1.") ||
> + STRPREFIX(def->os.machine, "pc-i440") ||
> + STREQ(def->os.machine, "pc") ||
> + STRPREFIX(def->os.machine, "rhel")) &&
> + qemuValidateDevicePCISlotsPIIX3(def, qemuCaps, addrs) < 0) {
> + return -1;
> + }
> +
> + if (qemuDomainMachineIsQ35(def) &&
> + qemuDomainValidateDevicePCISlotsQ35(def, qemuCaps, addrs) < 0) {
> + return -1;
> + }
> +
> + return 0;
> +}
>
> int
> qemuDomainAssignPCIAddresses(virDomainDefPtr def,
> @@ -1907,6 +1928,10 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
> /* 1st pass to figure out how many PCI bridges we need */
> if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, true)))
> goto cleanup;
> +
> + if (qemuValidateDevicePCISlotsChipsets(def, qemuCaps, addrs) < 0)
> + goto cleanup;
> +
> if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
> goto cleanup;
>
> @@ -1946,6 +1971,9 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
> goto cleanup;
>
> if (qemuDomainSupportsPCI(def)) {
> + if (qemuValidateDevicePCISlotsChipsets(def, qemuCaps, addrs) < 0)
> + goto cleanup;
> +
> if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
> goto cleanup;
> }
> @@ -1990,6 +2018,9 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
> * - PIIX3 ISA bridge, IDE controller, something else unknown, USB controller (slot 1)
> * - Video (slot 2)
> *
> + * - These integrated devices were already added by
> + * qemuValidateDevicePCISlotsChipsets invoked right before this function
> + *
> * Incrementally assign slots from 3 onwards:
> *
> * - Net
> @@ -2007,27 +2038,13 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
> */
> int
> qemuAssignDevicePCISlots(virDomainDefPtr def,
> - virQEMUCapsPtr qemuCaps,
> + virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
We can just remove the parameter if it's not used.
ACK and pushed with that change.
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/7db09755/attachment-0001.sig>
More information about the libvir-list
mailing list