diff --git a/powerpc-utils-2fbd7c-add_NVMf-FC_boot_support_part2.patch b/powerpc-utils-2fbd7c-add_NVMf-FC_boot_support_part2.patch new file mode 100644 index 0000000..0b602c2 --- /dev/null +++ b/powerpc-utils-2fbd7c-add_NVMf-FC_boot_support_part2.patch @@ -0,0 +1,110 @@ +commit 2fbd7c1ff428e534d80f60e03501d625ab594eca +Author: Wen Xiong +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 + Signed-off-by: Tyrel Datwyler + +diff --git a/scripts/ofpathname b/scripts/ofpathname +index b1d6b09..33d7702 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=`echo "obase=16; $devnsid" |bc` + 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,23 @@ of2l_nvmf() + fi + fi + done ++ + 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 dir in `$FIND /sys/block -name "${LOGICAL_DEVNAME}n[0-9]*"`; do ++ cd $dir ++ ++ local devnsid=`$CAT ./nsid 2>/dev/null` ++ devnsid=`echo "obase=16; $devnsid" |bc` ++ if [[ $devnsid = $nsid ]]; then ++ found=1 ++ LOGICAL_DEVNAME="${dir##*/}" ++ break ++ fi ++ done ++ if [[ $found -eq 0 ]]; then ++ LOGICAL_DEVNAME="" ++ fi + fi + + if [[ -n $LOGICAL_DEVNAME ]] && \ diff --git a/powerpc-utils-b1b9e7-LMB_size_4GB.patch b/powerpc-utils-b1b9e7-LMB_size_4GB.patch new file mode 100644 index 0000000..d700293 --- /dev/null +++ b/powerpc-utils-b1b9e7-LMB_size_4GB.patch @@ -0,0 +1,98 @@ +commit b1b9e76de0f3ab1dfcd9426779fa20fd77cd5625 +Author: Luciano Chavez +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 + Signed-off-by: Tyrel Datwyler + +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/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 -p {variable_weight | ent_capacity} | {-q | -s [ | ]}}"; +@@ -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 87f876e..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) { +@@ -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/powerpc-utils-c01580-add_NVMf-FC_boot_support_part1.patch b/powerpc-utils-c01580-add_NVMf-FC_boot_support_part1.patch new file mode 100644 index 0000000..40b41aa --- /dev/null +++ b/powerpc-utils-c01580-add_NVMf-FC_boot_support_part1.patch @@ -0,0 +1,131 @@ +commit c015807d5bef0ebdeaf99883793173f2b636e740 +Author: Wen Xiong +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 + Signed-off-by: Tyrel Datwyler + +diff --git a/scripts/bootlist b/scripts/bootlist +index b5cfbd9..1929f65 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,63 @@ 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 $PWD/*; do ++ slavedev=${slave##*/} ++ if [[ "$slavedev" == nvme[0-9]* ]] ; then ++ cd $slave ++ res=`$FIND . -name "${ctrl_name}*"` ++ if [[ ${#res} != 0 ]]; then ++ LOGICAL_NAMES[$ctr]=${slavedev} ++ ctr=$[$ctr + 1] ++ fi ++ fi ++ done ++ done ++ ++ if [[ "$startctr" = "$ctr" ]] ; then ++ LOGICAL_NAMES[$ctr]=$1 ++ ctr=$[$ctr + 1] ++ fi ++} ++ + add_logical() + { + local DEVNAME=$1 +@@ -432,7 +490,30 @@ 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 ++ 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/powerpc-utils-e1f1de-lmb_address_in_hexadecimal.patch b/powerpc-utils-e1f1de-lmb_address_in_hexadecimal.patch new file mode 100644 index 0000000..6aedbcc --- /dev/null +++ b/powerpc-utils-e1f1de-lmb_address_in_hexadecimal.patch @@ -0,0 +1,29 @@ +commit e1f1deb06d9168a95a381a2236e1d8c693d3d229 +Author: Luciano Chavez +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 + Signed-off-by: Tyrel Datwyler + +diff --git a/src/drmgr/lsslot.c b/src/drmgr/lsslot.c +index 7ea0f8b..87f876e 100644 +--- a/src/drmgr/lsslot.c ++++ b/src/drmgr/lsslot.c +@@ -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 "); diff --git a/powerpc-utils.spec b/powerpc-utils.spec index bfbdd67..760e3bb 100644 --- a/powerpc-utils.spec +++ b/powerpc-utils.spec @@ -1,6 +1,6 @@ Name: powerpc-utils Version: 1.3.10 -Release: 4%{?dist} +Release: 5%{?dist} Summary: PERL-based scripts for maintaining and servicing PowerPC systems License: GPLv2 @@ -9,6 +9,12 @@ Source0: https://github.com/ibm-power-utilities/%{name}/archive/v%{versio Source1: nx-gzip.udev Patch0: powerpc-utils-1.3.10-manpages.patch Patch1: powerpc-utils-1.3.10-distro.patch +# bz#2121470, Fix lsslot -c mem output when using 4GB LMB size +Patch3: powerpc-utils-b1b9e7-LMB_size_4GB.patch +Patch4: powerpc-utils-e1f1de-lmb_address_in_hexadecimal.patch +# bz#2110129, Add NVMf-FC boot support for Power - powerpc-utils +Patch5: powerpc-utils-c01580-add_NVMf-FC_boot_support_part1.patch +Patch6: powerpc-utils-2fbd7c-add_NVMf-FC_boot_support_part2.patch ExclusiveArch: ppc %{power64} @@ -198,6 +204,10 @@ systemctl enable hcn-init.service >/dev/null 2>&1 || : %changelog +* Wed Nov 02 2022 Than Ngo - 1.3.10-5 +- Fix lsslot -c mem output when using 4GB LMB size +- Add NVMf-FC boot support for Power + * Fri Jul 22 2022 Fedora Release Engineering - 1.3.10-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild