Resolves: RRHEL-11475, update to 1.7.15

This commit is contained in:
Than Ngo 2023-12-08 20:46:42 +01:00 committed by root
parent 7596a28a58
commit c4bd2ac5f4
8 changed files with 10 additions and 416 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ lsvpd-1.6.8.tar.gz
/lsvpd-1.7.11.tar.gz
/lsvpd-1.7.12.tar.gz
/lsvpd-1.7.14.tar.gz
/lsvpd-1.7.15.tar.gz

1
.lsvpd.metadata Normal file
View File

@ -0,0 +1 @@
ce361847b8221b8541aea6b927006ff9be01f0be lsvpd-1.7.15.tar.gz

View File

@ -1,164 +0,0 @@
commit 1ca39cf877d0a74bc3f420205a672aea146982a5
Author: Sathvika Vasireddy <sv@linux.ibm.com>
Date: Fri Dec 23 14:19:38 2022 +0530
lsvpd: Add NVME f1h log page VPD information parsing logic in fillByBus()
This patch adds NVME f1h log page VPD information parsing logic
in fillByBus(). If bus is pci, then fill PCI device information
for this nvme device by reading and interpreting NVME f1h log
page.
Without this patch:
=====
# lscfg -vl 0185:a0:00.0
0185:a0:00.0 nvme1 pci1014,680 U78DA.ND0.WZS004R-P1-C5
3.2TB NVMe Gen4 U.2 SSD (1014a824)
Manufacturer Name.........IBM
Machine Type-Model........NVMe SSD Controller PM173X
Device Specific.(YC)......0
Location Code.(YL)........U78DA.ND0.WZS004R-P1-C5
=====
With this patch:
=====
# ./lscfg -vl 0185:a0:00.0
0185:a0:00.0 nvme1 pci1014,680 U78DA.ND0.WZS004R-P1-C5
3.2TB NVMe Gen4 U.2 SSD (1014a824)
Manufacturer Name.........IBM
Machine Type-Model........NVMe SSD Controller PM173X
Engineering Change Level..P65459
Field Replaceable Unit Number
..........................01LU968
Manufacturer ID...........S5H0NE0MC00161
Part Number of assembly...01CM529
Serial Number.............CEYD404W
Device Specific.(ID)......3.2TB NVMe Gen4 U.2 SSD
Final Assembly PN.(AN)....01LU965
Customer Card ID Number.(CC)
..........................59B9
Device Specific.(Z0)......10140680
Device Specific.(Z1)......3.0
Device Specific.(Z2)......3200
Device Specific.(Z3)......17.52
Device Specific.(Z4)......0
Device Specific.(Z5)......00
Device Specific.(Z6)......A180010C
Device Specific.(Z7)......0YA
Device Specific.(Z8)......2902
Device Specific.(Z9)......08
Device Specific.(ZA)......0008
Device Specific.(ZB)......0040
Device Specific.(ZC)......00
Device Specific.(FR)......REV.ST45
Device Specific.(YC)......0
Location Code.(YL)........U78DA.ND0.WZS004R-P1-C5
=====
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
diff --git a/src/include/sysfstreecollector.hpp b/src/include/sysfstreecollector.hpp
index e2af3ab..29f1d20 100644
--- a/src/include/sysfstreecollector.hpp
+++ b/src/include/sysfstreecollector.hpp
@@ -139,6 +139,7 @@ namespace lsvpd
void process_template(Component *fillMe, string *deviceType,
char *data, int dataSize, string *format,
int pageCode);
+ int collectNvmeVpd(Component *fillMe, int device_fd);
int collectVpd(Component *fillMe, int device_fd, bool limitSCSISize);
void fillSCSIComponent( Component* fillMe, bool limitSCSISize);
@@ -224,7 +225,6 @@ namespace lsvpd
*/
void fillUSBDev( Component* fillMe, const string& sysDir );
-
/**
* Fill a NVMe device.
*
@@ -259,6 +259,15 @@ namespace lsvpd
*/
void fillIDEDev( Component* fillMe );
+ /**
+ * Fill a NVME device by reading and interpreting f1h log page
+ * information
+ *
+ * @param fillMe
+ * The Component to fill
+ */
+ void fillPciNvmeVpd( Component* fillMe);
+
/**
* Gather PCI device specific vpd info.
*
diff --git a/src/internal/sys_interface/sysfs_SCSI_Fill.cpp b/src/internal/sys_interface/sysfs_SCSI_Fill.cpp
index b14bc3a..bdd6a30 100644
--- a/src/internal/sys_interface/sysfs_SCSI_Fill.cpp
+++ b/src/internal/sys_interface/sysfs_SCSI_Fill.cpp
@@ -1225,6 +1225,22 @@ namespace lsvpd
return ret;
}
+ int SysFSTreeCollector::collectNvmeVpd(Component *fillMe, int device_fd)
+ {
+ int rc;
+ char data[NVME_VPD_INFO_SIZE];
+
+ rc = nvme_read_vpd(device_fd, data);
+ if (rc)
+ return rc;
+
+ rc = interpretNVMEf1hLogPage(fillMe, data);
+ if (rc)
+ return rc;
+
+ return 0;
+ }
+
/********************************************************************
* @brief: High-level data collection call, using ioctl and doSGQuery
* to collect relevant data which is returned for interpretation.
diff --git a/src/internal/sys_interface/sysfstreecollector.cpp b/src/internal/sys_interface/sysfstreecollector.cpp
index 8ac0ea5..c5eb71d 100644
--- a/src/internal/sys_interface/sysfstreecollector.cpp
+++ b/src/internal/sys_interface/sysfstreecollector.cpp
@@ -1407,6 +1407,22 @@ ERROR:
return 0;
}
+ void SysFSTreeCollector::fillPciNvmeVpd( Component* fillMe )
+ {
+ int device_fd;
+ struct stat myDir;
+ string path;
+ path = fillMe->sysFsNode.getValue() + "/nvme";
+ if (stat(path.c_str(), &myDir) < 0)
+ return;
+ device_fd = device_open(fillMe);
+ if (device_fd < 0)
+ return;
+ collectNvmeVpd(fillMe, device_fd);
+ close(device_fd);
+ return;
+ }
+
/* Parse VPD file */
void SysFSTreeCollector::fillPciDevVpd( Component* fillMe )
{
@@ -1520,6 +1536,9 @@ ERROR:
/* Fill PCI device VPD info */
fillPciDevVpd(fillMe);
+ /* Fill NVME device VPD info using f1h log page */
+ fillPciNvmeVpd(fillMe);
+
// Read the pci config file for Device Specific (YC)
os.str( "" );
os << fillMe->sysFsNode.dataValue << "/config";

View File

@ -1,141 +0,0 @@
commit 50e2fa22298de13fd731488306d2cbd0081730d8
Author: Sathvika Vasireddy <sv@linux.ibm.com>
Date: Fri Feb 10 14:55:41 2023 +0530
lsvpd: Fill firmware information by recursively looking for firmware specific files within sysfs ID
Currently, fillFirmware() is filling firmware information based on the
classNode value of a given component. It then looks for firmware specific
sysfs files (fw_version, fwrev, firmware_rev), within the classNode path,
to set firmware fields accordingly. For components that do not have a
classNode value, fillFirmware() does not look for firmware information
within the sysfs firmware files, and hence does not set firmware fields.
This patch recursively looks for sysfs firmware files within the ID path of
a component, and sets the firmware fields accordingly, if not already set.
Reported-by: Borislav Stoymirski <borislav.stoymirski@bg.ibm.com>
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Tested-by: Borislav Stoymirski <borislav.stoymirski@bg.ibm.com>
diff --git a/src/include/icollector.hpp b/src/include/icollector.hpp
index 894dd99..392632f 100644
--- a/src/include/icollector.hpp
+++ b/src/include/icollector.hpp
@@ -116,6 +116,25 @@ namespace lsvpd
virtual ~ICollector( ){}
protected:
+ /** Recursively search for attrName within a given path.
+ *
+ * @param path
+ * Directory path to search for filename.
+ *
+ * @param attrName
+ * Filename to search for.
+ *
+ * @return
+ * Path in which attrName file exists.
+ *
+ * If attrName is fwrev, and is found at
+ * /sys/devices/pci0020:01/0020:01:00.1/host4/scsi_host/host4/fwrev,
+ * searchFile() will return
+ * /sys/devices/pci0020:01/0020:01:00.1/host4/scsi_host/host4.
+ */
+ string searchFile( const string& path,
+ const string& attrName );
+
string getAttrValue( const string& path,
const string& attrName );
diff --git a/src/internal/sys_interface/icollector.cpp b/src/internal/sys_interface/icollector.cpp
index 5c4dccc..7586fe8 100644
--- a/src/internal/sys_interface/icollector.cpp
+++ b/src/internal/sys_interface/icollector.cpp
@@ -32,11 +32,46 @@
#include <fstream>
#include <cstring>
#include <bitset>
+#include <iostream>
+#include <dirent.h>
+#include <string.h>
using namespace std;
namespace lsvpd
{
+
+ string ICollector::searchFile( const string& path, const string& attrName )
+ {
+ DIR *dir;
+ struct dirent *entry;
+
+ if ((dir = opendir(path.c_str())) == NULL)
+ return "";
+
+ while ((entry = readdir(dir)) != NULL) {
+ if (entry->d_type == DT_DIR) {
+ // Found a directory, but ignore . and ..
+ if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
+ continue;
+ string newPath = path + "/" + entry->d_name;
+ string result = searchFile(newPath, attrName);
+ if (result != "") {
+ closedir(dir);
+ return result;
+ }
+ }
+ else {
+ if (entry->d_name == attrName) {
+ closedir(dir);
+ return path;
+ }
+ }
+ }
+ closedir(dir);
+ return "";
+ }
+
/**
* Read a device attribute, given dev path and attribute name
* @var path Full path to device in sysfs
diff --git a/src/internal/sys_interface/sysfstreecollector.cpp b/src/internal/sys_interface/sysfstreecollector.cpp
index c5eb71d..03eb7da 100644
--- a/src/internal/sys_interface/sysfstreecollector.cpp
+++ b/src/internal/sys_interface/sysfstreecollector.cpp
@@ -1837,6 +1837,10 @@ ERROR:
void SysFSTreeCollector::fillFirmware( Component* fillMe )
{
+ string result = "";
+ string path = fillMe->getID();
+ const string firmwareAttributes[] = {"fw_version", "firmware_rev"};
+ const size_t firmwareAttributesSize = sizeof(firmwareAttributes) / sizeof(firmwareAttributes[0]);
string classNode = fillMe->getClassNode();
if (classNode.length() > 0) {
fillMe->mFirmwareVersion.setValue( getAttrValue( classNode,
@@ -1848,6 +1852,23 @@ ERROR:
fillMe->mFirmwareVersion.setValue( getAttrValue( classNode,
"firmware_rev" ), 30, __FILE__, __LINE__ );
}
+
+ if (fillMe->mFirmwareLevel.dataValue.empty()) {
+ result = searchFile(path, "fwrev");
+ if (!result.empty()) {
+ fillMe->mFirmwareLevel.setValue( getAttrValue( result,
+ "fwrev" ), 30, __FILE__, __LINE__ );
+ }
+ }
+
+ for (size_t i = 0; i < firmwareAttributesSize && fillMe->mFirmwareVersion.dataValue.empty(); i++) {
+ result = searchFile(path, firmwareAttributes[i]);
+ if (!result.empty()) {
+ fillMe->mFirmwareVersion.setValue( getAttrValue( result,
+ firmwareAttributes[i]), 30, __FILE__, __LINE__ );
+ break;
+ }
+ }
}
string SysFSTreeCollector::resolveClassPath( const string& path )

View File

@ -1,21 +0,0 @@
commit 6ff86f3e6885e24b6eca2f42d6b02da5cead32e5
Author: Sathvika Vasireddy <sv@linux.ibm.com>
Date: Fri Dec 23 14:19:53 2022 +0530
lsvpd: Update nvme_template with logpage format for 0003 and 0004 versions
This patch adds nvme templates for f1h log page versions
0003 and 0004.
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
diff --git a/nvme_templates.conf b/nvme_templates.conf
index a85e95e..269c0af 100644
--- a/nvme_templates.conf
+++ b/nvme_templates.conf
@@ -1,2 +1,4 @@
"0001", "_:4,ID:40,PN:12,EC:10,FN:12,AN:12,FC:4,CC:4,SN:8,Z0:8,Z1:4,Z2:10,Z3:12,Z4:1,Z5:2,Z6:8,Z7:3,Z8:5,Z9:2,ZA:4,ZB:4,ZC:2,MN:20,FR:8"
"0002", "_:4,ID:40,PN:12,EC:10,FN:12,AN:12,FC:4,CC:4,SN:8,Z0:8,Z1:4,Z2:10,Z3:12,Z4:1,Z5:2,Z6:8,Z7:3,Z8:5,Z9:2,ZA:4,ZB:4,ZC:2,MN:20,RM:8"
+"0003", "_:4,ID:40,PN:12,EC:10,FN:12,AN:12,FC:4,CC:4,SN:8,Z0:8,Z1:4,Z2:10,Z3:12,Z4:1,Z5:2,Z6:8,Z7:3,Z8:5,Z9:2,ZA:4,ZB:4,ZC:2,MN:20,RM:8"
+"0004", "_:4,ID:40,PN:12,EC:10,FN:12,AN:12,FC:4,CC:4,SN:8,Z0:8,Z1:4,Z2:10,Z3:12,Z4:1,Z5:2,Z6:8,Z7:3,Z8:5,Z9:2,ZA:4,ZB:4,ZC:2,MN:20,RM:8"

View File

@ -1,76 +0,0 @@
commit 8b5d2cfb7d1a6731e72198e7c71fa5bfad1ff0ec
Author: Sathvika Vasireddy <sv@linux.ibm.com>
Date: Wed Mar 29 12:10:36 2023 +0530
lsvpd: Update nvme_templates with logpage format for 0005 and 0006 versions
To collect nvme vpd data and set vpd fields accordingly, we interpret nvme
f1h logpage. Currently, there is support to interpret NVMe logpage versions
till 0004. NVMe devices with Alterable ROM Level REV.SN66 have f1h logpage
versions of 0005 and above. Since there is no support for 0005 and above
versions of nvme f1h logpage in the code yet, code returns without
interpreting logpage information, and hence nvme vpd data for such devices
are not being set and displayed completely. To address this issue, add nvme
template for f1h logpage versions 0005 and 0006.
Starting with Version 0005, a new value was added to Encryption field
(2 = BootROM support). And, starting with Version 0006, two new fields
(Reserved for Future DS8K Usage and DLFEAT PI Deviation Support) were added
to f1h logpage.
Before this patch:
$ lscfg -vl 05ed:70:00.0
05ed:70:00.0 nvme0 pci1014,6bc U50EE.001.WZS005P-P3-C13
1.6TB NVMe Gen4 II U.2 SSD (1014a825)
Manufacturer Name.........IBM
Machine Type-Model........NVMe SSD Controller PM173Xa
Alterable ROM Level.......REV.SN66
Device Specific.(YC)......0
Location Code.(YL)........U50EE.001.WZS005P-P3-C13
After this patch:
$ lscfg -vl 05ed:70:00.0
05ed:70:00.0 nvme0 pci1014,6bc U50EE.001.WZS005P-P3-C13
1.6TB NVMe Gen4 II U.2 SSD (1014a825)
Manufacturer Name.........IBM
Machine Type-Model........NVMe SSD Controller PM173Xa
Engineering Change Level..P65460
Field Replaceable Unit Number
..........................02YC725
Manufacturer ID...........S6RUNE0T901384
Part Number of assembly...01CM549
Serial Number.............ANYH60HA
Alterable ROM Level.......REV.SN66
Device Specific.(ID)......1.6TB NVMe Gen4 U.2 SSD III
Final Assembly PN.(AN)....02YC721
Customer Card ID Number.(CC)
..........................5B52
Device Specific.(Z0)......101406BC
Device Specific.(Z1)......3.0
Device Specific.(Z2)......1600
Device Specific.(Z3)......8.76
Device Specific.(Z4)......2
Device Specific.(Z5)......02
Device Specific.(Z6)......A1800114
Device Specific.(Z7)......0YA
Device Specific.(Z8)......2901
Device Specific.(Z9)......08
Device Specific.(ZA)......0008
Device Specific.(ZB)......0040
Device Specific.(ZC)......00
Device Specific.(YC)......0
Location Code.(YL)........U50EE.001.WZS005P-P3-C13
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
diff --git a/nvme_templates.conf b/nvme_templates.conf
index 269c0af..473734d 100644
--- a/nvme_templates.conf
+++ b/nvme_templates.conf
@@ -2,3 +2,5 @@
"0002", "_:4,ID:40,PN:12,EC:10,FN:12,AN:12,FC:4,CC:4,SN:8,Z0:8,Z1:4,Z2:10,Z3:12,Z4:1,Z5:2,Z6:8,Z7:3,Z8:5,Z9:2,ZA:4,ZB:4,ZC:2,MN:20,RM:8"
"0003", "_:4,ID:40,PN:12,EC:10,FN:12,AN:12,FC:4,CC:4,SN:8,Z0:8,Z1:4,Z2:10,Z3:12,Z4:1,Z5:2,Z6:8,Z7:3,Z8:5,Z9:2,ZA:4,ZB:4,ZC:2,MN:20,RM:8"
"0004", "_:4,ID:40,PN:12,EC:10,FN:12,AN:12,FC:4,CC:4,SN:8,Z0:8,Z1:4,Z2:10,Z3:12,Z4:1,Z5:2,Z6:8,Z7:3,Z8:5,Z9:2,ZA:4,ZB:4,ZC:2,MN:20,RM:8"
+"0005", "_:4,ID:40,PN:12,EC:10,FN:12,AN:12,FC:4,CC:4,SN:8,Z0:8,Z1:4,Z2:10,Z3:12,Z4:1,Z5:2,Z6:8,Z7:3,Z8:5,Z9:2,ZA:4,ZB:4,ZC:2,MN:20,RM:8"
+"0006", "_:4,ID:40,PN:12,EC:10,FN:12,AN:12,FC:4,CC:4,SN:8,Z0:8,Z1:4,Z2:10,Z3:12,Z4:1,Z5:2,Z6:8,Z7:3,Z8:5,Z9:2,ZA:4,ZB:4,ZC:2,MN:20,RM:8"

View File

@ -1,20 +1,12 @@
%define name lsvpd
%define version 1.7.14
Name: lsvpd
Version: 1.7.14
Release: 4%{?dist}
Version: 1.7.15
Release: 1%{?dist}
Summary: VPD/hardware inventory utilities for Linux
License: GPLv2+
URL: https://github.com/power-ras/%{name}/releases
Source: https://github.com/power-ras/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0: lsvpd-git1ca39c.patch
Patch1: lsvpd-git6ff86f.patch
Patch2: lsvpd-git50e2fa.patch
Patch3: lsvpd-git8b5d2c.patch
BuildRequires: gcc-c++
BuildRequires: libvpd-devel >= 2.2.9
BuildRequires: sg3_utils-devel
@ -43,14 +35,13 @@ on POWER PC based systems.
%autosetup -p1
%build
export CXXFLAGS="-std=c++14 $RPM_OPT_FLAGS"
./bootstrap.sh
%configure
make %{?_smp_mflags}
%make_build
%install
make install DESTDIR=$RPM_BUILD_ROOT
%make_install
%post
%{_sbindir}/vpdupdate &
@ -77,6 +68,9 @@ exit 0
%dir %{_sysconfdir}/lsvpd
%changelog
* Fri Dec 08 2023 Than Ngo <than@redhat.com> - 1.7.15-1
- Resolves: RRHEL-11475, update to 1.7.15
* Tue Apr 11 2023 Than Ngo <than@redhat.com> - 1.7.14-4
- Related: #2181241, backport upstream patch to update update nvme_templates
with logpage format for 0005 and 0006 versions

View File

@ -1 +1 @@
SHA512 (lsvpd-1.7.14.tar.gz) = f9c507db1e5e16adeccf50ce94a0bb891e4907724ed36da88fa94cdca11436124dc6615b3c9287a1a26ee1beb51a0d3c203c58b15e7bcf9a4338087ae4ff8018
SHA512 (lsvpd-1.7.15.tar.gz) = 5e70bf52fec7b7c6ede3dca2a0def9fa10ba36c4421a8b875928c7eb4036c24ad828d8381f233896aed36b8fdc014a38b05b000d883dc23d209f7bbd2b781305