Skip to content

Commit

Permalink
core/pci: Fix scan of devices for opencapi slots
Browse files Browse the repository at this point in the history
Opencapi devices are found directly under the PHB and the PHB slot
doesn't have an associated PCI device (root complex). So when scanning
a PHB, devices are added directly under the PHB, like it's done at
boot time.

Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
fbarrat authored and oohal committed Oct 22, 2019
1 parent 3064215 commit 94bc2d7
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions core/pci-opal.c
Expand Up @@ -667,18 +667,28 @@ static void rescan_slot_devices(struct pci_slot *slot)
* prepare_link_change() is called (if needed) by the state
* machine during the slot reset or link polling
*/
pci_scan_bus(phb, pd->secondary_bus,
pd->subordinate_bus, &pd->children, pd, true);
pci_add_device_nodes(phb, &pd->children, pd->dn,
&phb->lstate, 0);
if (phb->phb_type != phb_type_npu_v2_opencapi) {
pci_scan_bus(phb, pd->secondary_bus,
pd->subordinate_bus, &pd->children, pd, true);
pci_add_device_nodes(phb, &pd->children, pd->dn,
&phb->lstate, 0);
} else {
pci_scan_bus(phb, 0, 0xff, &phb->devices, NULL, true);
pci_add_device_nodes(phb, &phb->devices,
phb->dt_node, &phb->lstate, 0);
phb->ops->phb_final_fixup(phb);
}
}

static void remove_slot_devices(struct pci_slot *slot)
{
struct phb *phb = slot->phb;
struct pci_device *pd = slot->pd;

pci_remove_bus(phb, &pd->children);
if (phb->phb_type != phb_type_npu_v2_opencapi)
pci_remove_bus(phb, &pd->children);
else
pci_remove_bus(phb, &phb->devices);
}

static void link_up_timer(struct timer *t, void *data,
Expand Down

0 comments on commit 94bc2d7

Please sign in to comment.