@@ -526,6 +526,9 @@ void pci_remove_bus(struct phb *phb, struct list_head *list)
list_for_each_safe(list, pd, tmp, link) {
pci_remove_bus(phb, &pd->children);
+ if (phb->ops->device_remove)
+ phb->ops->device_remove(phb, pd);
+
/* Release device node and PCI slot */
if (pd->dn)
dt_free(pd->dn);
@@ -2318,6 +2318,7 @@ static const struct phb_ops p7ioc_phb_ops = {
.choose_bus = p7ioc_choose_bus,
.get_reserved_pe_number = p7ioc_get_reserved_pe_number,
.device_init = p7ioc_device_init,
+ .device_remove = NULL,
.pci_reinit = p7ioc_pci_reinit,
.eeh_freeze_status = p7ioc_eeh_freeze_status,
.eeh_freeze_clear = p7ioc_eeh_freeze_clear,
@@ -3810,6 +3810,7 @@ static const struct phb_ops phb3_ops = {
.choose_bus = phb3_choose_bus,
.get_reserved_pe_number = phb3_get_reserved_pe_number,
.device_init = phb3_device_init,
+ .device_remove = NULL,
.ioda_reset = phb3_ioda_reset,
.papr_errinjct_reset = phb3_papr_errinjct_reset,
.pci_reinit = phb3_pci_reinit,
@@ -2371,6 +2371,7 @@ static const struct phb_ops phb4_ops = {
.choose_bus = phb4_choose_bus,
.get_reserved_pe_number = phb4_get_reserved_pe_number,
.device_init = phb4_device_init,
+ .device_remove = NULL,
.ioda_reset = phb4_ioda_reset,
.papr_errinjct_reset = phb4_papr_errinjct_reset,
.pci_reinit = phb4_pci_reinit,
@@ -207,6 +207,7 @@ struct phb_ops {
*/
int (*device_init)(struct phb *phb, struct pci_device *device,
void *data);
+ void (*device_remove)(struct phb *phb, struct pci_device *pd);
/* PHB final fixup is called after PCI probing is completed */
void (*phb_final_fixup)(struct phb *phb);
This adds another PHB callback (device_remove()), corresponding to device_init(). With it, the PHB3 layer can receive notification upon PCI topology changes. This functionality will be used by the subsequent patches. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> --- core/pci.c | 3 +++ hw/p7ioc-phb.c | 1 + hw/phb3.c | 1 + hw/phb4.c | 1 + include/pci.h | 1 + 5 files changed, 7 insertions(+)