New Upstream Release - powerpc-utils

Ready changes

Summary

Merged new upstream version: 1.3.11 (was: 1.3.10).

Diff

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 1a6c9a3..a68d872 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -13,14 +13,14 @@ on:
 
 jobs:
   build:
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
 
     strategy:
       matrix:
         host: [powerpc-linux-gnu, powerpc64-linux-gnu, powerpc64le-linux-gnu, x86_64-linux-gnu]
 
     steps:
-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v3
       with:
         repository: ibm-power-utilities/librtas
         path: ./librtas
@@ -44,7 +44,7 @@ jobs:
         sudo make install
         cd ..
 
-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v3
       with:
         repository: madler/zlib
         ref: v1.2.11
@@ -59,7 +59,7 @@ jobs:
         sudo make install
         cd ..
 
-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v3
       with:
         repository: numactl/numactl
         ref: v2.0.14
@@ -75,7 +75,7 @@ jobs:
         sudo make install
         cd ..
 
-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v3
 
     - name: Register problem matchers
       run: |
@@ -86,7 +86,7 @@ jobs:
 
     - name: configure
       run: |
-       ./configure --prefix=/usr --host=${{ matrix.host }} --disable-werror --build=x86_64-linux-gnu CFLAGS='-O2 -g'
+       ./configure --prefix=/usr --host=${{ matrix.host }} --enable-werror --build=x86_64-linux-gnu CFLAGS='-O2 -g'
 
     - name: Collect config.log
       if: ${{ failure() }}
@@ -100,4 +100,4 @@ jobs:
 
     - name: distcheck
       run: |
-        make distcheck V=1 DISTCHECK_CONFIGURE_FLAGS='--disable-werror --host=${{ matrix.host }}'
+        make distcheck V=1 DISTCHECK_CONFIGURE_FLAGS='--enable-werror --host=${{ matrix.host }}'
diff --git a/Changelog b/Changelog
index bf2525e..de0ad97 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,541 @@
+powerpc-utils-1.3.11
+=====================================================================
+commit fc3b6044401e5625bc825d594f8b89fda49b6596
+Author: Tyrel Datwyler <tyreld@linux.ibm.com>
+Date:   Tue Jan 17 17:32:10 2023 -0800
+
+    ci: rev Ubuntu action runner from 20.04 -> 22.04
+    
+    Move the CI runner from previous LTS release to the current LTS release.
+    This as the added benefit of moving the gcc-toolchain from gcc-9 to
+    gcc-11.
+    
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 72b1a6e9b739382716b4c06829d3f99555be398e
+Author: Tyrel Datwyler <tyreld@linux.ibm.com>
+Date:   Wed Jan 18 16:19:48 2023 -0800
+
+    errinjct: use PATH_MAX instead of BUFSZ
+    
+    The arbitary BUFSZ macro of 4000 is less than that of PATH_MAX defined
+    by Linux. BUFSZ is only used for pathname buffer allocations. As such
+    remove BUFSZ macro and use PATH_MAX instead.
+    
+    Suggested-by: Nathan Lynch <nathanl@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 21b6e512edd651c1297794c1eb4c70f8adb143fc
+Author: Tyrel Datwyler <tyreld@linux.ibm.com>
+Date:   Wed Jan 18 15:46:27 2023 -0800
+
+    errinjct: pass full device reg path to get_config_addr_from_reg()
+    
+    The following string truncation error is reported by gcc-11 and gcc-12
+    toolchains:
+    
+    In file included from /usr/powerpc-linux-gnu/include/string.h:535,
+            from src/errinjct/ioa_bus_error.c:34:
+    
+    In function ‘strncpy’,
+            inlined from ‘get_config_addr_from_reg’ at src/errinjct/ioa_bus_error.c:207:2,
+            inlined from ‘hunt_loc_code’ at src/errinjct/ioa_bus_error.c:415:9:
+    Warning: /usr/powerpc-linux-gnu/include/bits/string_fortified.h:95:10: warning: ‘__builtin_strncpy’ output may be truncated copying 3995 bytes from a string of length 3999 [-Wstringop-truncation]
+    
+    This is the result of the caller defining a buffer of BUFSZ, but the
+    callee only copying BUFSZ-5 of data into a new string so that there is
+    room to strcat "/reg" to the resulting pathname. We can save a strncpy
+    and static buffer allocation by doing the strcat of "/reg" to the
+    pathname before calling get_conig_addr_from_reg() which in general
+    appears to be inlined anyways.
+    
+    Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+    Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit a540ff88416413b080e572c074e57aad362c3e50
+Author: Tyrel Datwyler <tyreld@linux.ibm.com>
+Date:   Wed Jan 18 15:28:13 2023 -0800
+
+    serv_config: cast param to correct size before byte swap
+    
+    The first two bytes of the param buffer returned by the
+    ibm,get-system-parameter RTAS call contain the the length of the
+    remaining data in the buffer. However, param is a char buffer and
+    as such the current code attempts to use be16toh which only gets one
+    byte of data. Type cast param to (uint16_t *) before the dereference to
+    ensure we get both bytes of data. This fixes the following string
+    truncation error with gcc-11 and gcc-12 toolchains:
+    
+    In file included from /usr/powerpc-linux-gnu/include/string.h:535,
+                     from src/serv_config.c:50:
+    In function ‘strncpy’,
+        inlined from ‘retrieve_value’ at src/serv_config.c:710:5:
+    Error: /usr/powerpc-linux-gnu/include/bits/string_fortified.h:95:10: error: ‘__builtin_strncpy’ output may be truncated copying between 0 and 255 bytes from a string of length 4997 [-Werror=stringop-truncation]
+    
+    Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+    Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 73b1bdf7452e1825c797dcf708fd1b9e6b518ca5
+Author: Tyrel Datwyler <tyreld@linux.ibm.com>
+Date:   Wed Jan 4 16:20:55 2023 -0800
+
+    configure.ac: replace deprecated AC_HELP_STRING macro
+    
+    AC_HELP_STRING has been deprecated in favor of AS_HELP_STRING.
+    
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit b661a2e221232c7064efa6779ac82c6f1399d0b4
+Author: Tyrel Datwyler <tyreld@linux.ibm.com>
+Date:   Wed Jan 4 16:16:51 2023 -0800
+
+    ci: update checkout@v2 action to checkout@v3
+    
+    Node.js 12 actions are deprecated. Update checkout action to v3 which
+    uses Node.js 16. In response to the following CI warning:
+    
+    Node.js 12 actions are deprecated. For more information see:
+    https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.
+    Please update the following actions to use Node.js 16: actions/checkout@v2
+    
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 52df81cc1b937b235f7dbdc1dd92e38b99def1c7
+Author: Nathan Lynch <nathanl@linux.ibm.com>
+Date:   Wed Jan 4 14:02:52 2023 -0600
+
+    configure.ac: disable -Werror by default
+    
+    Enabling -Werror should be opt-in and done only in known
+    environments (e.g. a seldom-changing build configuration in
+    CI). Making -Werror the default for our build configuration causes
+    more pain for downstream projects than it's worth. It remains enabled
+    in the project CI (see previous commit).
+    
+    Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 57a8c1c4de7c5de7606b15b58691d0f81aa1158b
+Author: Nathan Lynch <nathanl@linux.ibm.com>
+Date:   Wed Jan 4 14:02:51 2023 -0600
+
+    CI: enable -Werror for builds
+    
+    The CI builds all seem to be warning-free. Ensure we fail runs when
+    new warnings are introduced.
+    
+    Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 3607e6dabdef641c363233eddd3a1cf8c2e5c6d8
+Author: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+Date:   Mon Dec 26 10:54:38 2022 +0100
+
+    drmgr/drslot_chrp_hea: Prefer strlen() to check for valid string length
+    
+    This fixes the following warning when building with gcc-12 that is
+    the result of sysfs_dev_path being a fixed-sized array which means
+    that (char *)sysfs_dev_path never be NULL:
+    
+    src/drmgr/drslot_chrp_hea.c: In function 'hotplug_port':
+    src/drmgr/drslot_chrp_hea.c:124:13: error: the comparison will always evaluate as 'true' for the address of 'sysfs_dev_path' will never be NULL [-Werror=address]
+      124 |         if (! hea->sysfs_dev_path) {
+          |             ^
+    In file included from src/drmgr/drpci.h:25,
+                     from src/drmgr/rtas_calls.h:25,
+                     from src/drmgr/dr.h:30,
+                     from src/drmgr/drslot_chrp_hea.c:31:
+    src/drmgr/ofdt.h:84:25: note: 'sysfs_dev_path' declared here
+       84 |         char            sysfs_dev_path[DR_PATH_MAX];
+          |                         ^~~~~~~~~~~~~~
+    
+    Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+    Reviewed-by: Nathan Lynch <nathanl@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 5de0a4a070981b5ee005f2242b31db5422be297a
+Author: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+Date:   Mon Dec 26 10:54:37 2022 +0100
+
+    drmgr/common_pci: Prefer strlen() to check for valid string length
+    
+    This fixes the following warning when building with gcc-12 that is
+    the result of ofdt_path being a fixed-sized array which means that
+    (char *)ofdt_path never be NULL:
+    
+    src/drmgr/common_pci.c: In function 'devspec_check_node':
+    src/drmgr/common_pci.c:465:29: error: the comparison will always evaluate as 'false' for the address of 'ofdt_path' will never be NULL [-Werror=address]
+      465 |         if (node->ofdt_path == NULL)
+          |                             ^~
+    In file included from src/drmgr/drpci.h:25,
+                     from src/drmgr/rtas_calls.h:25,
+                     from src/drmgr/dr.h:30,
+                     from src/drmgr/common_pci.c:31:
+    src/drmgr/ofdt.h:78:25: note: 'ofdt_path' declared here
+       78 |         char            ofdt_path[DR_PATH_MAX];
+          |
+    
+    Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+    Reviewed-by: Nathan Lynch <nathanl@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit aef8f14ed8b241ab66d88fb9a5aeefe47a847267
+Author: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+Date:   Mon Dec 26 10:54:36 2022 +0100
+
+    vcpustat: Add missing field initialization to quell compiler warning
+    
+    This fixes the following compiler warning when building with gcc-12:
+    
+    In file included from /usr/include/stdio.h:906,
+                     from src/vcpustat.c:26:
+    In function 'printf',
+        inlined from 'print_stats' at src/vcpustat.c:182:4:
+    /usr/include/powerpc64-linux-gnu/bits/stdio2.h:86:10: error: 'stat.far_numa_node' may be used uninitialized [-Werror=maybe-uninitialized]
+       86 |   return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
+          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    src/vcpustat.c: In function 'print_stats':
+    src/vcpustat.c:144:34: note: 'stat.far_numa_node' was declared here
+      144 |         struct vcpudispatch_stat stat;
+          |                                  ^~~~
+    
+    Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+    Reviewed-by: Nathan Lynch <nathanl@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 04e5c9646296e1f12048723bba4cee663c3f74ed
+Author: Wen Xiong <wenxiong@linux.ibm.com>
+Date:   Thu Dec 1 05:22:37 2022 -0600
+
+    ofpathname: Handle nsid as hex in nvmf boot/install support
+    
+    Didn't handle nsid correctly in nvmf boot/install support.
+    Need to handle it as hexadecimal number
+    
+    For example,
+    /pci@800000020000132/fibre-channel@0,1/nvme-of/controller@50050768101935e5,ffff
+    :nqn=nqn.1986-03.com.ibm:nvme:2145.0000020420006CEA/namespace@26c
+    
+    26c should be a hexadecimal number.
+    
+    Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 3847a1c25a640394c4afd2b8938ad21190bf5dbe
+Author: Wen Xiong <wenxiong@linux.ibm.com>
+Date:   Fri Oct 28 09:20:38 2022 -0500
+
+    Support multiple dev paths for a nvmf boot device
+    
+    This patch adds the support for multiple dev/of paths with a nvmf boot dev
+    
+    # bootlist -m normal -o nvme1n4
+    nvme1n4
+    nvme3n4
+    nvme5n4
+    nvme6n4
+    # bootlist -m normal -o
+    nvme1n4
+    nvme3n4
+    nvme5n4
+    nvme6n4
+    # bootlist -m normal -r
+    /pci@800000020000017/fibre-channel@0/nvme-of/controller@50050768101935e5,ffff:nqn=nqn.1986-03.com.ibm:nvme:2145.0000020420006CEA/namespace@147
+    /pci@800000020000017/fibre-channel@0/nvme-of/controller@5005076810193675,ffff:nqn=nqn.1986-03.com.ibm:nvme:2145.0000020420006CEA/namespace@147
+    /pci@800000020000017/fibre-channel@0,1/nvme-of/controller@5005076810193675,ffff:nqn=nqn.1986-03.com.ibm:nvme:2145.0000020420006CEA/namespace@147
+    /pci@800000020000017/fibre-channel@0,1/nvme-of/controller@50050768101935e5,ffff:nqn=nqn.1986-03.com.ibm:nvme:2145.0000020420006CEA/namespace@147
+    
+    Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit acaf9c45a340f9bb49d6b21ba7ad60c21326ea73
+Author: Mingming Cao <mmc@linux.vnet.ibm.com>
+Date:   Mon Nov 7 14:39:02 2022 -0800
+
+    hcnmgr: Fix setting primary slave across reboots
+    
+    Using nmcli to set bonding of primary slave so that is set correctly
+    across reboots.
+    
+    Signed-off-by: Mingming Cao <mmc@linux.vnet.ibm.com>
+    [tyreld: Reworded commit log]
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit b6bd4ddd0c0a24cce97c220ab0cadfd004dd58c4
+Author: Sathvika Vasireddy <sv@linux.ibm.com>
+Date:   Fri Jul 15 14:35:13 2022 +0530
+
+    lparstat: Fix array overflow issue
+    
+    lparstat is trying to read from out of bound file descriptors. Fix
+    this by making sure array overflow does not occur.
+    
+    Without this patch:
+    ===================================================================
+    ltcden8-lp7:/home/sathvika/powerpc-utils # lparstat -E 1 1
+    Failed to /sys/devices/system/cpu/cpu1162167776/spurr
+    ===================================================================
+    
+    With this patch:
+    ===================================================================
+    ltcden8-lp7:/home/sathvika/powerpc-utils # ./src/lparstat -E 1 1
+    
+    System Configuration
+    type=Dedicated mode=Capped smt=8 lcpu=6 mem=81341376 kB cpus=0 ent=6.00
+    
+    ---Actual---                 -Normalized-
+    %busy  %idle   Frequency     %busy  %idle
+    ------ ------  ------------- ------ ------
+      0.01  99.99  4.00GHz[116%]   0.02 115.98
+    ====================================================================
+    
+    Reported-by: Sachin Sant <sachinp@linux.ibm.com>
+    Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
+    Tested-by: Sachin Sant <sachinp@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit b1b9e76de0f3ab1dfcd9426779fa20fd77cd5625
+Author: Luciano Chavez <lnx1138@linux.ibm.com>
+Date:   Wed Aug 24 21:11:32 2022 -0500
+
+    lsslot: Fix lsslot -c mem output when using 4GB LMB size
+    
+    When using a LMB size of 4GB, the output of lsslot -c mem would get
+    reported incorrectly as:
+    
+    Dynamic Reconfiguration Memory (LMB size 0x0)
+    :
+        DRC Index: 80000001        Address: 100000000
+        Removable: No              Associativity: (index: 1) 0 1 4 9
+        Section(s):
+    
+    This patch changes the declaration of the _node_u._smem._lmb_size from
+    a uint32_t to uint64_t to store the value properly. Any variables that
+    store the lmb_size are also declared as uint64_t. In addition, we
+    use the PRIx64 macro in printf statements to properly print the
+    lmb_size value.
+    
+    The patch also includes a necessary change to declare the global
+    variable block_sz_bytes as a uint64_t to fix an infinite loop in
+    the function get_mem_scns() when the above changes were introduced.
+    
+    Signed-off-by: Luciano Chavez <lnx1138@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit e1f1deb06d9168a95a381a2236e1d8c693d3d229
+Author: Luciano Chavez <lnx1138@linux.ibm.com>
+Date:   Wed Aug 24 21:17:54 2022 -0500
+
+    lsslot: Explicity declare that lmb_address be displayed in hexadecimal
+    
+    A printf statement used is lsslot.c was specifying the macro PRIu64 to
+    display the lmb_address. Depending on the compilation, this would
+    either display as a hexadecimal or decimal value.
+    
+    This patch replaces PRIu64 with PRIx64 to explicitly declare to print
+    the value as hexadecimal as that was is normally expected of an address.
+    
+    Signed-off-by: Luciano Chavez <lnx1138@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit f4c2b0d142f623e7dd28a5d685e446d41be75601
+Author: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
+Date:   Thu Aug 25 12:19:27 2022 +0530
+
+    lparstat: Fix display of mode for dedicated-donating partition
+    
+     From the lparstat man page:
+      mode
+      Indicates whether the partition processor capacity is capped or uncapped
+      allowing it to consume idle cycles from the shared pool. Dedicated LPAR
+      is capped or donating.
+    
+    However, on a dedicated partition, lparstat always displays the mode as
+    'Capped' today. Fix this by using 'DedDonMode' field from lparcfg for
+    determining the cycle donation status of a dedicated partition.
+    
+    On a dedicated-donating partition:
+      $ grep -e shared -e DedDonMode -e capped /proc/powerpc/lparcfg
+      DedDonMode=1
+      capped=1
+      shared_processor_mode=0
+    
+    Before this patch:
+      $ lparstat
+    
+      System Configuration
+      type=Dedicated mode=Capped smt=8 lcpu=1 mem=3335424 kB cpus=0 ent=1.00
+    
+    After this patch:
+      $ lparstat
+    
+      System Configuration
+      type=Dedicated mode=Donating smt=8 lcpu=1 mem=3335424 kB cpus=0 ent=1.00
+    
+    Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
+    Reviewed-by: Nathan Lynch <nathanl@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 7698adc945372e901c2bc3f7066a5a1c219bf1d8
+Author: Laurent Dufour <ldufour@linux.ibm.com>
+Date:   Fri Sep 16 18:39:18 2022 +0200
+
+    drmgr: add the drmgr-hooks man file.
+    
+    This man page describe the various drmgr's hooks.
+    
+    Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit d0bc79aedaf76eff09a5d1f399da09561a4d4d7d
+Author: Laurent Dufour <ldufour@linux.ibm.com>
+Date:   Fri Sep 16 18:39:17 2022 +0200
+
+    drmgr: introducing the LPM hooks
+    
+    There are 3 hooks run when an LPM is performed:
+    1. check before the LPM is really initiated
+     1 bis. undocheck if check failed.
+    2. pre just before entering the switch over
+    3. post at the end of the LPM operation
+    
+    Only the check hook's return status is taken in account. If the check hook
+    return value is different from 0, the LPM is aborted and the outputs of the
+    check hook are reported to the end user through the HMC.
+    
+    In the case at least one check hook returned a non zero status, the
+    undocheck event is run (for all the hooks), and the pre and post events are
+    not triggered.
+    
+    The post event is triggered even if the LPM operation has failed.
+    
+    Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit e0928dc5e5375591a4cff6ffabc6063771288f59
+Author: Laurent Dufour <ldufour@linux.ibm.com>
+Date:   Fri Sep 16 18:39:16 2022 +0200
+
+    drmgr: introducing the hook framework
+    
+    The hook framework run in a sequence any executable file found in the
+    relevant directory (/etc/drmgr.d/<DRC TYPE NAME>/)
+    
+    The hook are run according to the versionsort()'s output order.
+    
+    The hook inherits from drmgr its standard I/O streams. All others file
+    descriptor should have the close on exec flag set to ensure they will be
+    closed when executing an hook.
+    
+    The hooks are run with no arguments, arguments are passed through
+    environment variable.
+    
+    The inherited environment is cleaned and 2 environment variables
+    are set:
+    - DRC_TYPE containing the DRC type string
+    - PHASE containing the current phase
+    
+    There are 4 known phases: check, undocheck, pre and post.
+    
+    The hook's run is recorded in the drmgr's log, so blocking hook could be
+    identified.
+    
+    Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 372599ed28d65a79d4c3b3405a8e04034eb58e09
+Author: Laurent Dufour <ldufour@linux.ibm.com>
+Date:   Fri Sep 16 18:39:15 2022 +0200
+
+    drmgr: introduce a DRC type name table
+    
+    So that there is only one place to convert the name of the drc to the type
+    of drc and vice versa.
+    
+    Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit f2a4619ef6be747f53e5f631f8b23b5edb9bb023
+Author: Laurent Dufour <ldufour@linux.ibm.com>
+Date:   Fri Sep 16 18:39:14 2022 +0200
+
+    drmgr: prevent file descriptor to be inherited when execing a child
+    
+    When a file descriptor is opened and remain opened, the O_CLOEXEC should be
+    set so execed children are not inheriting it.
+    
+    There is no need for file descriptor opened and closed immediately, like in
+    probe_cpu().
+    
+    Reviewed-by: Nathan Lynch <nathanl@linux.ibm.com>
+    Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 1ac96f8ab7c27095be90eb2e69ae57e8b43eccbe
+Author: Laurent Dufour <ldufour@linux.ibm.com>
+Date:   Fri Sep 16 18:39:13 2022 +0200
+
+    drmgr/pmig: remove deprecated call to refrsrc IBM.ManagementServer
+    
+    As Nathan reported while reviewing this series:
+    
+    This RSCT doc indicates that the IBM.ManagementServer resource class has
+    been superseded:
+    
+    https://www.ibm.com/docs/en/rsct/3.2?topic=security-management-domain-configuration
+    
+    Removing that deprecated call in this series because it is conflicting with
+    a following patch. The system returned value is stored in rc to prevent
+    compilation error (due to warning if system returned value is not read).
+    
+    Suggested-by: Nathan Lynch <nathanl@linux.ibm.com>
+    Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit c3ce3040ea9ed49345756136d61eb402e32402e8
+Author: Laurent Dufour <ldufour@linux.ibm.com>
+Date:   Fri Sep 16 18:39:12 2022 +0200
+
+    drmgr/pmig: remove unused code
+    
+    The original system id is read but never used, so remove that useless code.
+    Remove also an unjustified sleep(5) call.
+    
+    Reviewed-by: Nathan Lynch <nathanl@linux.ibm.com>
+    Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit 2fbd7c1ff428e534d80f60e03501d625ab594eca
+Author: Wen Xiong <wenxiong@linux.ibm.com>
+Date:   Wed Jun 15 13:05:51 2022 -0500
+
+    ofpathname: Fix several issues in nvmf boot/install support
+    
+    This patch fixes several issues in boot/install over nvme-over-fc
+    device support.
+    
+    - change cntlid to ffff
+    - add devnisd from sysfs
+    - add subsysnqn
+    
+    Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
+commit c015807d5bef0ebdeaf99883793173f2b636e740
+Author: Wen Xiong <wenxiong@linux.ibm.com>
+Date:   Wed Jun 15 13:05:18 2022 -0500
+
+    bootlist: Add install/boot support for nvmf devices
+    
+    This patch adds the boot/installation support for nvme-over-fc devices.
+    It can set nvmf device as boot device in both of logical device name
+    and open firmware device path name.
+    
+    Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
+    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
+
 powerpc-utils-1.3.10
 =====================================================================
 
diff --git a/Makefile.am b/Makefile.am
index ba7a3c5..5c0ca3c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -48,6 +48,7 @@ man_MANS = \
 	man/vcpustat.8 \
 	man/rtas_dbg.8 \
 	man/drmgr.8 \
+	man/drmgr-hooks.8 \
 	man/lparnumascore.8
 
 EXTRA_DIST += $(bin_SCRIPTS) $(sbin_SCRIPTS) $(man_MANS)
diff --git a/configure.ac b/configure.ac
index 2872ce9..b8eb649 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
-m4_define([ppu_version], 1.3.10)
+m4_define([ppu_version], 1.3.11)
 
 AC_PREREQ([2.63])
 AC_INIT([powerpc-utils], ppu_version, [tyreld@linux.ibm.com])
@@ -84,7 +84,7 @@ AC_SUBST(LIBDL)
 # check for systemd
 systemd_unit_dir=/lib/systemd/system
 AC_ARG_WITH([systemd],
-	[AC_HELP_STRING([--with-systemd@<:@=DIR@:>@],
+	[AS_HELP_STRING([--with-systemd@<:@=DIR@:>@],
                     [install systemd unit files (not default and unit dir is /lib/systemd/system)])],
 	[if test "$withval" = "no"; then
 		with_systemd=0
@@ -98,14 +98,14 @@ AM_CONDITIONAL(WITH_SYSTEMD, [test "$with_systemd" = 1])
 AC_SUBST(systemd_unit_dir)
 
 AC_ARG_ENABLE([werror],
-    AS_HELP_STRING([--disable-werror], [avoid treating compiler warnings as fatal errors]))
+    AS_HELP_STRING([--enable-werror], [treat compiler warnings as fatal errors]))
 
 AC_DEFUN([LOCAL_CHECK_FLAGS],[
   AC_REQUIRE([AX_CHECK_LINK_FLAG])
   AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
   AC_LANG_PUSH([C])
   AX_APPEND_COMPILE_FLAGS([-Wall])
-  AS_IF([test "x$enable_werror" != "xno"], [AX_APPEND_COMPILE_FLAGS([-Werror])])
+  AS_IF([test "x$enable_werror" == "xyes"], [AX_APPEND_COMPILE_FLAGS([-Werror])])
   AX_APPEND_COMPILE_FLAGS([-D_FORTIFY_SOURCE=2 -fstack-protector-all])
   AX_APPEND_COMPILE_FLAGS([-fwrapv -fPIE -Wstack-protector])
   AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1])
diff --git a/debian/changelog b/debian/changelog
index 0ca15c4..e225e36 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+powerpc-utils (1.3.11-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Thu, 01 Jun 2023 05:51:46 -0000
+
 powerpc-utils (1.3.10-2) unstable; urgency=medium
 
   * Drop bogus --parallel from dh command in debian/rules
diff --git a/debian/patches/0001-Change-program-path-for-udevadm-from-usr-bin-to-bin.patch b/debian/patches/0001-Change-program-path-for-udevadm-from-usr-bin-to-bin.patch
index bd4bf31..561df35 100644
--- a/debian/patches/0001-Change-program-path-for-udevadm-from-usr-bin-to-bin.patch
+++ b/debian/patches/0001-Change-program-path-for-udevadm-from-usr-bin-to-bin.patch
@@ -6,11 +6,11 @@ Subject: Change program path for udevadm from /usr/bin to /bin
  scripts/ofpathname | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/scripts/ofpathname b/scripts/ofpathname
-index 2ceae25..077de3f 100755
---- a/scripts/ofpathname
-+++ b/scripts/ofpathname
-@@ -330,7 +330,7 @@ is_pata_dev()
+Index: powerpc-utils.git/scripts/ofpathname
+===================================================================
+--- powerpc-utils.git.orig/scripts/ofpathname
++++ powerpc-utils.git/scripts/ofpathname
+@@ -331,7 +331,7 @@ is_pata_dev()
      local sysfs_dir
      local udev_path
      local udevinfo="/usr/bin/udevinfo"
diff --git a/man/drmgr-hooks.8 b/man/drmgr-hooks.8
new file mode 100644
index 0000000..621e4f0
--- /dev/null
+++ b/man/drmgr-hooks.8
@@ -0,0 +1,82 @@
+.\"
+.\" Copyright (C) 2022 International Business Machines
+.\"
+.TH DRMGR-HOOKS 8 "May 24, 2022" Linux "Linux on Power Service Tools"
+.SH NAME
+drmgr\-hooks \- Hooks run by drmgr
+.SH DESCRIPTION
+When
+.B drmgr
+is run to perform PowerVM Dynamic Logical Partitioning (DLPAR) operations,
+a set of hooks may be triggered to validate, and, or be aware of the incoming operation.
+.P
+Not all the DLPAR operations are providing hook calls.
+Currently only the LPAR Migration operation (LPM) is concerned.
+.P
+The hooks are executable files stored in a directory named "DRC TYPE" in
+.IR /etc/drmgr.d/ .
+For instance, hooks run when a LPAR migration is done are stored in
+.IR /etc/drmgr.d/pmig .
+.P
+Hook files can be symbolic links to executable files. All the hooks can be stored in
+.IR /etc/drmgr.d
+and linked into multiple directories to provide multiple DRC type's hooks.
+.SH ARGUMENTS
+.P
+Hooks are called without any arguments but with  at least these 2 environment variable set:
+.TP
+.BI "DRC_TYPE"
+The Dynamic reconfiguration connector type to act upon from the following list:
+.BR pmig ", " pci ", " cpu ", " mem ", " port ", " slot ", " phb "."
+.TP
+.BI "PHASE"
+The phase of the operation from the following list:
+.BR check ", " undocheck ", " pre ", " post "."
+.SH LPAR MIGRATION
+.P
+When a LPAR migration is initiated the
+.B check
+phase is first triggered. Hooks called at check phase may returned a non zero value to prevent the migration operation to happen.
+The error messages displayed in
+.BR STDOUT " or " STDERR
+would be reported to the end user through the HMC.
+.P
+If the
+.B check
+phase has failed, because at least one hook has returned a non null value, the
+.B undocheck
+phase is launched. Return value for the
+.B
+undocheck
+phase is ignored.
+.P
+If the
+.B check
+phase succeeded, the
+.BR pre " and later " post
+phases are triggered. Returned values for these 2 phases are ignored, and the
+.B post
+phase is triggered even if the LPM operation has failed.
+.SH ENVIRONMENT
+.P
+The drmgr's hooks are called while holding the DLPAR lock, so any other
+DLPAR operation initiated from a hook is expected to fail.
+.P
+The hooks standard input
+.B STDIN
+is redirected to
+.I /dev/null
+while STDOUT and STDERR are redirected to pipes.
+The outputs done in these pipes are reported to the end user when a hook has returned an error value and that error value is not ignored (e.g in the LPM, the
+.B check
+phase but not the
+.BR pre "or " post
+phase)
+.P
+Except the variables specified in the ARGUMENTS section, all the environment variables are unset before calling the hook.
+.SH FILES
+.IR /etc/drmgr.d/pmig/
+.SH AUTHOR
+Laurent Dufour <ldufour@linux.ibm.com>
+.SH SEE ALSO
+.BR drmgr (8)
diff --git a/man/drmgr.8 b/man/drmgr.8
index 09944bd..f40136b 100644
--- a/man/drmgr.8
+++ b/man/drmgr.8
@@ -158,3 +158,4 @@ was written by IBM Corporation
 
 .SH SEE ALSO
 .BR lsslot "(8)"
+.BR drmgr-hooks "(8)"
diff --git a/scripts/bootlist b/scripts/bootlist
index b5cfbd9..cc8718e 100755
--- a/scripts/bootlist
+++ b/scripts/bootlist
@@ -22,6 +22,7 @@
 
 OFPATHNAME=/usr/sbin/ofpathname
 NVRAM=/usr/sbin/nvram
+FIND=/usr/bin/find
 PSERIES_PLATFORM=$(dirname $0)/pseries_platform
 
 #
@@ -288,6 +289,57 @@ dm_to_part()
         done
 }
 
+# is_nvmf_device
+# Check to see if this is a nvmf device
+#
+is_nvmf_device()
+{
+	local res
+
+	res=`$FIND /sys/devices/virtual/nvme-fabrics -name $1 2>/dev/null`
+	if [[ ${#res} = 0 ]]; then
+		echo "no"
+	else
+		echo "yes"
+	fi
+}
+
+# get_link
+# return the directory path that a link points to.
+# The only parameter is the link name.
+#
+get_link()
+{
+	local ln_name=$1;
+
+	echo `ls -l $ln_name 2>/dev/null | awk -F"->" '{print $2}'`
+}
+
+add_nvmf()
+{
+	local DEVNAME=$1
+
+	ctrl_name=$DEVNAME
+	local startctr=$ctr
+
+	local dir
+	for dir in `$FIND /sys/devices/virtual/nvme-fabrics -name "$ctrl_name"`; do
+		cd $dir
+		link=`get_link "device"`
+		cd $link
+        for slave in `ls -d $PWD/nvme*`; do
+            slavedev=${slave##*/}
+            LOGICAL_NAMES[$ctr]=${slavedev}
+            ctr=$[$ctr + 1]
+		done
+	done
+
+	if [[ "$startctr" = "$ctr" ]] ; then
+		LOGICAL_NAMES[$ctr]=$1
+		ctr=$[$ctr + 1]
+	fi
+}
+
 add_logical()
 {
     local DEVNAME=$1
@@ -432,7 +484,36 @@ while [[ -n $1 ]]; do
 	exit -1
     else
         # add this element to the array
-	add_logical $1
+        if [[ "$1" == *"dm-"* ]] ; then
+            add_logical $1
+        else
+            if [[ "$1" == *"nvme-of"* ]]; then
+                ctrl_name=`get_logical_device_name $1`
+            else
+            	ctrl_name=$1
+            	ctrl_name=${ctrl_name##*/}
+            fi
+            ctrl_name="${ctrl_name%n[0-9]*}"
+            is_nvmf=$(is_nvmf_device $ctrl_name)
+            if [[ $is_nvmf = "yes" ]]; then
+                if [[ "$1" == *"nvme-of"* ]]; then
+                    master_of_path=$1
+                else
+                    master_of_path=`get_of_device_name $1`
+                fi
+
+                if [[ -z $master_of_path ]]; then
+                    echo "Device $1 does not appear to be valid." >&2
+                    exit 1
+                fi
+
+                namespace_base=${master_of_path##*/}
+                DEVTYPE="nvme-of"
+                add_nvmf $ctrl_name
+            else
+                add_logical $1
+            fi
+        fi
     fi
 
     shift
@@ -453,6 +534,9 @@ if [[ ${#LOGICAL_NAMES[*]} -ne 0 ]]; then
         if [[ -z ${OF_DEVPATH[$ctr]} ]]; then
 	    # See if this is an OF pathname
 	    OF_DEVPATH[$ctr]=`get_of_device_name ${LOGICAL_NAMES[$ctr]}`
+	    if [[ $DEVTYPE = "nvme-of" ]]; then
+		    OF_DEVPATH[$ctr]=${OF_DEVPATH[$ctr]}/$namespace_base
+	    fi
 	else
 	    OF_DEVPATH[$ctr]=${LOGICAL_NAMES[$ctr]}
         fi
diff --git a/scripts/hcnmgr b/scripts/hcnmgr
index 6946ff9..b5a6bfb 100644
--- a/scripts/hcnmgr
+++ b/scripts/hcnmgr
@@ -375,7 +375,8 @@ do_config_vdevice_nm() {
 	# if the device is primary, and link is up, force it as primary se
 	if [[ $MODE == "primary" ]]; then
 		hcnlog INFO "Change bonding primary slave to $DEVNAME"
-		echo "$DEVNAME" >"$BOND_PATH"/primary
+		nmcli con mod id "$BONDNAME" +bond.options "primary=$DEVNAME"
+		nmcli con up "$BONDNAME"
 	fi
 
 	hcnlog DEBUG "do_config_vdevice: exit"
diff --git a/scripts/ofpathname b/scripts/ofpathname
index b1d6b09..3abe4d1 100755
--- a/scripts/ofpathname
+++ b/scripts/ofpathname
@@ -773,8 +773,7 @@ l2of_nvmf()
             t_wwpn="${t_wwpn#0x}"
             t_wwpn="${t_wwpn%,*}"
             nqn=`$CAT $PWD/subsysnqn`
-            cntlid_dec=`$CAT $PWD/cntlid`
-            cntlid=`echo "obase=16; $cntlid_dec" |bc`
+            cntlid=`echo ffff`
             if [[ -n $h_wwpn ]]; then
                 for f in `$FIND /sys/devices -name "port_name"`; do
                     sys_wwpn=`$CAT $f 2>/dev/null`
@@ -808,6 +807,9 @@ l2of_nvmf()
         if [[ ${#res} = 0 ]]; then
             OF_PATH=""
         else
+            goto_dir $res
+            devnsid=`$CAT $PWD/nsid | tr -d '\000'`
+	    devnsid=$(printf "%x" $devnsid)
             OF_PATH="$OF_PATH/namespace@$devnsid"
         fi
     fi
@@ -818,6 +820,8 @@ l2of_nvmf()
         if [[ ${#res} = 0 ]]; then
             OF_PATH=""
         else
+            goto_dir $res
+            devpart=`$CAT $PWD/partition | tr -d '\000'`
             OF_PATH="${OF_PATH}:${devpart}"
         fi
     fi
@@ -1826,8 +1830,7 @@ of2l_nvmf()
     ctrl_name=`echo $DEVNAME | cut -d "/" -f 5`
     OF_WWPN=${ctrl_name%,*}
     OF_WWPN=${OF_WWPN#*@}
-    of_cntlid=${ctrl_name%%:*}
-    of_cntlid=${of_cntlid#*,}
+    OF_NQN=`echo $ctrl_name | cut -d "=" -f 2`
     # set partition number only if ':' is present
     case "${nsid_part}" in
     *:*)
@@ -1835,6 +1838,7 @@ of2l_nvmf()
         ;;
     esac
     local dir
+    local found=0
 
     for dir in `$FIND /sys/devices/virtual/nvme-fabrics -name "nvme[0-9]*"`; do
         cd $dir
@@ -1844,10 +1848,9 @@ of2l_nvmf()
             t_wwpn="${t_wwpn%,*}"
             h_wwpn=`$CAT $PWD/address | cut  -f 5 -d "-"`
             h_wwpn="${h_wwpn#0x}"
-            cntlid_dec=`$CAT $PWD/cntlid 2>/dev/null`
-            cntlid=`echo "obase=16; $cntlid_dec" |bc`
+            nqn=`$CAT $PWD/subsysnqn`
             if [[ $t_wwpn = $OF_WWPN ]] && \
-                [[ $cntlid == $of_cntlid ]]; then
+                [[ $nqn == $OF_NQN ]]; then
                 for f in `$FIND /sys/devices -name "port_name"`; do
                     sys_wwpn=`$CAT $f 2>/dev/null`
                     sys_wwpn="${sys_wwpn#0x}"
@@ -1871,14 +1874,32 @@ of2l_nvmf()
             fi
         fi
     done
+
+    local ana_dir
     if [[ -n $LOGICAL_DEVNAME ]] && \
        [[ -n $nsid ]]; then
-        res=`$FIND /sys/devices/virtual -name ${LOGICAL_DEVNAME}n${nsid}`
-        if [[ ${#res} = 0 ]]; then
-            LOGICAL_DEVNAME=''
-        else
-            LOGICAL_DEVNAME="${LOGICAL_DEVNAME}n${nsid}"
-        fi
+        for ana_dir in `$FIND /sys/devices/virtual/nvme-fabrics -name "$LOGICAL_DEVNAME"`; do
+            cd $ana_dir
+            link=`get_link "device"`
+            cd $link
+            for ana_name in `ls -d $PWD/nvme*`; do
+                for dev_name in `$FIND /sys/block -name "${ana_name##*/}n[0-9]*"`; do
+                    cd $dev_name
+                    local devnsid=`$CAT ./nsid 2>/dev/null`
+		    devnsid=$(printf "%x" $devnsid)
+                    if [[ $devnsid = $nsid ]]; then
+                        found=1
+                        NS_ID="${dev_name##*n}"
+                        LOGICAL_DEVNAME="${LOGICAL_DEVNAME}n${NS_ID}"
+                        break
+                    fi
+                 done
+            done
+        done
+        
+    	 if [[ $found -eq 0 ]]; then
+            LOGICAL_DEVNAME=""
+         fi
     fi
 
     if [[ -n $LOGICAL_DEVNAME ]] && \
diff --git a/src/drmgr/common.c b/src/drmgr/common.c
index 393a997..9cd91d1 100644
--- a/src/drmgr/common.c
+++ b/src/drmgr/common.c
@@ -49,9 +49,33 @@ char *remove_slot_fname = REMOVE_SLOT_FNAME;
 
 #define SYSFS_DLPAR_FILE	"/sys/kernel/dlpar"
 
+#define DR_SCRIPT_DIR	"/etc/drmgr.d"
+
 static int dr_lock_fd = 0;
 static long dr_timeout;
 
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+static char *drc_type_str[] = {
+	[DRC_TYPE_NONE]		= "unknwon",
+	[DRC_TYPE_PCI]		= "pci",
+	[DRC_TYPE_SLOT]		= "slot",
+	[DRC_TYPE_PHB]		= "phb",
+	[DRC_TYPE_CPU]		= "cpu",
+	[DRC_TYPE_MEM]		= "mem",
+	[DRC_TYPE_PORT]		= "port",
+	[DRC_TYPE_HIBERNATE]	= "phib",
+	[DRC_TYPE_MIGRATION]	= "pmig",
+	[DRC_TYPE_ACC]		= "acc",
+};
+
+static char *hook_phase_name[] = {
+	[HOOK_CHECK]		= "check",
+	[HOOK_UNDOCHECK]	= "undocheck",
+	[HOOK_PRE]		= "pre",
+	[HOOK_POST]		= "post",
+};
+
 /**
  * set_output level
  * @brief Common routine to set the output level
@@ -174,7 +198,7 @@ inline int dr_init(void)
 	}
 
 
-	log_fd = open(DR_LOG_PATH, O_RDWR | O_CREAT | O_APPEND,
+	log_fd = open(DR_LOG_PATH, O_RDWR | O_CREAT | O_APPEND | O_CLOEXEC,
 		      S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 	if (log_fd == -1) {
 		log_fd = 0;
@@ -314,7 +338,7 @@ int dr_lock(void)
 	mode_t          old_mode;
 
 	old_mode = umask(0);
-	dr_lock_fd = open(DR_LOCK_FILE, O_RDWR | O_CREAT,
+	dr_lock_fd = open(DR_LOCK_FILE, O_RDWR | O_CREAT | O_CLOEXEC,
 			  S_IRUSR | S_IRGRP | S_IROTH);
 	if (dr_lock_fd < 0)
 		return -1;
@@ -1496,7 +1520,7 @@ int do_kernel_dlpar_common(const char *cmd, int cmdlen, int silent_error)
 
 	/* write to file */
 	if (fd == -1) {
-		fd = open(SYSFS_DLPAR_FILE, O_WRONLY);
+		fd = open(SYSFS_DLPAR_FILE, O_WRONLY | O_CLOEXEC);
 		if (fd < 0) {
 			say(ERROR,
 			    "Could not open %s to initiate DLPAR request\n",
@@ -1521,36 +1545,148 @@ int do_kernel_dlpar_common(const char *cmd, int cmdlen, int silent_error)
 
 enum drc_type to_drc_type(const char *arg)
 {
-	if (!strncmp(arg, "pci", 3))
-		return DRC_TYPE_PCI;
+	enum drc_type i;
 
-	if (!strncmp(arg, "slot", 4))
-		return DRC_TYPE_SLOT;
+	for (i = DRC_TYPE_NONE + 1; i < ARRAY_SIZE(drc_type_str); i++) {
+		if (!strcmp(arg, drc_type_str[i]))
+			return i;
+	}
 
-	if (!strncmp(arg, "phb", 3))
-		return DRC_TYPE_PHB;
+	return DRC_TYPE_NONE;
+}
 
-	if (!strncmp(arg, "cpu", 3))
-		return DRC_TYPE_CPU;
+static int run_one_hook(enum drc_type drc_type,	enum hook_phase phase,
+			const char *name)
+{
+	int rc;
+	pid_t child;
 
-	if (!strncmp(arg, "mem", 3))
-		return DRC_TYPE_MEM;
+	fflush(NULL);
+	child = fork();
+	if (child == -1) {
+		say(ERROR, "Can't fork to run a hook: %s\n", strerror(errno));
+		return -1;
+	}
 
-	if (!strncmp(arg, "port", 4))
-		return DRC_TYPE_PORT;
+	if (child) {
+		/* Father side */
+		while (waitpid(child, &rc, 0) == -1) {
+			if (errno == EINTR)
+				continue;
+			say(ERROR, "waitpid error: %s\n", strerror(errno));
+			return -1;
+		}
 
-	if (!strncmp(arg, "phib", 4))
-		return DRC_TYPE_HIBERNATE;
+		if (WIFSIGNALED(rc)) {
+			say(INFO, "hook '%s' terminated by signal %d\n",
+			    name, WTERMSIG(rc));
+			rc = 1;
+		} else {
+			rc = WEXITSTATUS(rc);
+			say(INFO, "hook '%s' exited with status %d\n",
+			    name, rc);
+		}
+		return rc;
+	}
 
-	if (!strncmp(arg, "pmig", 4))
-		return DRC_TYPE_MIGRATION;
 
-	/*
-	 * Accelerator
-	 */
-	if (!strncmp(arg, "acc", 3))
-		return DRC_TYPE_ACC;
+	/* Child side */
+	say(DEBUG, "Running hook '%s' for phase %s (PID=%d)\n",
+	    name, hook_phase_name[phase], getpid());
 
-	return DRC_TYPE_NONE;
+	if (chdir("/")) {
+		say(ERROR, "Can't change working directory to / : %s\n",
+		    strerror(errno));
+		exit(255);
+	}
+
+	if (clearenv() ||
+	    setenv("DRC_TYPE", drc_type_str[drc_type], 1) ||
+	    setenv("PHASE", hook_phase_name[phase], 1)) {
+		say(ERROR, "Can't set environment variables: %s\n",
+		    strerror(errno));
+		exit(255);
+	}
+
+	execl(name, name, (char *)NULL);
+	say(ERROR, "Can't exec hook %s : %s\n", strerror(errno));
+	exit(255);
 }
 
+static int is_file_or_link(const struct dirent *entry)
+{
+	if ((entry->d_type == DT_REG) || (entry->d_type == DT_LNK))
+		return 1;
+	return 0;
+}
+
+/*
+ * Run all executable hooks found in a given directory.
+ * Return 0 if all run script have returned 0 status.
+ */
+int run_hooks(enum drc_type drc_type, enum hook_phase phase)
+{
+	int rc = 0, fdd, num, i;
+	DIR *dir;
+	struct dirent **entries = NULL;
+
+	/* Sanity check */
+	if (drc_type <= DRC_TYPE_NONE || drc_type >= ARRAY_SIZE(drc_type_str)) {
+		say(ERROR, "Invalid DRC TYPE detected (%d)\n", drc_type);
+		return -1;
+	}
+
+	if (phase < HOOK_CHECK || phase > HOOK_POST) {
+		say(ERROR, "Invalid hook phase %d\n", phase);
+		return -1;
+	}
+
+	dir = opendir(DR_SCRIPT_DIR);
+	if (dir == NULL) {
+		if (errno == ENOENT)
+			return 0;
+		say(ERROR, "Can't open %s: %s\n", DR_SCRIPT_DIR,
+		    strerror(errno));
+		return -1;
+	}
+
+	fdd = dirfd(dir);
+	num = scandirat(fdd, drc_type_str[drc_type], &entries,
+			is_file_or_link, versionsort);
+	closedir(dir);
+
+	for (i = 0; i < num; i++) {
+		struct stat st;
+		struct dirent *entry = entries[i];
+		char *name;
+
+		if (asprintf(&name, "%s/%s/%s", DR_SCRIPT_DIR,
+			     drc_type_str[drc_type], entry->d_name) == -1) {
+			say(ERROR,
+			    "Can't allocate filename string (%zd bytes)\n",
+			    strlen(DR_SCRIPT_DIR) + 1 +
+			    strlen(drc_type_str[drc_type]) + 1 +
+			    strlen(entry->d_name) + 1);
+			rc = 1;
+			free(entry);
+			continue;
+		}
+
+		/*
+		 * Report error only in the case the hook itself fails.
+		 * Any other error (file is not executable etc.) is ignored.
+		 */
+		if (stat(name, &st))
+			say(WARN, "Can't stat file %s: %s\n",
+			    name, strerror(errno));
+		else if (S_ISREG(st.st_mode) && (st.st_mode & S_IXUSR) &&
+			 run_one_hook(drc_type, phase, name))
+			rc = 1;
+
+		free(name);
+		free(entry);
+	}
+
+	free(entries);
+	return rc;
+}
diff --git a/src/drmgr/common_pci.c b/src/drmgr/common_pci.c
index cbd48c9..c6dcfdf 100644
--- a/src/drmgr/common_pci.c
+++ b/src/drmgr/common_pci.c
@@ -462,7 +462,7 @@ devspec_check_node(struct dr_node *node, char *sysfs_path,
 
 	*found = 0;
 
-	if (node->ofdt_path == NULL)
+	if (!strlen(node->ofdt_path))
 		return 0;
 
 	if (! strcmp(full_of_path, node->ofdt_path)) {
diff --git a/src/drmgr/dr.h b/src/drmgr/dr.h
index 58fdb5c..5526c29 100644
--- a/src/drmgr/dr.h
+++ b/src/drmgr/dr.h
@@ -70,6 +70,8 @@ enum drc_type {DRC_TYPE_NONE, DRC_TYPE_PCI, DRC_TYPE_SLOT, DRC_TYPE_PHB,
 	       DRC_TYPE_CPU, DRC_TYPE_MEM, DRC_TYPE_PORT,
 	       DRC_TYPE_HIBERNATE, DRC_TYPE_MIGRATION, DRC_TYPE_ACC};
 
+enum hook_phase {HOOK_CHECK, HOOK_UNDOCHECK, HOOK_PRE, HOOK_POST};
+
 extern enum drmgr_action usr_action;
 extern int display_capabilities;
 extern int usr_slot_identification;
@@ -133,6 +135,8 @@ void print_dlpar_capabilities(void);
 
 void set_output_level(int);
 
+int run_hooks(enum drc_type drc_type, enum hook_phase phase);
+
 #define DR_BUF_SZ	256
 
 int drslot_chrp_slot(void);
diff --git a/src/drmgr/drmem.h b/src/drmgr/drmem.h
index db5a47f..48108c5 100644
--- a/src/drmgr/drmem.h
+++ b/src/drmgr/drmem.h
@@ -58,7 +58,7 @@ struct drconf_mem_v2 {
 #define LMB_REVERSE_SORT	1
 #define LMB_RANDOM_SORT		2
 
-extern int block_sz_bytes;
+extern uint64_t block_sz_bytes;
 
 struct lmb_list_head *get_lmbs(unsigned int);
 void free_lmbs(struct lmb_list_head *);
diff --git a/src/drmgr/drmig_chrp_pmig.c b/src/drmgr/drmig_chrp_pmig.c
index 569eeb6..f169fa5 100644
--- a/src/drmgr/drmig_chrp_pmig.c
+++ b/src/drmgr/drmig_chrp_pmig.c
@@ -691,12 +691,15 @@ void post_mobility_update(void)
 		devtree_update();
 	}
 }
-	
+
 int drmig_chrp_pmig(void)
 {
 	int rc;
-	char sys_src[20];
 	uint64_t stream_val;
+	enum drc_type drc_type = DRC_TYPE_NONE;
+
+	if (usr_action == MIGRATE)
+		drc_type = DRC_TYPE_MIGRATION;
 
 	/* Ensure that this partition is migratable/mobile */
 	if (! pmig_capable()) {
@@ -705,14 +708,11 @@ int drmig_chrp_pmig(void)
 		return -1;
 	}
 
-	/* Today we do no pre-checks for migratability. The only check
-	 * we could do is whether the "ibm,suspend-me" RTAS call exists.
-	 * But if it doesn't, the firmware level doesn't support migration,
-	 * in which case why the heck are we being invoked anyways.
-	 */
-	if (strcmp(usr_p_option, "check") == 0) {
-		say(DEBUG, "check: Nothing to do...\n");
-		return 0;
+	if (usr_action == MIGRATE && (strcmp(usr_p_option, "check") == 0)) {
+		rc = run_hooks(drc_type, HOOK_CHECK);
+		if (rc)
+			run_hooks(drc_type, HOOK_UNDOCHECK);
+		return rc;
 	}
 
 	/* The only other command is pre, any other command is invalid */
@@ -732,13 +732,12 @@ int drmig_chrp_pmig(void)
 		say(ERROR, "Invalid streamid specified: %s\n", strerror(errno));
 		return -1;
 	}
-	
-	/* Get the ID of the original system, for later logging */
-	get_str_attribute(OFDT_BASE, "system-id", sys_src, 20);
-	sleep(5);
 
 	/* Now do the actual migration */
 	do {
+		if (usr_action == MIGRATE)
+			run_hooks(drc_type, HOOK_PRE);
+
 		if (usr_action == MIGRATE)
 			rc = do_migration(stream_val);
 		else if (usr_action == HIBERNATE)
@@ -753,13 +752,12 @@ int drmig_chrp_pmig(void)
 
 	syslog(LOG_LOCAL0 | LOG_INFO, "drmgr: %s rc %d\n",
 	       (usr_action == MIGRATE ? "migration" : "hibernation"), rc);
-	if (rc)
-		return rc;
 
-	post_mobility_update();
+	if (!rc)
+		post_mobility_update();
 
-	say(DEBUG, "Refreshing RMC via refrsrc\n");
-	rc = system("/usr/sbin/rsct/bin/refrsrc IBM.ManagementServer");
-
-	return 0;
+	/* Post hook is called even if the migration has failed */
+	if (usr_action == MIGRATE)
+		run_hooks(drc_type, HOOK_POST);
+	return rc;
 }
diff --git a/src/drmgr/drslot_chrp_hea.c b/src/drmgr/drslot_chrp_hea.c
index 98b96e0..714752a 100644
--- a/src/drmgr/drslot_chrp_hea.c
+++ b/src/drmgr/drslot_chrp_hea.c
@@ -121,7 +121,7 @@ hotplug_port(int action, struct dr_node *hea, struct dr_node *port)
 
 	say(DEBUG, "Attempting to hotplug %s Port.\n", action_str);
 	
-	if (! hea->sysfs_dev_path) {
+	if (!strlen(hea->sysfs_dev_path)) {
 		say(DEBUG, "Non-existant sysfs dev path for Port, hotplug "
 		    "failed.\n");
 		return -EINVAL;
diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c
index 3b78723..d37ee80 100644
--- a/src/drmgr/drslot_chrp_mem.c
+++ b/src/drmgr/drslot_chrp_mem.c
@@ -33,7 +33,7 @@
 #include "drmem.h"
 #include "common_numa.h"
 
-int block_sz_bytes = 0;
+uint64_t block_sz_bytes = 0;
 static char *state_strs[] = {"offline", "online"};
 
 static char *usagestr = "-c mem {-a | -r} {-q <quantity> -p {variable_weight | ent_capacity} | {-q <quantity> | -s [<drc_name> | <drc_index>]}}";
@@ -118,7 +118,7 @@ free_lmbs(struct lmb_list_head *lmb_list)
 static int
 get_mem_scns(struct dr_node *lmb)
 {
-	uint32_t lmb_sz = lmb->lmb_size;
+	uint64_t lmb_sz = lmb->lmb_size;
 	uint64_t phys_addr = lmb->lmb_address;
 	uint32_t mem_scn;
 	int rc = 0;
diff --git a/src/drmgr/lsslot.c b/src/drmgr/lsslot.c
index 7ea0f8b..83e9e85 100644
--- a/src/drmgr/lsslot.c
+++ b/src/drmgr/lsslot.c
@@ -741,7 +741,7 @@ int print_drconf_mem(struct lmb_list_head *lmb_list)
 	if (usr_drc_name)
 		drc_index = strtol(usr_drc_name, NULL, 0);
 
-	printf("Dynamic Reconfiguration Memory (LMB size 0x%x)\n",
+	printf("Dynamic Reconfiguration Memory (LMB size 0x%"PRIx64")\n",
 	       lmb_list->lmbs->lmb_size);
 
 	for (lmb = lmb_list->lmbs; lmb; lmb = lmb->next) {
@@ -756,7 +756,7 @@ int print_drconf_mem(struct lmb_list_head *lmb_list)
 		printf("%s: %s\n", lmb->drc_name,
 		       lmb->is_owned ? "" : "Not Owned");
 
-		printf("    DRC Index: %x        Address: %"PRIu64"\n",
+		printf("    DRC Index: %x        Address: %"PRIx64"\n",
 		       lmb->drc_index, lmb->lmb_address);
 		printf("    Removable: %s             Associativity: ",
 		       lmb->is_removable ? "Yes" : "No ");
@@ -808,7 +808,7 @@ int lsslot_chrp_mem(void)
 	if (lmb_list->drconf_buf) {
 		print_drconf_mem(lmb_list);
 	} else {
-		printf("lmb size: 0x%x\n", lmb_list->lmbs->lmb_size);
+		printf("lmb size: 0x%"PRIx64"\n", lmb_list->lmbs->lmb_size);
 		printf("%-20s  %-5s  %c  %s\n", "Memory Node", "Name", 'R',
 		       "Sections");
 		printf("%-20s  %-5s  %c  %s\n", "-----------", "----", '-',
diff --git a/src/drmgr/ofdt.h b/src/drmgr/ofdt.h
index 26c943a..bd90810 100644
--- a/src/drmgr/ofdt.h
+++ b/src/drmgr/ofdt.h
@@ -94,7 +94,7 @@ struct dr_node {
 	union {
 		struct mem_info {
 			uint64_t	_address;
-			uint32_t	_lmb_size;
+			uint64_t	_lmb_size;
 			uint32_t	_lmb_aa_index;
 			struct mem_scn	*_mem_scns;
 			struct of_node	*_of_node;
diff --git a/src/errinjct/ioa_bus_error.c b/src/errinjct/ioa_bus_error.c
index 9d85cfa..4482a78 100644
--- a/src/errinjct/ioa_bus_error.c
+++ b/src/errinjct/ioa_bus_error.c
@@ -50,8 +50,6 @@ static char *loc_code;       /**< location code of adapter to inject to */
 
 #define IOA_BUSERR_MAXFUNC		19
 
-#define BUFSZ 4000
-
 /**
  * ioa_buserr_fnames
  * @brief list of IOA bus error functionalities
@@ -194,20 +192,16 @@ int ioa_bus_error_arg(char arg, char *optarg)
  * Given the directory /proc/device-tree/pci@...,
  * yank out the config address out of the reg file
  *
- * @param devpath device-tree path of the reg file
+ * @param regpath device-tree path of the reg file
  * @return 0 on failure, config address (!0) on success
  */
-static uint32_t get_config_addr_from_reg(char *devpath)
+static uint32_t get_config_addr_from_reg(char *regpath)
 {
-	char path[BUFSZ];
 	char *buf;
 	uint32_t *be_caddr;
 	uint32_t caddr = 0;
 
-	strncpy(path, devpath, BUFSZ-5);
-	strcat(path, "/reg");
-
-	buf = read_file(path, NULL);
+	buf = read_file(regpath, NULL);
 	if (!buf)
 		return 1;
 
@@ -231,7 +225,7 @@ static uint32_t get_config_addr_from_reg(char *devpath)
  */
 static int parse_sysfsname(void)
 {
-	char path[BUFSZ];
+	char path[PATH_MAX];
 	char *devspec;
 	char *at, *nl;
 	uint32_t addr;
@@ -272,6 +266,7 @@ static int parse_sysfsname(void)
 	/* Obtain the config address from the device-tree reg file */
 	strcpy(path, "/proc/device-tree/");
 	strcat(path, devspec);
+	strcat(path, "/reg");
 	addr = get_config_addr_from_reg(path);
 	if (addr) {
 		config_addr = addr;
@@ -307,7 +302,7 @@ static char *recurse_hunt_file_contents(char *base_path, const char *filename,
 					const char *desired_file_contents,
 					int chase_link_cnt)
 {
-	char path[BUFSZ];
+	char path[PATH_MAX];
 	char *loco;
 
 	strcpy(path, base_path);
@@ -380,7 +375,7 @@ static char *recurse_hunt_file_contents(char *base_path, const char *filename,
  */
 static int hunt_loc_code(void)
 {
-	char path[BUFSZ];
+	char path[PATH_MAX];
 	char *match_dir;
 	char *devspec;
 	char *at;
@@ -412,6 +407,7 @@ static int hunt_loc_code(void)
 	phb_id_lo = phb_id & 0xFFFFFFFF;
 
 	/* Try to get the config address from the dev-tree reg file. */
+	strcat(path, "/reg");
 	addr = get_config_addr_from_reg(path);
 	if (addr) {
 		config_addr = addr;
diff --git a/src/lparstat.c b/src/lparstat.c
index 0b30fc9..31a4ee8 100644
--- a/src/lparstat.c
+++ b/src/lparstat.c
@@ -180,7 +180,7 @@ int parse_sysfs_values(void)
 
 	spurr = idle_spurr = idle_purr = 0UL;
 
-	for (i = 0; cpu_sysfs_fds[i].spurr > 0; i++) {
+	for (i = 0; (i < threads_in_system) && (cpu_sysfs_fds[i].spurr >= 0); i++) {
 		rc = pread(cpu_sysfs_fds[i].spurr, (void *)line, sizeof(line), 0);
 		if (rc == -1) {
 			fprintf(stderr, "Failed to read /sys/devices/system/cpu/cpu%d/spurr\n",
@@ -718,6 +718,16 @@ void get_capped_mode(struct sysentry *se, char *buf)
 	sprintf(buf, "%s", value);
 }
 
+void get_dedicated_mode(struct sysentry *se, char *buf)
+{
+	const char *value = "Capped";
+
+	if (se->value[0] == '1')
+		value = "Donating";
+
+	sprintf(buf, "%s", value);
+}
+
 void get_percent_entry(struct sysentry *se, char *buf)
 {
 	float value;
@@ -1057,7 +1067,10 @@ void print_system_configuration(void)
 	get_sysdata("shared_processor_mode", &descr, value);
 	offset = sprintf(buf, "type=%s ", value);
 	sprintf(type, "%s", value);
-	get_sysdata("capped", &descr, value);
+	if (!strcmp(value, "Dedicated"))
+		get_sysdata("DedDonMode", &descr, value);
+	else
+		get_sysdata("capped", &descr, value);
 	offset += sprintf(buf + offset, "mode=%s ", value);
 	get_sysdata("smt_state", &descr, value);
 	offset += sprintf(buf + offset, "smt=%s ", value);
diff --git a/src/lparstat.h b/src/lparstat.h
index 26ed4ba..b7c88e9 100644
--- a/src/lparstat.h
+++ b/src/lparstat.h
@@ -47,6 +47,7 @@ typedef struct cpu_sysfs_file_desc cpu_sysfs_fd;
 
 extern void get_smt_state(struct sysentry *, char *);
 extern void get_capped_mode(struct sysentry *, char *);
+extern void get_dedicated_mode(struct sysentry *, char *);
 extern void get_memory_mode(struct sysentry *, char *);
 extern void get_percent_entry(struct sysentry *, char *);
 extern void get_phys_cpu_percentage(struct sysentry *, char *);
@@ -110,7 +111,8 @@ struct sysentry system_data[] = {
 	{.name = "DesVarCapWt",
 	 .descr = "Desired Variable Capacity Weight"},
 	{.name = "DedDonMode",
-	 .descr = "Dedicated Donation Mode"},
+	 .descr = "Dedicated Donation Mode",
+	 .get = &get_dedicated_mode},
 	{.name = "partition_entitled_capacity",
 	 .descr = "Partition Entitled Capacity"},
 	{.name = "system_active_processors",
diff --git a/src/serv_config.c b/src/serv_config.c
index 00ab672..23f9090 100644
--- a/src/serv_config.c
+++ b/src/serv_config.c
@@ -687,7 +687,7 @@ retrieve_value(struct service_var *var, char *buf, size_t size) {
 			if (var->sysparm_num == USE_CALL_HOME_SYSPARM)
 				break;
 
-			ret_size = be16toh(*param);
+			ret_size = be16toh(*((uint16_t *)param));
 			if (!strcmp(var->nvram_var, "sp-ri-pon") ||
 				!strcmp(var->nvram_var, "sp-remote-pon") ||
 				!strcmp(var->nvram_var, "sp-sen")) {
diff --git a/src/vcpustat.c b/src/vcpustat.c
index 415846f..d17afe7 100644
--- a/src/vcpustat.c
+++ b/src/vcpustat.c
@@ -141,7 +141,7 @@ void print_stats(struct vcpudispatch_stat stats1[],
 	char raw_header1[] = "%22s %43s | %32s\n";
 	char raw_header2[] = "%-7s | %10s | %10s %10s %10s %10s | %10s %10s %10s\n";
 	char raw_fmt[] = "cpu%-4d | %10d | %10d %10d %10d %10d | %10d %10d %10d\n";
-	struct vcpudispatch_stat stat;
+	struct vcpudispatch_stat stat = {};
 	int i;
 
 	if (stats_off) {

More details

Full run details

Historical runs