diff -Nru powerpc-utils-1.3.4/debian/changelog powerpc-utils-1.3.4/debian/changelog --- powerpc-utils-1.3.4/debian/changelog 2018-04-05 18:08:00.000000000 -0300 +++ powerpc-utils-1.3.4/debian/changelog 2023-09-14 12:40:06.000000000 -0300 @@ -1,3 +1,9 @@ +powerpc-utils (1.3.4-0ubuntu2.1) focal; urgency=medium + + * Cherrypick patches to solve issues with drmgr (LP: #2023243) + + -- Patricia Domingues Thu, 14 Sep 2023 12:40:06 -0300 + powerpc-utils (1.3.4-0ubuntu2) bionic; urgency=medium * Cherrypick patch resolving more null byte command substitution warnings in diff -Nru powerpc-utils-1.3.4/debian/patches/lp-2023243-drmgr-don-t-bother-with-hp-children-for-non-PCI-slot.patch powerpc-utils-1.3.4/debian/patches/lp-2023243-drmgr-don-t-bother-with-hp-children-for-non-PCI-slot.patch --- powerpc-utils-1.3.4/debian/patches/lp-2023243-drmgr-don-t-bother-with-hp-children-for-non-PCI-slot.patch 1969-12-31 21:00:00.000000000 -0300 +++ powerpc-utils-1.3.4/debian/patches/lp-2023243-drmgr-don-t-bother-with-hp-children-for-non-PCI-slot.patch 2023-09-14 12:29:43.000000000 -0300 @@ -0,0 +1,60 @@ +From 60d9f54b13b75feee3fd7b25a92b24d0d97ea984 Mon Sep 17 00:00:00 2001 +From: Tyrel Datwyler +Date: Tue, 9 Jun 2020 12:48:38 -0700 +Subject: [PATCH] drmgr: don't bother with hp children for non PCI slots + +Only PCI devices have hotpluggable children. So, there is no need to call +disable_hp_children() or release_hp_children() for non-PCI devices. In +particular this causes messages for VIO slots, that while harmless, could lead a +user to misinterpret as actual errors. + +linux-xej6:~/powerpc-utils # drmgr -c slot -r -s U8408.E8E.10A7ACV-V1-C3 +Validating I/O DLPAR capability...yes. +failed to open /sys/bus/pci/slots/U8408.E8E.10A7ACV-V1-C3/power: No such file or directory +failed to disable hotplug children + +In remove_slot() check that the device type is PCI_DLPAR_DEV before calling +(disable|release)_hp_children(). + +Signed-off-by: Tyrel Datwyler + +Origin: upstream, https://github.com/ibm-power-utilities/powerpc-utils/commit/60d9f54b13b75feee3fd7b25a92b24d0d97ea984 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/2023243 +Last-Update: 2023-09-11 + +--- + src/drmgr/drslot_chrp_slot.c | 17 ++++++++++------- + 1 file changed, 10 insertions(+), 7 deletions(-) + +diff --git a/src/drmgr/drslot_chrp_slot.c b/src/drmgr/drslot_chrp_slot.c +index 65bf760..0966c25 100644 +--- a/src/drmgr/drslot_chrp_slot.c ++++ b/src/drmgr/drslot_chrp_slot.c +@@ -93,14 +93,17 @@ remove_slot(struct dr_node *node) + return -1; + } + +- rc = disable_hp_children(node->drc_name); +- if (rc) +- say(ERROR, "failed to disable hotplug children\n"); ++ /* For PCI nodes */ ++ if (node->dev_type == PCI_DLPAR_DEV) { ++ rc = disable_hp_children(node->drc_name); ++ if (rc) ++ say(ERROR, "failed to disable hotplug children\n"); + +- rc = release_hp_children(node->drc_name); +- if (rc && rc != -EINVAL) { +- say(ERROR, "failed to release hotplug children\n"); +- return rc; ++ rc = release_hp_children(node->drc_name); ++ if (rc && rc != -EINVAL) { ++ say(ERROR, "failed to release hotplug children\n"); ++ return rc; ++ } + } + + say(DEBUG, "The sensor-state of drc_index 0x%x is %d\n", +-- +2.25.1 + diff -Nru powerpc-utils-1.3.4/debian/patches/lp-2023243-powerpc-utils-devtree-Parse-ibm-drc-info-property.patch powerpc-utils-1.3.4/debian/patches/lp-2023243-powerpc-utils-devtree-Parse-ibm-drc-info-property.patch --- powerpc-utils-1.3.4/debian/patches/lp-2023243-powerpc-utils-devtree-Parse-ibm-drc-info-property.patch 1969-12-31 21:00:00.000000000 -0300 +++ powerpc-utils-1.3.4/debian/patches/lp-2023243-powerpc-utils-devtree-Parse-ibm-drc-info-property.patch 2023-09-13 19:24:23.000000000 -0300 @@ -0,0 +1,282 @@ +From b0586b5938e9d371e55671422b2f0a5d2cd10c54 Mon Sep 17 00:00:00 2001 +From: Michael Bringmann +Date: Wed, 2 Oct 2019 16:54:52 -0500 +Subject: [PATCH] powerpc-utils/devtree: Parse 'ibm,drc-info' property + +Parse new DRC Info: Define data structures to support parsing +the new "ibm,drc-info" device tree property. Integrate the new +property information into the existing search mechanisms of the +userspace 'drmgr' driver. + +Signed-off-by: Michael Bringmann +Signed-off-by: Tyrel Datwyler + +Origin: upstream, https://github.com/ibm-power-utilities/powerpc-utils/commit/b0586b5938e9d371e55671422b2f0a5d2cd10c54 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/2023243 +Last-Update: 2023-09-11 + +--- + src/drmgr/common_ofdt.c | 223 ++++++++++++++++++++++++++++++++++------ + 1 file changed, 194 insertions(+), 29 deletions(-) + +diff --git a/src/drmgr/common_ofdt.c b/src/drmgr/common_ofdt.c +index 8c9e224..c110bc0 100644 +--- a/src/drmgr/common_ofdt.c ++++ b/src/drmgr/common_ofdt.c +@@ -41,6 +41,16 @@ struct drc_prop_grp { + struct of_list_prop drc_domains; + }; + ++struct drc_info { ++ char *drc_type; ++ char *drc_name_prefix; ++ int drc_index_start; ++ int drc_name_suffix_start; ++ int n_seq_elems; ++ int seq_inc; ++ int drc_power_domain; ++}; ++ + struct dr_connector *all_drc_lists = NULL; + + /** +@@ -186,6 +196,169 @@ build_connectors_list(struct drc_prop_grp *group, int n_entries, + return 0; + } + ++/** ++ * drc_info_connectors_v1 ++ * ++ * @param full_path ++ * @param ofdt_path ++ * @param list ++ * @returns 0 on success, !0 otherwise ++ */ ++static int drc_info_connectors_v1(char *full_path, char *ofdt_path, ++ struct dr_connector **list) ++{ ++ struct dr_connector *out_list = NULL; ++ struct drc_prop_grp prop_grp; ++ struct of_list_prop *drc_names; ++ int n_drcs; ++ int rc = 0; ++ ++ rc = get_drc_prop_grp(full_path, &prop_grp); ++ if (rc) { ++ say(DEBUG, ++ "Could not find DRC property group in path: %s.\n", ++ full_path); ++ goto done; ++ } ++ ++ drc_names = &prop_grp.drc_names; ++ n_drcs = drc_names->n_entries; ++ ++ out_list = zalloc(n_drcs * sizeof(struct dr_connector)); ++ if (out_list == NULL) ++ goto done; ++ ++ build_connectors_list(&prop_grp, n_drcs, out_list); ++ ++done: ++ if (rc) { ++ free_drc_props(&prop_grp); ++ free(out_list); ++ } else { ++ snprintf(out_list->ofdt_path, DR_PATH_MAX, "%s", ofdt_path); ++ *list = out_list; ++ } ++ ++ return rc; ++} ++ ++/** ++ * drc_info_connectors_v2 ++ * ++ * @param full_path ++ * @param ofdt_path ++ * @param list ++ * @returns 0 on success, !0 otherwise ++ */ ++static int drc_info_connectors_v2(char *full_path, char *ofdt_path, ++ struct dr_connector **list) ++{ ++ struct dr_connector *out_list = NULL; ++ struct drc_info info; ++ char *prop_name = "ibm,drc-info"; ++ char *prop_data, *data_ptr; ++ int i, j, n_entries, size, connector_size, ics, rc; ++ ++ size = get_property_size(full_path, prop_name); ++ prop_data = zalloc(size); ++ if (prop_data == NULL) ++ return -1; ++ rc = get_property(full_path, prop_name, prop_data, size); ++ if (rc) { ++ free(prop_data); ++ return -1; ++ } ++ ++ /* Num of DRC-info sets */ ++ data_ptr = prop_data; ++ n_entries = be32toh(*(uint *)data_ptr); ++ data_ptr += 4; ++ ++ /* Extract drc-info data */ ++ for (j = 0, connector_size = 0; j < n_entries; j++) { ++ info.drc_type = data_ptr; ++ data_ptr += strlen(info.drc_type)+1; ++ info.drc_name_prefix = data_ptr; ++ data_ptr += strlen(info.drc_name_prefix)+1; ++ data_ptr += 4; /* Skip drc-index-start */ ++ data_ptr += 4; /* Skip drc-name-suffix-start */ ++ info.n_seq_elems = be32toh(*(uint *)data_ptr); ++ data_ptr += 4; /* Advance over n-seq-elems */ ++ data_ptr += 4; /* Skip sequential-increment */ ++ data_ptr += 4; /* Skip drc-power-domain */ ++ if (info.n_seq_elems <= 0) ++ continue; ++ connector_size += info.n_seq_elems; ++ } ++ ++ /* Allocate list entry */ ++ out_list = zalloc(connector_size * sizeof(struct dr_connector)); ++ if (out_list == NULL) { ++ rc = -1; ++ goto done; ++ } ++ ++ /* Extract drc-info data */ ++ data_ptr = prop_data; ++ data_ptr += 4; ++ for (j = 0, ics = 0; j < n_entries; j++) { ++ info.drc_type = data_ptr; ++ data_ptr += strlen(info.drc_type)+1; ++ info.drc_name_prefix = data_ptr; ++ data_ptr += strlen(info.drc_name_prefix)+1; ++ ++ info.drc_index_start = be32toh(*(uint *)data_ptr); ++ data_ptr += 4; ++ ++ info.drc_name_suffix_start = be32toh(*(uint *)data_ptr); ++ data_ptr += 4; ++ ++ info.n_seq_elems = be32toh(*(uint *)data_ptr); ++ data_ptr += 4; ++ ++ info.seq_inc = be32toh(*(uint *)data_ptr); ++ data_ptr += 4; ++ ++ info.drc_power_domain = be32toh(*(uint *)data_ptr); ++ data_ptr += 4; ++ ++ /* Build connector list */ ++ if (info.n_seq_elems <= 0) ++ continue; ++ ++ for (i = 0; i < info.n_seq_elems; i++, ics++) { ++ out_list[ics].index = info.drc_index_start+ ++ (i*info.seq_inc); ++ out_list[ics].powerdomain = info.drc_power_domain; ++ ++ sprintf(out_list[ics].name, "%s%d", ++ info.drc_name_prefix, ++ info.drc_name_suffix_start+(i*info.seq_inc)); ++ ++ strncpy(out_list[ics].type, info.drc_type, DRC_STR_MAX); ++ ++ out_list[ics].next = &out_list[ics+1]; ++ } ++ } ++ if (ics > 0) ++ out_list[ics-1].next = NULL; ++ ++done: ++ if (prop_data) ++ free(prop_data); ++ ++ if (rc) { ++ free(out_list); ++ *list = NULL; ++ } else { ++ snprintf(out_list->ofdt_path, DR_PATH_MAX, "%s", ofdt_path); ++ *list = out_list; ++ } ++ ++ return rc; ++} ++ ++ + /** + * of_to_full_path + * +@@ -232,11 +405,12 @@ of_to_full_path(const char *of_path) + struct dr_connector * + get_drc_info(const char *of_path) + { +- struct dr_connector *list = NULL; +- struct of_list_prop *drc_names; +- struct drc_prop_grp prop_grp; ++ struct stat sbuf; ++ char fname[DR_PATH_MAX]; ++ char ofdt_path[DR_PATH_MAX]; + char *full_path = NULL; +- int rc, n_drcs; ++ struct dr_connector *list = NULL; ++ int rc; + + for (list = all_drc_lists; list; list = list->all_next) { + if (! strcmp(list->ofdt_path, of_path)) +@@ -246,33 +420,24 @@ get_drc_info(const char *of_path) + full_path = of_to_full_path(of_path); + if (full_path == NULL) + return NULL; +- +- rc = get_drc_prop_grp(full_path, &prop_grp); +- if (rc) { +- say(DEBUG, "Could not find DRC property group in path: %s.\n", +- full_path); +- goto done; +- } + +- drc_names = &prop_grp.drc_names; +- n_drcs = drc_names->n_entries; +- +- list = zalloc(n_drcs * sizeof(struct dr_connector)); +- if (list == NULL) +- goto done; +- +- /* XXX Unchecked rc */ +- rc = build_connectors_list(&prop_grp, n_drcs, list); +- +- snprintf(list->ofdt_path, DR_PATH_MAX, "%s", of_path); +- +- list->all_next = all_drc_lists; +- all_drc_lists = list; ++ /* ibm,drc-info vs the old implementation */ ++ sprintf(fname, "%s/%s", full_path, "ibm,drc-info"); ++ snprintf(ofdt_path, DR_PATH_MAX, "%s", of_path); ++ rc = stat(fname, &sbuf); ++ if (rc) ++ rc = drc_info_connectors_v1(full_path, ofdt_path, &list); ++ else ++ rc = drc_info_connectors_v2(full_path, ofdt_path, &list); + +-done: +- free_drc_props(&prop_grp); +- if (full_path) +- free(full_path); ++ if (rc == 0) { ++ list->all_next = all_drc_lists; ++ all_drc_lists = list; ++ } else { ++ if (full_path) ++ free(full_path); ++ list = NULL; ++ } + + return list; + } +-- +2.25.1 + diff -Nru powerpc-utils-1.3.4/debian/patches/series powerpc-utils-1.3.4/debian/patches/series --- powerpc-utils-1.3.4/debian/patches/series 2018-04-05 18:02:02.000000000 -0300 +++ powerpc-utils-1.3.4/debian/patches/series 2023-09-14 12:34:52.000000000 -0300 @@ -4,3 +4,5 @@ 0001-update_flash-Use-inband-ipmi-path-to-get-firmware-ve.patch 0002-update_flash-Use-device-tree-to-get-firmware-version.patch 0003-fixup_more_null_byte_cmd_substitution-warnings.patch +lp-2023243-drmgr-don-t-bother-with-hp-children-for-non-PCI-slot.patch +lp-2023243-powerpc-utils-devtree-Parse-ibm-drc-info-property.patch