commit fe0c826464620fde9124f903d97102bb4237afa7 Author: Haren Myneni Date: Fri Jun 21 15:43:24 2024 -0700 drmgr/phb: Add multipath partner device support for hotplug add 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. So for the hotplug add, both paths should be added and the following steps will be executed for the PHB add: - Add the specified PHB device - Find the partner path DRC index from "ibm,multipath-partner-drc" property for the specified device - If the node has this property and the partner path is already added, notify user about the partner device. - If the node has this property and the partner path can be configured, notify user to configure and add the partner device. 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 b3a4190..220d844 100644 --- a/src/drmgr/drslot_chrp_phb.c +++ b/src/drmgr/drslot_chrp_phb.c @@ -441,8 +441,13 @@ static int acquire_phb(char *drc_name, struct dr_node **phb) */ static int add_phb(void) { - struct dr_node *phb = NULL; + struct dr_node *phb = NULL, *partner_phb = NULL; + uint32_t partner_drc_index = 0; + char drc_index_str[10]; int rc, n_children = 0; + struct dr_connector drc; + char path[DR_PATH_MAX]; + int partner_rc = 0; phb = get_node_by_name(usr_drc_name, PHB_NODES); if (phb) { @@ -507,10 +512,40 @@ static int add_phb(void) } } + if (!rc) { + /* Find the multipath partner device index if available */ + partner_rc = get_my_partner_drc_index(phb, &partner_drc_index); + if (!partner_rc && partner_drc_index) { + sprintf(drc_index_str, "%d", partner_drc_index); + /* If the partner device is already added */ + partner_phb = get_node_by_name(drc_index_str, + PHB_NODES); + if (partner_phb) { + printf("<%s> has partner device <%s>\n", + phb->drc_name, partner_phb->drc_name); + } else { + /* + * Find out if the partner device can be + * configured. Get the DRC info for the + * partner DRC index + */ + partner_rc = get_drc_by_index(partner_drc_index, + &drc, path, OFDT_BASE); + if (partner_rc) + printf("<%s> can have partner " + "device but not assigned to " + "LPAR yet\n", phb->drc_name); + } + } + } + phb_add_error: if (phb) free_node(phb); + if (partner_phb) + free_node(partner_phb); + return rc; }