Blame SOURCES/libvirt-qemu-address-Handle-all-the-video-devices-within-a-single-loop.patch

9c6c51
From 9743e1100067451a20fe1373c1d3b828f416320b Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <9743e1100067451a20fe1373c1d3b828f416320b@dist-git>
9c6c51
From: Erik Skultety <eskultet@redhat.com>
9c6c51
Date: Thu, 19 Jul 2018 15:03:50 +0200
9c6c51
Subject: [PATCH] qemu: address: Handle all the video devices within a single
9c6c51
 loop
9c6c51
MIME-Version: 1.0
9c6c51
Content-Type: text/plain; charset=UTF-8
9c6c51
Content-Transfer-Encoding: 8bit
9c6c51
9c6c51
Since 133fb140 moved the validation of a video device into a separate
9c6c51
function, the code handling PCI slot assignment for video devices has
9c6c51
been the same for both the primary device and the secondary devices.
9c6c51
Let's merge these and thus handle all the devices within the existing
9c6c51
'for' loop.
9c6c51
9c6c51
Signed-off-by: Erik Skultety <eskultet@redhat.com>
9c6c51
Reviewed-by: John Ferlan <jferlan@redhat.com>
9c6c51
(cherry picked from commit 3e90bd67a215adcb997b8c2be5d1d6b83251409f)
9c6c51
9c6c51
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
9c6c51
Signed-off-by: Erik Skultety <eskultet@redhat.com>
9c6c51
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9c6c51
---
9c6c51
 src/qemu/qemu_domain_address.c | 10 ++--------
9c6c51
 1 file changed, 2 insertions(+), 8 deletions(-)
9c6c51
9c6c51
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
9c6c51
index e9f460d77a..ab2ac022f1 100644
9c6c51
--- a/src/qemu/qemu_domain_address.c
9c6c51
+++ b/src/qemu/qemu_domain_address.c
9c6c51
@@ -2103,15 +2103,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
9c6c51
             goto error;
9c6c51
     }
9c6c51
 
9c6c51
-    /* Assign a PCI slot to the primary video card if there is not an
9c6c51
-     * assigned address. */
9c6c51
-    if (def->nvideos > 0 &&
9c6c51
-        virDeviceInfoPCIAddressWanted(&def->videos[0]->info)) {
9c6c51
-        if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->videos[0]->info) < 0)
9c6c51
-            goto error;
9c6c51
-    }
9c6c51
+    /* Video devices */
9c6c51
+    for (i = 0; i < def->nvideos; i++) {
9c6c51
 
9c6c51
-    for (i = 1; i < def->nvideos; i++) {
9c6c51
         if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info))
9c6c51
             continue;
9c6c51
 
9c6c51
-- 
9c6c51
2.18.0
9c6c51