OSDN Git Service

s390x/pci: Fix hotplugging of PCI bridges
authorDavid Hildenbrand <david@redhat.com>
Wed, 30 Jan 2019 15:57:29 +0000 (16:57 +0100)
committerCornelia Huck <cohuck@redhat.com>
Tue, 5 Feb 2019 09:16:59 +0000 (10:16 +0100)
commit150f462538a6f3b78efe785c911669375032b0d2
tree2992051a35c61999eb9affb16b464ab119afdbe8
parentd30a7507edf1ca23d33dbf00b25f5e49a7808492
s390x/pci: Fix hotplugging of PCI bridges

When hotplugging a PCI bridge right now to the root port, we resolve
pci_get_bus(pdev)->parent_dev, which results in a SEGFAULT. Hotplugging
really only works right now when hotplugging to another bridge.

Instead, we have to properly check if we are already at the root.

Let's cleanup the code while at it a bit and factor out updating the
subordinate bus number into a separate function. The check for
"old_nr < nr" is right now not strictly necessary, but makes it more
obvious what is actually going on.

Most probably fixing up the topology is not our responsibility when
hotplugging. The guest has to sort this out. But let's keep it for now
and only fix current code to not crash.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190130155733.32742-3-david@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
hw/s390x/s390-pci-bus.c