diff --git a/1000-bugfix-support-5.10.patch b/1000-bugfix-support-5.10.patch new file mode 100644 index 0000000000000000000000000000000000000000..2680b816d9759f82d17de078d3d5c0e7c0e08eed --- /dev/null +++ b/1000-bugfix-support-5.10.patch @@ -0,0 +1,193 @@ +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 + +--- + 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(-) + +diff --git a/quickassist/qat/drivers/crypto/qat/Makefile b/quickassist/qat/drivers/crypto/qat/Makefile +index e7280d8..5312e72 100644 +--- a/quickassist/qat/drivers/crypto/qat/Makefile ++++ b/quickassist/qat/drivers/crypto/qat/Makefile +@@ -11,11 +11,9 @@ else ifeq ($(shell test $(VERSION) -ge 4 -a $(PATCHLEVEL) -ge 10; echo $$?), 0) + CONFIG_QAT_MDEV=1 + endif + endif +-ifeq ($(CONFIG_QAT_MDEV), 1) +-ifdef CONFIG_IRQ_BYPASS_MANAGER +- export CONFIG_CRYPTO_DEV_QAT_VDCM=m +-endif +-endif ++ ++export CONFIG_CRYPTO_DEV_QAT_VDCM=m ++ + + 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 +--- 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 @@ + #include + #endif + #endif +-#if (KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE) ++#if (KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE) + #include + #endif + #include "adf_common_drv.h" +@@ -409,7 +409,7 @@ void adf_vqat_release_irqs(struct adf_vdcm_vqat *vqat) + #endif + + #ifdef INTEL_NEXT +-#if (KERNEL_VERSION(5, 11, 0) > LINUX_VERSION_CODE) ++#if (KERNEL_VERSION(5, 10, 0) > LINUX_VERSION_CODE) + static int adf_vqat_get_pasid(struct adf_vdcm_vqat *vqat) + { + #if ((KERNEL_VERSION(5, 6, 0) == LINUX_VERSION_CODE) || \ +@@ -445,7 +445,7 @@ static int adf_vqat_get_pasid(struct adf_vdcm_vqat *vqat) + } + #endif + #endif +-#if (KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE) ++#if (KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE) + 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; + +-#elif KERNEL_VERSION(5, 13, 0) <= LINUX_VERSION_CODE ++#elif 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) + { + dev_info(mdev_dev(vqat->mdev), "Release vqat %p\n", vqat); + adf_vqat_release_irqs(vqat); +-#if (KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE) ++#if (KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE) + vfio_group_put_external_user(vqat->group); + #endif + adf_vdcm_adi_vqat_do_reset(vqat, false); +diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/adf_vdcm_core.c b/quickassist/qat/drivers/crypto/qat/qat_common/adf_vdcm_core.c +index 616df63..5dc63ee 100644 +--- a/quickassist/qat/drivers/crypto/qat/qat_common/adf_vdcm_core.c ++++ b/quickassist/qat/drivers/crypto/qat/qat_common/adf_vdcm_core.c +@@ -58,7 +58,7 @@ struct adf_vdcm_ctx_blk { + static struct service_hndl adf_vdcm_srv_hndl; + static struct adf_vdcm_vqat_type adf_vqat_types[QAT_VQAT_TYPES_MAX]; + +-#if KERNEL_VERSION(5, 13, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE + static struct adf_vdcm_vqat_type *adf_vdcm_lookup_vqat_type(struct device *dev, + struct mdev_type *mtype); + #else +@@ -428,7 +428,7 @@ void adf_vdcm_notify_vqat_iov(struct adf_vdcm_vqat *vqat, u32 queue) + adf_vdcm_notify_vqat(vqat, ADF_VQAT_MISC_IRQ); + } + +-#if KERNEL_VERSION(5, 13, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE + static int adf_vdcm_vqat_create(struct mdev_device *mdev) + #else + static int adf_vdcm_vqat_create(struct kobject *kobj, struct mdev_device *mdev) +@@ -441,7 +441,7 @@ static int adf_vdcm_vqat_create(struct kobject *kobj, struct mdev_device *mdev) + struct adf_accel_dev *parent; + struct adf_vdcm_vqat_ops *ops; + +-#if KERNEL_VERSION(5, 13, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE + vqat_type = adf_vdcm_lookup_vqat_type(par_dev, mdev->type); + if (!vqat_type || !vqat_type->ag) + return -EOPNOTSUPP; +@@ -491,7 +491,7 @@ static int adf_vdcm_vqat_create(struct kobject *kobj, struct mdev_device *mdev) + return 0; + } + +-#if (KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE) ++#if (KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE) + static void adf_vdcm_vqat_request(struct mdev_device *mdev, unsigned int count) + { + struct adf_vdcm_vqat *vqat = mdev_get_drvdata(mdev); +@@ -1342,7 +1342,7 @@ static long adf_vdcm_vqat_ioctl(struct mdev_device *mdev, unsigned int cmd, + return 0; + } + +-#if KERNEL_VERSION(5, 13, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE + static ssize_t + available_instances_show(struct mdev_type *mtype, + struct mdev_type_attribute *attr, char *buf) +@@ -1351,14 +1351,14 @@ static ssize_t + available_instances_show(struct kobject *kobj, struct device *dev, char *buf) + #endif + { +-#if KERNEL_VERSION(5, 13, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE + struct device *dev = mtype_get_parent_dev(mtype); + #endif + struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); + struct adf_accel_dev *accel_dev = NULL; + struct adf_vdcm_vqat_type *vqat_type; + +-#if KERNEL_VERSION(5, 13, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE + vqat_type = adf_vdcm_lookup_vqat_type(dev, mtype); + #else + vqat_type = adf_vdcm_lookup_vqat_type(dev, kobject_name(kobj)); +@@ -1392,7 +1392,7 @@ available_instances_show(struct kobject *kobj, struct device *dev, char *buf) + + MDEV_TYPE_ATTR_RO(available_instances); + +-#if KERNEL_VERSION(5, 13, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE + static ssize_t + name_show(struct mdev_type *mtype, struct mdev_type_attribute *attr, char *buf) + #else +@@ -1400,7 +1400,7 @@ static ssize_t + name_show(struct kobject *kobj, struct device *dev, char *buf) + #endif + { +-#if KERNEL_VERSION(5, 13, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE + struct adf_vdcm_vqat_type *vqat_type; + struct device *par_dev = mtype_get_parent_dev(mtype); + +@@ -1417,7 +1417,7 @@ name_show(struct kobject *kobj, struct device *dev, char *buf) + + MDEV_TYPE_ATTR_RO(name); + +-#if KERNEL_VERSION(5, 13, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE + static ssize_t device_api_show(struct mdev_type *mtype, + struct mdev_type_attribute *attr, char *buf) + #else +@@ -1450,7 +1450,7 @@ static struct mdev_parent_ops qat_vqat_vf_ops = { + .supported_type_groups = qat_vqat_vf_type_groups, + .create = adf_vdcm_vqat_create, + .remove = adf_vdcm_vqat_remove, +-#if KERNEL_VERSION(5, 15, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE + .open_device = adf_vdcm_vqat_open, + .close_device = adf_vdcm_vqat_release, + #else +@@ -1527,7 +1527,7 @@ struct adf_vdcm_vqat_type *adf_vdcm_vqat_type_by_id(enum vqat_type type_id) + return &adf_vqat_types[type_id]; + } + +-#if KERNEL_VERSION(5, 13, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE + static struct adf_vdcm_vqat_type *adf_vdcm_lookup_vqat_type(struct device *dev, + struct mdev_type *mtype) + { +-- +2.27.0 + diff --git a/README.en.md b/README.en.md deleted file mode 100644 index d2e1fec4324f844fed6c5e9e8000f33d27471419..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# kmod-intel-qat - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 96cbb6d3f33f83b29a824e7f5cbe31e24a39cd3e..d839cefc6784b8aa872f2900e1df8b524a63f7e5 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,12 @@ # kmod-intel-qat #### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} - -#### 软件架构 -软件架构说明 - +Intel QAT是下一代平台SPR中用于加解密和压缩计算的加速卡。本软件是QAT的驱动模块。 #### 安装教程 -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +1. cp intel-qat.spec ~/rpmbuild/SPECS +2. cp QAT20-L.0.9.4-00004.tar.gz ~/rpmbuild/SOURCES +3. cp bugfix-support-5.10.patch ~/rpmbuild/SOURCES +4. rpm -bb ~/rpmbuild/SPECS/intel-qat.spec +5. rpm -ivh ~/rpmbuild/RPMS/x86_64/QAT20-L.0.9.4-00004.x86_64.rpm diff --git a/kmod-intel-QAT20-L.0.9.4-00004.tar.gz b/kmod-intel-QAT20-L.0.9.4-00004.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..d4d87e3f2375fa9beb01a0afa2787d1ddefefdb1 Binary files /dev/null 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 new file mode 100644 index 0000000000000000000000000000000000000000..b53436505933f36a0b0e4ec8ab02bfc31dc053ca --- /dev/null +++ b/kmod-intel-QAT20.spec @@ -0,0 +1,225 @@ +%define anolis_release 1 +%define debug_package %{nil} +%global kernel_version %(rpm -qa kernel-devel | sed -e 's/kernel-devel-//g') +%define QAT_release 00004 + +Summary: QAT package +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: libudev-devel >= 1.47 +BuildRequires: kernel-devel >= 5.10.112 +BuildRequires: kernel-core >= 5.10.112 +BuildArch: x86_64 + +%description +"Intel(R) QuickAssist Technology Driver for Linux version %{version}" + +%prep +%setup -c %{name}-%{version} -q +%patch1000 -p1 + +%build +%configure +%make_build +%make_build samples + +%pre +groupadd -f qat + +%install +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}/usr/bin/QAT +mkdir -p %{buildroot}/usr/bin/QAT/build +mkdir -p %{buildroot}/lib/firmware +MODPATH=drivers/crypto/qat +KERNEL_VER=%{kernel_version} +SRCMODDIR=${RPM_BUILD_DIR}/%{name}-%{version}/quickassist/qat/${MODPATH} +DSTMODDIR=%{buildroot}/lib/modules/${KERNEL_VER}/updates/${MODPATH} +mkdir -p %{buildroot}/lib/modules/${KERNEL_VER}/kernel +mkdir -p ${DSTMODDIR}/qat_common/ +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 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 750 build/qat_4xxx.bin %{buildroot}/lib/firmware +/usr/bin/install -D -m 750 build/qat_4xxx_mmp.bin %{buildroot}/lib/firmware + +/usr/bin/install -D -m 666 build/4xxx_template.conf %{buildroot}/usr/bin/QAT/build +/usr/bin/install -D -m 666 build/4xxxvf_dev0.conf.vm %{buildroot}/usr/bin/QAT/build +/usr/bin/install -D -m 666 build/vqat-adi_dev0.conf.sym %{buildroot}/usr/bin/QAT/build +/usr/bin/install -D -m 666 build/vqat-adi_dev0.conf.asym %{buildroot}/usr/bin/QAT/build +/usr/bin/install -D -m 666 build/vqat-adi_dev0.conf.dc %{buildroot}/usr/bin/QAT/build +/usr/bin/install -D -m 755 config_vqat.sh %{buildroot}/usr/bin/QAT/ +/usr/bin/install -D -m 755 generate_conf_files.sh %{buildroot}/usr/bin/QAT/ + +/usr/bin/install -D -m 750 build/usdm_drv.ko %{buildroot}/lib/modules/${KERNEL_VER}/kernel/ +/usr/bin/install -D -m 750 ${SRCMODDIR}/qat_common/intel_qat.ko ${DSTMODDIR}/qat_common/ +/usr/bin/install -D -m 750 ${SRCMODDIR}/qat_common/qat_vdcm.ko ${DSTMODDIR}/qat_common/ +/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 + +%verifyscript + +%files +/etc/init.d/qat_service +/usr/sbin/adf_ctl +/usr/sbin/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 +/lib/firmware/qat_4xxx.bin +/lib/firmware/qat_4xxx_mmp.bin +/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 +/lib/modules/%{kernel_version}/updates/drivers/crypto/qat/qat_4xxx/qat_4xxx.ko +/lib/modules/%{kernel_version}/updates/drivers/crypto/qat/qat_4xxxvf/qat_4xxxvf.ko +/lib/modules/%{kernel_version}/updates/drivers/crypto/qat/qat_vqat/qat_vqat.ko + +%post +MV=/usr/bin/mv +ECHO=/usr/bin/echo +CP=/usr/bin/cp +SLEEP=/usr/bin/sleep +INSTALL=/usr/bin/install +ICP_ROOT=/usr/bin/QAT/ +QAT_SERVICE_PATH=/etc/init.d/ +HUGE_PAGE_DIR=/dev/hugepages/qat +SYSTEMD_SYSTEM_UNIT_DIR=`pkg-config --variable=systemdsystemunitdir systemd` +SYSTEMD_UNIT_FILE_PATH=${ICP_ROOT}/build +SYSTEMD_UNIT_FILE=qat.service +INTEL_VENDORID="8086" +QAT_4XXX_DEVICE_NUMBER="4940" +QAT_4XXX_DEVICE_NUMBER_VM="4941" +VQAT_DEVICE_NUMBER="0da5" +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 + until ${QAT_SERVICE_PATH}/qat_service shutdown + do + ${SLEEP} 1 + done +fi +groupadd -f qat +if [ ! -d /etc/qat_conf_backup ]; then + mkdir /etc/qat_conf_backup +fi +${MV} /etc/4xxx*.conf /etc/qat_conf_backup/ 2>/dev/null +${MV} /etc/4xxxvf*.conf /etc/qat_conf_backup/ 2>/dev/null +${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 +fi + +if [ "${num4xxxDevicesV}" -gt "0" ];then + for (( dev=0; dev<${num4xxxDevicesV}; dev++ ));do + ${INSTALL} -D -m 640 ${ICP_ROOT}/build/4xxxvf_dev0.conf.vm /etc/4xxxvf_dev${dev}.conf + done + echo "SRIOV_ENABLE=1" > /etc/default/qat +fi + +if [ "${numVQATDevices}" -gt "0" ];then + ${ICP_ROOT}/config_vqat.sh + echo "SRIOV_ENABLE=1" > /etc/default/qat +fi + +echo 'KERNEL=="qat_adf_ctl" MODE="0660" GROUP="qat"' > /etc/udev/rules.d/00-qat.rules +echo 'KERNEL=="qat_dev_processes" MODE="0660" GROUP="qat"' >> /etc/udev/rules.d/00-qat.rules +echo 'KERNEL=="usdm_drv" MODE="0660" GROUP="qat"' >> /etc/udev/rules.d/00-qat.rules +echo 'ACTION=="add", DEVPATH=="/module/usdm_drv" SUBSYSTEM=="module" RUN+="/bin/mkdir' ${HUGE_PAGE_DIR}\" >> /etc/udev/rules.d/00-qat.rules +echo 'ACTION=="add", DEVPATH=="/module/usdm_drv" SUBSYSTEM=="module" RUN+="/bin/chgrp qat' ${HUGE_PAGE_DIR}\" >> /etc/udev/rules.d/00-qat.rules +echo 'ACTION=="add", DEVPATH=="/module/usdm_drv" SUBSYSTEM=="module" RUN+="/bin/chmod 0770' ${HUGE_PAGE_DIR}\" >> /etc/udev/rules.d/00-qat.rules +echo 'ACTION=="remove", DEVPATH=="/module/usdm_drv" SUBSYSTEM=="module" RUN+="/bin/rmdir' ${HUGE_PAGE_DIR}\" >> /etc/udev/rules.d/00-qat.rules +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" + fi + ${CP} -f ${SYSTEMD_UNIT_FILE_PATH}/${SYSTEMD_UNIT_FILE} ${SYSTEMD_SYSTEM_UNIT_DIR} + systemctl enable qat + systemctl daemon-reload +elif [ -e /sbin/chkconfig ] ; then + chkconfig --add qat_service; +elif [ -e /usr/sbin/update-rc.d ]; then + update-rc.d qat_service defaults +fi + +${ECHO} "Starting QAT service" +/etc/init.d/qat_service start + +%preun +QAT_SERVICE_PATH=/etc/init.d/ +ECHO=/usr/bin/echo +RM=/usr/bin/rm +${ECHO} "Stopping QAT service" +if [ -e ${QAT_SERVICE_PATH}/qat_service ]; then + until ${QAT_SERVICE_PATH}/qat_service shutdown + do + sleep 1 + done + if [ -e /usr/bin/systemctl ]; then + systemctl stop qat + systemctl disable qat + systemctl daemon-reload + elif [ -e /sbin/chkconfig ]; then \ + chkconfig --del qat_service; \ + elif [ -e /usr/sbin/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 +depmod -a + +%changelog +* Tue Aug 30 2022 Xin Zeng - 0.9.4-00004.1 +- Initial version of the package \ No newline at end of file