From f0337a9db8702a9a8b4fdb58e70b28d03965da95 Mon Sep 17 00:00:00 2001 From: Vladis Dronov Date: Thu, 24 Mar 2022 12:25:40 +0100 Subject: [PATCH] Fix small issues in qatlib-tests package And update documentation from the upstream --- ...guidance-for-kernel-to-use-for-compr.patch | 39 ++++++++++++ ...INSTALL-doc-with-firmware-load-issue.patch | 45 ++++++++++++++ 0003-Update-README.md.patch | 32 ++++++++++ 0004-Fix-hash_file_sample-return-code.patch | 44 +++++++++++++ ...h_file_sample-to-hash-its-own-binary.patch | 62 +++++++++++++++++++ qatlib.spec | 15 ++++- 6 files changed, 235 insertions(+), 2 deletions(-) create mode 100644 0001-Fix-INSTALL-doc-guidance-for-kernel-to-use-for-compr.patch create mode 100644 0002-Update-INSTALL-doc-with-firmware-load-issue.patch create mode 100644 0003-Update-README.md.patch create mode 100644 0004-Fix-hash_file_sample-return-code.patch create mode 100644 0005-Make-hash_file_sample-to-hash-its-own-binary.patch diff --git a/0001-Fix-INSTALL-doc-guidance-for-kernel-to-use-for-compr.patch b/0001-Fix-INSTALL-doc-guidance-for-kernel-to-use-for-compr.patch new file mode 100644 index 0000000..d63696c --- /dev/null +++ b/0001-Fix-INSTALL-doc-guidance-for-kernel-to-use-for-compr.patch @@ -0,0 +1,39 @@ +From 34de92337923a15ed46b064f53dc520d2a46a12c Mon Sep 17 00:00:00 2001 +From: Fiona Trahe +Date: Thu, 24 Feb 2022 05:34:37 -0500 +Subject: [PATCH 1/3] Fix INSTALL doc guidance for kernel to use for + compression + +Previously specified 5.16+, actually at least 5.17 is needed. + +Signed-off-by: Fiona Trahe +Signed-off-by: Vladis Dronov +--- + INSTALL | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/INSTALL b/INSTALL +index b76d88c..1f8c3f5 100644 +--- a/INSTALL ++++ b/INSTALL +@@ -76,7 +76,7 @@ Check System Prerequisites + intel_qat + qat_4xxx + They should load by default if using any of the following: +- * Linux kernel v5.11+ (This is for crypto, for compression use v5.16+) ++ * Linux kernel v5.11+ (This is for crypto, for compression use v5.17+) + * Fedora 34+ (for compression use 36+) + * RHEL 8.4+ (for compression use 9.0+) + * BIOS settings +@@ -438,7 +438,7 @@ Common issues + + Issue: "DC Instances are not present" error when trying to run + compression operations, e.g. using "cpa_sample_code runTests=32" +- Likely cause: QAT driver in Linux kernel before v5.16 doesn't support ++ Likely cause: QAT driver in Linux kernel before v5.17 doesn't support + compression service. Upgrade to a later kernel. + + Issue: "Could not open corpus file: /usr/local/share/qat/calgary" +-- +2.35.1 + diff --git a/0002-Update-INSTALL-doc-with-firmware-load-issue.patch b/0002-Update-INSTALL-doc-with-firmware-load-issue.patch new file mode 100644 index 0000000..d788c41 --- /dev/null +++ b/0002-Update-INSTALL-doc-with-firmware-load-issue.patch @@ -0,0 +1,45 @@ +From 6b79a27e130f3be0fc2603637fa8923bf384f2e1 Mon Sep 17 00:00:00 2001 +From: Fiona Trahe +Date: Thu, 24 Feb 2022 11:26:59 -0500 +Subject: [PATCH 2/3] Update INSTALL doc with firmware load issue + +Update INSTALL doc with info about failed firmware load +issue and likely cause. + +Signed-off-by: Fiona Trahe +Signed-off-by: Vladis Dronov +--- + INSTALL | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/INSTALL b/INSTALL +index 1f8c3f5..9ab5d98 100644 +--- a/INSTALL ++++ b/INSTALL +@@ -455,6 +455,23 @@ Common issues + After updating re-login so the changes take effect: + sudo su -l $USER + ++ Issue: error on make install ++ "Job for qat.service failed because the control process exited with ++ error code" ++ System logs (dmesg) show QAT kernel module failed with error like: ++ "4xxx 0000:6b:00.0: enabling device (0140 -> 0142) ++ QAT: authentication error (FCU_STATUS = 0x3),retry = 0 ++ 4xxx 0000:6b:00.0: Failed to load MMP ++ 4xxx 0000:6b:00.0: Failed to load acceleration FW ++ 4xxx 0000:6b:00.0: Resetting device qat_dev0 ++ 4xxx: probe of 0000:6b:00.0 failed with error -14" ++ Likely cause: firmware files not present in initramfs on module loading ++ early in boot process. ++ Fix: First make sure you have the firmware installed in /lib/firmware, ++ see pre-requisites section above. Then workaround with ++ "sudo rmmod qat_4xxx; sudo modprobe qat_4xxx; sudo systemctl start qat" ++ or fix for future reboots with "dracut --force" followed by a reboot. ++ + =============================================================================== + + +-- +2.35.1 + diff --git a/0003-Update-README.md.patch b/0003-Update-README.md.patch new file mode 100644 index 0000000..30b2128 --- /dev/null +++ b/0003-Update-README.md.patch @@ -0,0 +1,32 @@ +From 9ab0ce1230bd500fa1abd21e72b289e034b30be4 Mon Sep 17 00:00:00 2001 +From: Patrick Patricelli +Date: Thu, 24 Feb 2022 13:59:46 -0500 +Subject: [PATCH 3/3] Update README.md + +Update README.md to point to INSTALL file for details about the kernel +versions supported. + +Signed-off-by: Patrick Patricelli +Signed-off-by: Vladis Dronov +--- + README.md | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/README.md b/README.md +index be9b19b..5b1505b 100644 +--- a/README.md ++++ b/README.md +@@ -108,8 +108,8 @@ The following assumptions are made concerning the deployment environment: + memory regions. + * A QuickAssist kernel driver for the supported device is installed, which has + discovered and initialised the device, exposing the VFs. This driver is +- included in the Linux kernel from v5.11 though v5.16 and is necessary for +- compression services. ++ included in the Linux kernel, see [INSTALL](INSTALL) for information about which kernel ++ to use. + * The library can be used by unprivileged users if that user is included in + the 'qat' group. + +-- +2.35.1 + diff --git a/0004-Fix-hash_file_sample-return-code.patch b/0004-Fix-hash_file_sample-return-code.patch new file mode 100644 index 0000000..f94fbb2 --- /dev/null +++ b/0004-Fix-hash_file_sample-return-code.patch @@ -0,0 +1,44 @@ +From d9540ad27d5b53ff1ea9f728c47e4acf1480ec49 Mon Sep 17 00:00:00 2001 +From: Vladis Dronov +Date: Tue, 22 Mar 2022 16:56:29 +0100 +Subject: [PATCH] Fix hash_file_sample return code + +So it does not return zero exit status unconditionally. + +Signed-off-by: Vladis Dronov +--- + .../sym/hash_file_sample/cpa_hash_file_sample_user.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/quickassist/lookaside/access_layer/src/sample_code/functional/sym/hash_file_sample/cpa_hash_file_sample_user.c b/quickassist/lookaside/access_layer/src/sample_code/functional/sym/hash_file_sample/cpa_hash_file_sample_user.c +index c9a8c5e..758d7bd 100644 +--- a/quickassist/lookaside/access_layer/src/sample_code/functional/sym/hash_file_sample/cpa_hash_file_sample_user.c ++++ b/quickassist/lookaside/access_layer/src/sample_code/functional/sym/hash_file_sample/cpa_hash_file_sample_user.c +@@ -92,7 +92,7 @@ int main(int argc, const char **argv) + if (CPA_STATUS_SUCCESS != stat) + { + PRINT_ERR("Failed to initialize memory driver\n"); +- return 0; ++ return (int)stat; + } + + stat = icp_sal_userStartMultiProcess("SSL", CPA_FALSE); +@@ -100,7 +100,7 @@ int main(int argc, const char **argv) + { + PRINT_ERR("Failed to start user process SSL\n"); + qaeMemDestroy(); +- return 0; ++ return (int)stat; + } + gFileName = fileToHash; + +@@ -118,5 +118,5 @@ int main(int argc, const char **argv) + qaeMemDestroy(); + gFileName = NULL; + +- return 0; ++ return (int)stat; + } +-- +2.35.1 + diff --git a/0005-Make-hash_file_sample-to-hash-its-own-binary.patch b/0005-Make-hash_file_sample-to-hash-its-own-binary.patch new file mode 100644 index 0000000..9f7ebdd --- /dev/null +++ b/0005-Make-hash_file_sample-to-hash-its-own-binary.patch @@ -0,0 +1,62 @@ +From e94a964a9c167e917496e63b5e379c327dd9b93f Mon Sep 17 00:00:00 2001 +From: Vladis Dronov +Date: Tue, 22 Mar 2022 17:24:27 +0100 +Subject: [PATCH] Make hash_file_sample to hash its own binary + +Signed-off-by: Vladis Dronov +--- + .../hash_file_sample/cpa_hash_file_sample_user.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/quickassist/lookaside/access_layer/src/sample_code/functional/sym/hash_file_sample/cpa_hash_file_sample_user.c b/quickassist/lookaside/access_layer/src/sample_code/functional/sym/hash_file_sample/cpa_hash_file_sample_user.c +index 758d7bd..38e0650 100644 +--- a/quickassist/lookaside/access_layer/src/sample_code/functional/sym/hash_file_sample/cpa_hash_file_sample_user.c ++++ b/quickassist/lookaside/access_layer/src/sample_code/functional/sym/hash_file_sample/cpa_hash_file_sample_user.c +@@ -65,10 +65,12 @@ + * @file cpa_hash_file_sample_user.c + * + *****************************************************************************/ ++#include ++#include ++ + #include "cpa_sample_utils.h" + #include "icp_sal_user.h" + +-#define FILE_NAME_LENGTH 100 + char *gFileName = NULL; + + extern CpaStatus hashFileSample(void); +@@ -78,7 +80,7 @@ int gDebugParam = 1; + int main(int argc, const char **argv) + { + CpaStatus stat = CPA_STATUS_SUCCESS; +- char fileToHash[FILE_NAME_LENGTH] = "hash_file_sample"; ++ char fileToHash[PATH_MAX] = { 0 }; + + /* Read in debug setting if present */ + if (argc > 1) +@@ -88,6 +90,13 @@ int main(int argc, const char **argv) + + PRINT_DBG("Starting Hash File Sample Code App ...\n"); + ++ if (0 > readlink("/proc/self/exe", fileToHash, sizeof(fileToHash))) ++ { ++ PRINT_ERR("Failed to get path to a binary of self\n"); ++ return 1; ++ } ++ gFileName = fileToHash; ++ + stat = qaeMemInit(); + if (CPA_STATUS_SUCCESS != stat) + { +@@ -102,7 +111,6 @@ int main(int argc, const char **argv) + qaeMemDestroy(); + return (int)stat; + } +- gFileName = fileToHash; + + stat = hashFileSample(); + if (CPA_STATUS_SUCCESS != stat) +-- +2.35.1 + diff --git a/qatlib.spec b/qatlib.spec index d27120a..065ef9f 100644 --- a/qatlib.spec +++ b/qatlib.spec @@ -4,7 +4,7 @@ %global libusdm_soversion 0 Name: qatlib Version: 21.11.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Intel QuickAssist user space library # The entire source code is released under BSD. # For a breakdown of inbound licenses see the INSTALL file. @@ -18,6 +18,12 @@ ExcludeArch: %{arm} aarch64 %{power64} s390x i686 %{?systemd_requires} +Patch0: 0001-Fix-INSTALL-doc-guidance-for-kernel-to-use-for-compr.patch +Patch1: 0002-Update-INSTALL-doc-with-firmware-load-issue.patch +Patch2: 0003-Update-README.md.patch +Patch3: 0004-Fix-hash_file_sample-return-code.patch +Patch4: 0005-Make-hash_file_sample-to-hash-its-own-binary.patch + %description Intel QuickAssist Technology (Intel QAT) provides hardware acceleration for offloading security, authentication and compression services from the @@ -47,7 +53,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release} This package contains sample applications that use the Intel QuickAssists APIs. %prep -%autosetup +%autosetup -p1 %build autoreconf -vif @@ -93,6 +99,7 @@ exit 0 %{_includedir}/qat %files tests +%doc quickassist/lookaside/access_layer/src/sample_code/README.txt %attr(0754,-,qat) %{_bindir}/cpa_sample_code %attr(0754,-,qat) %{_bindir}/dc_dp_sample %attr(0754,-,qat) %{_bindir}/dc_stateless_sample @@ -116,6 +123,10 @@ exit 0 %{_datadir}/qat/canterbury %changelog +* Tue Mar 22 2022 Vladis Dronov - 21.11.0-3 +- Fix small issues in qatlib-tests package +- Update documentation from the upstream + * Fri Jan 21 2022 Fedora Release Engineering - 21.11.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild