diff --git a/1000-bugfix-support-5.10.patch b/1000-bugfix-support-5.10.patch index 2680b816d9759f82d17de078d3d5c0e7c0e08eed..f10dec65b8cecd7cf995ee33e0a0c6f7977c7de1 100644 --- a/1000-bugfix-support-5.10.patch +++ b/1000-bugfix-support-5.10.patch @@ -1,13 +1,8 @@ -From 426abd9b6b28f262333c38bf13255d850054d5b1 Mon Sep 17 00:00:00 2001 -From: Jiayu Ni -Date: Wed, 17 Aug 2022 14:50:26 +0800 -Subject: [PATCH] modify to 5.10 +commit 6d3281629dd2d2eb46a4e88964e79fd1fccfedc5 +Author: Jiayu Ni +Date: Mon Oct 10 09:14:12 2022 +0800 ---- - quickassist/qat/drivers/crypto/qat/Makefile | 8 +++---- - .../crypto/qat/qat_common/adf_vdcm_adi.c | 10 ++++---- - .../crypto/qat/qat_common/adf_vdcm_core.c | 24 +++++++++---------- - 3 files changed, 20 insertions(+), 22 deletions(-) + Support 5.10 diff --git a/quickassist/qat/drivers/crypto/qat/Makefile b/quickassist/qat/drivers/crypto/qat/Makefile index e7280d8..5312e72 100644 @@ -29,7 +24,7 @@ index e7280d8..5312e72 100644 obj-$(CONFIG_CRYPTO_DEV_QAT) += qat_common/ obj-$(CONFIG_CRYPTO_DEV_QAT_DH895xCC) += qat_dh895xcc/ diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/adf_vdcm_adi.c b/quickassist/qat/drivers/crypto/qat/qat_common/adf_vdcm_adi.c -index 1315682..8fb495a 100644 +index 1315682..2173eb0 100644 --- a/quickassist/qat/drivers/crypto/qat/qat_common/adf_vdcm_adi.c +++ b/quickassist/qat/drivers/crypto/qat/qat_common/adf_vdcm_adi.c @@ -15,7 +15,7 @@ @@ -59,16 +54,21 @@ index 1315682..8fb495a 100644 static int adf_vqat_get_pasid(struct adf_vdcm_vqat *vqat) { struct vfio_group *vfio_group; -@@ -541,7 +541,7 @@ static inline int adf_vqat_setup_iommu(struct adf_vdcm_vqat *vqat) - "%s : SIOV is not supported with this kernel\n", __func__); - return -EINVAL; - +@@ -536,12 +536,7 @@ static inline int adf_vqat_setup_iommu(struct adf_vdcm_vqat *vqat) + return -EINVAL; + } + /* Set mdev iommu device */ +-#if KERNEL_VERSION(5, 16, 0) <= LINUX_VERSION_CODE +- dev_err(mdev_dev(vqat->mdev), +- "%s : SIOV is not supported with this kernel\n", __func__); +- return -EINVAL; +- -#elif KERNEL_VERSION(5, 13, 0) <= LINUX_VERSION_CODE -+#elif KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE mdev_set_iommu_device(vqat->mdev, &GET_DEV(vqat->parent)); return 0; -@@ -1000,7 +1000,7 @@ static void adf_vdcm_adi_vqat_release(struct adf_vdcm_vqat *vqat) +@@ -1000,7 +995,7 @@ static void adf_vdcm_adi_vqat_release(struct adf_vdcm_vqat *vqat) { dev_info(mdev_dev(vqat->mdev), "Release vqat %p\n", vqat); adf_vqat_release_irqs(vqat); @@ -188,6 +188,3 @@ index 616df63..5dc63ee 100644 static struct adf_vdcm_vqat_type *adf_vdcm_lookup_vqat_type(struct device *dev, struct mdev_type *mtype) { --- -2.27.0 - diff --git a/kmod-intel-QAT20-L.0.9.4-00004.tar.gz b/kmod-intel-QAT20-L.0.9.4-00004.tar.gz index d4b7f693962377b901115cfa24a78ef8abf0e1a1..d4d87e3f2375fa9beb01a0afa2787d1ddefefdb1 100644 Binary files a/kmod-intel-QAT20-L.0.9.4-00004.tar.gz and b/kmod-intel-QAT20-L.0.9.4-00004.tar.gz differ diff --git a/kmod-intel-QAT20.spec b/kmod-intel-QAT20.spec index b53436505933f36a0b0e4ec8ab02bfc31dc053ca..927291efe25766617ad6a6129b9f1d7417491f1b 100644 --- a/kmod-intel-QAT20.spec +++ b/kmod-intel-QAT20.spec @@ -1,36 +1,41 @@ -%define anolis_release 1 +%define anolis_release 2 %define debug_package %{nil} -%global kernel_version %(rpm -qa kernel-devel | sed -e 's/kernel-devel-//g') +%global kernel_version %(rpm -qa kernel-devel | sed -e 's/kernel-devel-//g') %define QAT_release 00004 -Summary: QAT package +Summary: QAT package(Library and sample application) Name: kmod-intel-QAT20 Version: L.0.9.4 Release: %{QAT_release}.%{anolis_release}%{dist} Group: QAT/Base License: BSD and (BSD or GPLv2) Source: %{name}-%{version}-%{QAT_release}.tar.gz - Patch1000: 1000-bugfix-support-5.10.patch -Provides: qat -Provides: libusdm_drv_s.so -Provides: libqat_s.so -BuildRequires: gcc gcc-c++ make systemd-devel openssl-devel zlib-devel yasm pciutils -BuildRequires: readline-devel libxml2-devel boost-devel elfutils-libelf-devel python3 -BuildRequires: libnl3-devel zlib + +BuildRequires: gcc gcc-c++ make systemd-devel openssl-devel zlib-devel yasm BuildRequires: libudev-devel >= 1.47 BuildRequires: kernel-devel >= 5.10.112 BuildRequires: kernel-core >= 5.10.112 -BuildArch: x86_64 +BuildRequires: boost-devel +Requires: %{name}-driver = %{version}-%{release} +ExclusiveArch: x86_64 %description -"Intel(R) QuickAssist Technology Driver for Linux version %{version}" +Intel(R) QuickAssist Technology user space library and sample application Linux +version %{version} + +%package driver +Summary: kernel driver modules + +%description driver +Intel(R) QuickAssist Technology Driver for Linux version %{version} %prep %setup -c %{name}-%{version} -q %patch1000 -p1 %build +unset ICP_ROOT ICP_ARCH_USER ICP_BUILDSYSTEM_PATH ICP_BUILD_OUTPUT ICP_ENV_DIR ICP_TOOLS_TARGET %configure %make_build %make_build samples @@ -42,8 +47,8 @@ groupadd -f qat rm -rf %{buildroot} mkdir -p %{buildroot}/etc/init.d mkdir -p %{buildroot}/etc/udev/rules.d -mkdir -p %{buildroot}/usr/lib64 -mkdir -p %{buildroot}/usr/sbin +mkdir -p %{buildroot}/%{_libdir} +mkdir -p %{buildroot}%{_sbindir} mkdir -p %{buildroot}/usr/bin/QAT mkdir -p %{buildroot}/usr/bin/QAT/build mkdir -p %{buildroot}/lib/firmware @@ -57,12 +62,12 @@ mkdir -p ${DSTMODDIR}/qat_4xxx/ mkdir -p ${DSTMODDIR}/qat_4xxxvf/ mkdir -p ${DSTMODDIR}/qat_vqat/ /usr/bin/install -D -m 750 quickassist/build_system/build_files/qat_service %{buildroot}/etc/init.d -/usr/bin/install -D -m 750 quickassist/build_system/build_files/qat.service %{buildroot}//usr/bin/QAT/build -/usr/bin/install -D -m 750 build/adf_ctl %{buildroot}/usr/sbin -/usr/bin/install -D -m 750 build/vqat_ctl %{buildroot}/usr/sbin +/usr/bin/install -D -m 664 quickassist/build_system/build_files/qat.service %{buildroot}//usr/bin/QAT/build +/usr/bin/install -D -m 750 build/adf_ctl %{buildroot}%{_sbindir} +/usr/bin/install -D -m 750 build/vqat_ctl %{buildroot}%{_sbindir} /usr/bin/install -D -m 755 build/cpa_sample_code %{buildroot}/usr/bin -/usr/bin/install -D -m 755 build/libusdm_drv_s.so %{buildroot}/usr/lib64 -/usr/bin/install -D -m 755 build/libqat_s.so %{buildroot}/usr/lib64 +/usr/bin/install -D -m 755 build/libusdm_drv_s.so %{buildroot}/%{_libdir} +/usr/bin/install -D -m 755 build/libqat_s.so %{buildroot}/%{_libdir} /usr/bin/install -D -m 750 build/qat_4xxx.bin %{buildroot}/lib/firmware /usr/bin/install -D -m 750 build/qat_4xxx_mmp.bin %{buildroot}/lib/firmware @@ -80,7 +85,6 @@ mkdir -p ${DSTMODDIR}/qat_vqat/ /usr/bin/install -D -m 750 ${SRCMODDIR}/qat_4xxx/qat_4xxx.ko ${DSTMODDIR}/qat_4xxx/qat_4xxx.ko /usr/bin/install -D -m 750 ${SRCMODDIR}/qat_4xxxvf/qat_4xxxvf.ko ${DSTMODDIR}/qat_4xxxvf/qat_4xxxvf.ko /usr/bin/install -D -m 750 ${SRCMODDIR}/qat_vqat/qat_vqat.ko ${DSTMODDIR}/qat_vqat/qat_vqat.ko -#/var/tmp/intel/QAT/install_qat.sh install_files %clean rm -rf $RPM_BUILD_ROOT @@ -89,21 +93,16 @@ rm -rf $RPM_BUILD_ROOT %files /etc/init.d/qat_service -/usr/sbin/adf_ctl -/usr/sbin/vqat_ctl +%{_sbindir}/adf_ctl +%{_sbindir}/vqat_ctl /usr/bin/cpa_sample_code -/usr/bin/QAT/config_vqat.sh -/usr/bin/QAT/generate_conf_files.sh -/usr/bin/QAT/build/qat.service -/usr/bin/QAT/build/4xxx_template.conf -/usr/bin/QAT/build/4xxxvf_dev0.conf.vm -/usr/bin/QAT/build/vqat-adi_dev0.conf.sym -/usr/bin/QAT/build/vqat-adi_dev0.conf.asym -/usr/bin/QAT/build/vqat-adi_dev0.conf.dc -/usr/lib64/libusdm_drv_s.so -/usr/lib64/libqat_s.so +/usr/bin/QAT/ +%{_libdir}/libusdm_drv_s.so +%{_libdir}/libqat_s.so /lib/firmware/qat_4xxx.bin /lib/firmware/qat_4xxx_mmp.bin + +%files driver /lib/modules/%{kernel_version}/kernel/usdm_drv.ko /lib/modules/%{kernel_version}/updates/drivers/crypto/qat/qat_common/intel_qat.ko /lib/modules/%{kernel_version}/updates/drivers/crypto/qat/qat_common/qat_vdcm.ko @@ -127,12 +126,13 @@ INTEL_VENDORID="8086" QAT_4XXX_DEVICE_NUMBER="4940" QAT_4XXX_DEVICE_NUMBER_VM="4941" VQAT_DEVICE_NUMBER="0da5" +QAT_4XXX_NUM_VFS=16 DEVICES="${QAT_4XXX_DEVICE_NUMBER} ${QAT_4XXX_DEVICE_NUMBER_VM} ${VQAT_DEVICE_NUMBER}" num4xxxDevicesP=`lspci -n | egrep -c "${INTEL_VENDORID}:${QAT_4XXX_DEVICE_NUMBER}"` num4xxxDevicesV=`lspci -n | egrep -c "${INTEL_VENDORID}:${QAT_4XXX_DEVICE_NUMBER_VM}"` numVQATDevices=`lspci -n | egrep -c "${INTEL_VENDORID}:${VQAT_DEVICE_NUMBER}"` -if [ -e ${QAT_SERVICE_PATH}/qat_service ]; then +if [ -e ${QAT_SERVICE_PATH}/qat_service -a -e "/dev/qat_adf_ctl" ]; then until ${QAT_SERVICE_PATH}/qat_service shutdown do ${SLEEP} 1 @@ -148,8 +148,17 @@ ${MV} /etc/vqat*.conf /etc/qat_conf_backup/ 2>/dev/null if [ "${num4xxxDevicesP}" -gt "0" ];then ${ICP_ROOT}/generate_conf_files.sh -n ${num4xxxDevicesP} -f ${ICP_ROOT}/build/4xxx_template.conf -o /etc/ - echo "#Remove comment on next line to enable sriov" > /etc/default/qat - echo "#SRIOV_ENABLE=1" >> /etc/default/qat + if [ -e "/etc/default/qat" ];then + . /etc/default/qat + if [ -n "${SRIOV_ENABLE}" ];then + if [ "${SRIOV_ENABLE}" -eq "1" ]; then + num4xxxDevicesV=$((${QAT_4XXX_NUM_VFS} * ${num4xxxDevicesP})) + fi + fi + else + echo "#Remove comment on next line to enable sriov" > /etc/default/qat + echo "#SRIOV_ENABLE=1" >> /etc/default/qat + fi fi if [ "${num4xxxDevicesV}" -gt "0" ];then @@ -175,10 +184,6 @@ for dev in $DEVICES; do echo 'KERNEL=="uio*", ATTRS{vendor}=="0x'`echo ${INTEL_VENDORID} | tr -d \"`'", ATTRS{device}=="0x'`echo ${dev} | tr -d \"`'" MODE="0660" GROUP="qat"' >> /etc/udev/rules.d/00-qat.rules done -${ECHO} "Creating module.dep file for QAT released kernel object" -${ECHO} "This will take a few moments"; -depmod -a - if [ -e /usr/bin/systemctl ]; then if [ "${SYSTEMD_SYSTEM_UNIT_DIR}" == "" ]; then ${ECHO} "Could not find path to place systemd unit file. Using /usr/lib/systemd/system by default" @@ -188,13 +193,20 @@ if [ -e /usr/bin/systemctl ]; then systemctl daemon-reload elif [ -e /sbin/chkconfig ] ; then chkconfig --add qat_service; -elif [ -e /usr/sbin/update-rc.d ]; then +elif [ -e %{_sbindir}/update-rc.d ]; then update-rc.d qat_service defaults fi ${ECHO} "Starting QAT service" /etc/init.d/qat_service start +%post driver +ECHO=/usr/bin/echo +${ECHO} "Creating module.dep file for QAT released kernel object" +${ECHO} "This will take a few moments"; +depmod -a +${ECHO} "%{name}-driver-%{version}-%{release} is installed!"; + %preun QAT_SERVICE_PATH=/etc/init.d/ ECHO=/usr/bin/echo @@ -211,15 +223,20 @@ if [ -e ${QAT_SERVICE_PATH}/qat_service ]; then systemctl daemon-reload elif [ -e /sbin/chkconfig ]; then \ chkconfig --del qat_service; \ - elif [ -e /usr/sbin/update-rc.d ]; then \ + elif [ -e %{_sbindir}/update-rc.d ]; then \ update-rc.d -f qat_service remove; \ fi fi ${RM} -rf /etc/udev/rules.d/00-qat.rules /etc/default/qat -%postun +%postun driver depmod -a %changelog +* Mon Sep 30 2022 Xin Zeng - 0.9.4-00004.2 +- Split kernel driver and library into separate packages + * Tue Aug 30 2022 Xin Zeng - 0.9.4-00004.1 -- Initial version of the package \ No newline at end of file +- Initial version of the package + +