pkgdep/git: Check kallsyms to see if QAT needs to be patched

It seems that some of the kernel patches from 5.x were backported
to centos8's 4.18 kernel. This requires 0001-pci_aer.patch to be
applied on the QAT source. To determine if it's needed, check list
of exported kernel symbols to see if said patch is needed since
relying on version check is not enough in this case.

Change-Id: I9fb24480058817ef9f4dd246eff234a95ce65137
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5484
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
This commit is contained in:
Michal Berger 2020-12-08 15:10:08 +01:00 committed by Tomasz Zawadzki
parent 3edb26fb0e
commit 0146f2eeaa

View File

@ -108,6 +108,19 @@ function install_qat() {
local kernel_maj kernel_min kernel_rel kernel_loc local kernel_maj kernel_min kernel_rel kernel_loc
local kernel_ver local kernel_ver
in_syms() {
local syms
if [[ -e /proc/kallsyms ]]; then
syms=/proc/kallsyms
elif [[ -e /boot/System.map-$(< /proc/sys/kernel/osrelease) ]]; then
syms=/boot/System.map-$(< /proc/sys/kernel/osrelease)
else
return 0
fi
grep -q "$1" "$syms"
}
IFS=".-" read -r kernel_{maj,min,rel,loc} < /proc/sys/kernel/osrelease IFS=".-" read -r kernel_{maj,min,rel,loc} < /proc/sys/kernel/osrelease
kernel_ver=$((kernel_maj << 16 | kernel_min << 8 | kernel_rel)) kernel_ver=$((kernel_maj << 16 | kernel_min << 8 | kernel_rel))
@ -129,7 +142,7 @@ function install_qat() {
fi < "$rootdir/test/common/config/pkgdep/patches/qat/0001-timespec.patch" fi < "$rootdir/test/common/config/pkgdep/patches/qat/0001-timespec.patch"
# Patch name of the pci_aer function which was renamed in kernels >= 5.7.1. See .patch for details # Patch name of the pci_aer function which was renamed in kernels >= 5.7.1. See .patch for details
if ((kernel_ver >= 0x050701)); then if ((kernel_ver >= 0x050701)) || ! in_syms pci_cleanup_aer_uncorrect_error_status; then
# Patch only the driver version that was tested # Patch only the driver version that was tested
[[ ${DRIVER_LOCATION_QAT##*/} == qat1.7.l.4.9.0-00008.tar.gz ]] && patch --dir="$GIT_REPOS/QAT" -p1 [[ ${DRIVER_LOCATION_QAT##*/} == qat1.7.l.4.9.0-00008.tar.gz ]] && patch --dir="$GIT_REPOS/QAT" -p1
fi < "$rootdir/test/common/config/pkgdep/patches/qat/0001-pci_aer.patch" fi < "$rootdir/test/common/config/pkgdep/patches/qat/0001-pci_aer.patch"