Blame SOURCES/kvm-xio3130_downstream-Report-error-if-pcie_chassis_add_.patch

4a2fec
From f6968c5837e2201172968a49dcd7cd10e1e5a337 Mon Sep 17 00:00:00 2001
4a2fec
From: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
Date: Fri, 20 Oct 2017 18:29:11 +0200
4a2fec
Subject: [PATCH 06/19] xio3130_downstream: Report error if
4a2fec
 pcie_chassis_add_slot() failed
4a2fec
4a2fec
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
Message-id: <20171020182917.10771-2-ehabkost@redhat.com>
4a2fec
Patchwork-id: 77421
4a2fec
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH v2 1/7] xio3130_downstream: Report error if pcie_chassis_add_slot() failed
4a2fec
Bugzilla: 1390348
4a2fec
RH-Acked-by: Marcel Apfelbaum <marcel@redhat.com>
4a2fec
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
4a2fec
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
4a2fec
4a2fec
On commit f8cd1b02 ("pci: Convert to realize"), no error_set*()
4a2fec
call was added for the pcie_chassis_add_slot() error case.
4a2fec
pcie_chassis_add_slot() errors get ignored, making QEMU crash
4a2fec
later.  e.g.:
4a2fec
4a2fec
  $ qemu-system-x86_64 -device ioh3420 -device xio3130-downstream
4a2fec
  qemu-system-x86_64: memory.c:2166: memory_region_del_subregion: Assertion `subregion->container == mr' failed.
4a2fec
  Aborted (core dumped)
4a2fec
4a2fec
Fix it by reporting the error using error_setg().
4a2fec
4a2fec
Fixes: f8cd1b0201c41d88bb97dcafb80348a0e88d8805
4a2fec
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
4a2fec
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
4a2fec
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
4a2fec
(cherry picked from commit 8b3d26342c4aa171e759e6392fe3b742759d4963)
4a2fec
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 hw/pci-bridge/xio3130_downstream.c | 1 +
4a2fec
 1 file changed, 1 insertion(+)
4a2fec
4a2fec
diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_downstream.c
4a2fec
index e706f36..5a882b0 100644
4a2fec
--- a/hw/pci-bridge/xio3130_downstream.c
4a2fec
+++ b/hw/pci-bridge/xio3130_downstream.c
4a2fec
@@ -94,6 +94,7 @@ static void xio3130_downstream_realize(PCIDevice *d, Error **errp)
4a2fec
     pcie_chassis_create(s->chassis);
4a2fec
     rc = pcie_chassis_add_slot(s);
4a2fec
     if (rc < 0) {
4a2fec
+        error_setg(errp, "Can't add chassis slot, error %d", rc);
4a2fec
         goto err_pcie_cap;
4a2fec
     }
4a2fec
 
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec