Hello community,

here is the log from the commit of package powerpc-utils for openSUSE:Factory 
checked in at 2020-02-14 16:27:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/powerpc-utils (Old)
 and      /work/SRC/openSUSE:Factory/.powerpc-utils.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "powerpc-utils"

Fri Feb 14 16:27:34 2020 rev:99 rq:770534 version:1.3.7.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/powerpc-utils/powerpc-utils.changes      
2019-07-08 15:01:35.470585919 +0200
+++ /work/SRC/openSUSE:Factory/.powerpc-utils.new.26092/powerpc-utils.changes   
2020-02-14 16:27:38.155264298 +0100
@@ -1,0 +2,24 @@
+Wed Jan 15 08:37:36 UTC 2020 - Josef Möllers <[email protected]>
+
+- * Deal with error messages returned sometimes by evaluation
+    of ${devspec} in 'ofpathname'.
+  * Strip embedded nulls from values provided by kernel files.
+  * Redirect more error messages to /dev/null
+  [bsc#1116561,
+   0001-powerpc-utils-Suppress-errors-reading-kernel-files.patch]
+
+-------------------------------------------------------------------
+Tue Dec  3 15:55:46 UTC 2019 - Josef Möllers <[email protected]>
+
+- 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.
+  [jsc#SLE-11094, jsc#SLE-11193, jsc#SLE-11092, jsc#SLE-11319, jsc#ECO-935,
+  bsc#1158312, bsc#1161925, fate#326955
+  bug-1158312-parse-ibm-drc-info-property.patch]
+
+- Bump package version to be able to tell the fix for jsc#SLE-11092 is included
+  Kernel can depend on the fixed version this way.
+
+-------------------------------------------------------------------

New:
----
  0001-powerpc-utils-Suppress-errors-reading-kernel-files.patch
  bug-1158312-parse-ibm-drc-info-property.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ powerpc-utils.spec ++++++
--- /var/tmp/diff_new_pack.yuB7Z6/_old  2020-02-14 16:27:38.947264728 +0100
+++ /var/tmp/diff_new_pack.yuB7Z6/_new  2020-02-14 16:27:38.947264728 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package powerpc-utils
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,18 +12,20 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
+%define realversion 1.3.7
+
 Name:           powerpc-utils
-Version:        1.3.7
+Version:        %{realversion}.1
 Release:        0
 Summary:        Utilities for PowerPC Hardware
 License:        GPL-2.0-or-later
 Group:          System/Management
-Url:            https://github.com/ibm-power-utilities/powerpc-utils
-Source0:        
https://github.com/ibm-power-utilities/powerpc-utils/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
+URL:            https://github.com/ibm-power-utilities/powerpc-utils
+Source0:        
https://github.com/ibm-power-utilities/powerpc-utils/archive/v%{realversion}.tar.gz#/%{name}-%{realversion}.tar.gz
 Source1:        nvsetenv
 Patch1:         powerpc-utils-lsprop.patch
 Patch2:         ofpathname_powernv.patch
@@ -31,6 +33,8 @@
 Patch4:         libvirt-service-dep.patch
 # This adds field in the middle of tool output so revert it again in < 15.1
 Patch5:         Revert-lparstat-Show-available-physical-processors-i.patch
+Patch6:         bug-1158312-parse-ibm-drc-info-property.patch
+Patch7:         0001-powerpc-utils-Suppress-errors-reading-kernel-files.patch
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  librtas-devel
@@ -55,7 +59,7 @@
 utilities for maintaining and enabling certain features of Linux on Power.
 
 %prep
-%setup -q
+%setup -q -n %{name}-%{realversion}
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
@@ -63,6 +67,8 @@
 %if 0%{?sle_version} <= 120400 || 0%{?sle_version} == 150000
 %patch5 -p1
 %endif
+%patch6 -p1
+%patch7 -p1
 
 %build
 autoreconf -fvi

++++++ 0001-powerpc-utils-Suppress-errors-reading-kernel-files.patch ++++++
>From 73839d6bab4da24350a60105b7b2c3a6cc7d3a15 Mon Sep 17 00:00:00 2001
From: Michael Bringmann <[email protected]>
Date: Fri, 26 Jul 2019 09:10:51 -0500
Subject: [PATCH] powerpc-utils: Suppress errors reading kernel files

A problem was observed with the evaluation of the '${devspec} by
the script 'ofpathname'.  The problem occurred during installation
to an nvme device as follows:

02:29:41,669 INF program: Running... ofpathname /dev/nvme0n1p1
02:29:41,922 INF program: /sbin/ofpathname: line 684: warning: command 
substitution: ignored null byte in input

Detailed examination showed that instances of the device-tree
property "/namespace/name" within one or more of the PCI devices
contained null bytes which were echoed along with the value e.g.

[root device-tree]# cat 
/proc/device-tree/pci@800000020000029/pci1014,637@0/namespace/name | hexdump -C
00000000  6e 61 6d 65 73 70 61 63  65 00                    |namespace.|
0000000a
[root device-tree]#

This patch provides improves handling of errors within that script,
and by some of the follow-on uses of the tool by the 'bootlist' script.

* Deal with error messages returned sometimes by evaluation
  of ${devspec} in 'ofpathname'.
* Strip embedded nulls from values provided by kernel files.
* Redirect more error messages to /dev/null

Signed-off-by: Michael Bringmann <[email protected]>
Signed-off-by: Tyrel Datwyler <[email protected]>
---
 scripts/bootlist   | 8 ++++----
 scripts/ofpathname | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/bootlist b/scripts/bootlist
index acdaf89..1d1c210 100755
--- a/scripts/bootlist
+++ b/scripts/bootlist
@@ -169,7 +169,7 @@ get_logical_device_name()
     local devname=$1
     local logical_name
 
-    logical_name=`$OFPATHNAME -l $devname 2>/dev/null`
+    logical_name=`$OFPATHNAME -l $devname 2>/dev/null | tr -d '\000'`
     if [[ $? -ne 0 ]]; then
        echo ""
     else
@@ -207,11 +207,11 @@ show_bootlist()
     local devlist=$1
     local i
 
-    for i in `$NVRAM --print-config=${devlist} | sed 's/ /\n/g'`; do
+    for i in `$NVRAM --print-config=${devlist} 2> /dev/null | sed 's/ /\n/g'`; 
do
        if [[ $TRANSLATE_NAMES = "yes" ]]; then
            name=`get_logical_device_name $i`
            if [[ -z $name ]]; then
-               echo "Could not translate $i to logical device name"
+               echo "Could not translate $i to logical device name" 2>&1
            else
                case $name in
                    eth*)   parse_eth_info $name $i ;;
@@ -230,7 +230,7 @@ show_bootlist()
 
 . $PSERIES_PLATFORM
 if [[ $platform != $PLATFORM_PSERIES_LPAR ]]; then
-    echo "bootlist: is not supported on the $platform_name platform"
+    echo "bootlist: is not supported on the $platform_name platform" 2>&1
     exit 1
 fi
 
diff --git a/scripts/ofpathname b/scripts/ofpathname
index dc452c4..7c6345e 100755
--- a/scripts/ofpathname
+++ b/scripts/ofpathname
@@ -656,7 +656,7 @@ l2of_nvme()
 
         goto_dir $PWD "device/devspec"
 
-        devspec=`$CAT $PWD/device/devspec`
+        devspec=`$CAT $PWD/device/devspec | tr -d '\000'`
         if [[ -n $devspec ]]; then
             found=1
             break
@@ -681,7 +681,7 @@ l2of_nvme()
 
     # Device type is usually 'namespace'.
     # Get it from device-tree just in case.
-    devtype=`$CAT /proc/device-tree${devspec}/namespace/name`
+    devtype=`$CAT /proc/device-tree${devspec}/namespace/name | tr -d '\000'` 
2> /dev/null
     if [[ -z $devtype ]]; then
         err $ERR_NO_OFPATH
     fi
-- 
2.16.4

++++++ bug-1158312-parse-ibm-drc-info-property.patch ++++++
>From b0586b5938e9d371e55671422b2f0a5d2cd10c54 Mon Sep 17 00:00:00 2001
From: Michael Bringmann <[email protected]>
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 <[email protected]>
Signed-off-by: Tyrel Datwyler <[email protected]>
---
 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;
 }

Reply via email to