commit 8751abf3cf0eb2733162931a6b38db4431699ebd Author: Haren Myneni Date: Fri Jun 21 15:42:45 2024 -0700 drmgr/phb: Add multipath partner device support for remove The PHB node can have "ibm,multipath-partner-drc" property which means the device can be also configured with multipath partner path. This property provides the DRC index of the partner device. For the hotplug removal, both paths should be removed and the following steps will be executed: - Find the partner path DRC index from "ibm,multipath-partner-drc" property for the specified device - If the partner path is configured, notify user about the removal of partner path if available. Then the user should issue issue separate drmgr command to remove the partner path. - Remove the primary path Signed-off-by: Haren Myneni Signed-off-by: Tyrel Datwyler diff --git a/src/drmgr/drslot_chrp_phb.c b/src/drmgr/drslot_chrp_phb.c index f59baa4..b3a4190 100644 --- a/src/drmgr/drslot_chrp_phb.c +++ b/src/drmgr/drslot_chrp_phb.c @@ -283,9 +283,11 @@ static int disable_os_hp_children(struct dr_node *phb) */ static int remove_phb(void) { - struct dr_node *phb; + struct dr_node *phb, *partner_phb = NULL; struct dr_node *child; struct dr_node *hp_list = NULL; + uint32_t partner_drc_index = 0; + char drc_index_str[10]; int rc = 0; phb = get_node_by_name(usr_drc_name, PHB_NODES); @@ -305,6 +307,20 @@ static int remove_phb(void) goto phb_remove_error; } + /* Find the multipath partner device index if available */ + rc = get_my_partner_drc_index(phb, &partner_drc_index); + if (!rc && partner_drc_index) { + sprintf(drc_index_str, "%d", partner_drc_index); + + /* Find the partner phb device */ + partner_phb = get_node_by_name(drc_index_str, PHB_NODES); + if (partner_phb) { + printf("Partner adapter location : %s", + partner_phb->drc_name); + printf(" Partner adapter must be removed\n"); + } + } + /* Now, disable any hotplug children */ hp_list = get_hp_nodes(); @@ -358,6 +374,9 @@ phb_remove_error: if (phb) free_node(phb); + if (partner_phb) + free_node(partner_phb); + if (hp_list) free_node(hp_list);