QATlib provides user space libraries that allow access to Intel QuickAssist
devices and expose the Intel QuickAssist APIs and samples.

Supported hardware:
  4xxx (QAT gen 4 devices)

Usage of QATlib:
  1) Enable Intel IOMMU with intel_iommu=on in kernel boot cmdline.
  2) Driver qat_4xxx and vfio-pci from kernel.
  3) Firmware qat_4xxx.bin and qat_4xxx_mmp.bin in /lib/firmware from upstream.
  4) Installed qatlib, qatlib-dev and qatlib-samples in your target image.
  4) Enabled /lib/systemd/system/qat.service.
  5) Run samples, such as cpa_sample_code.

Tested with kernel v6.1.62 and systemd installed on target.

Signed-off-by: Yongxin Liu <[email protected]>
---
 recipes-extended/qatlib/files/qatlib.sh |  2 +
 recipes-extended/qatlib/qatlib_git.bb   | 84 +++++++++++++++++++++++++
 2 files changed, 86 insertions(+)
 create mode 100755 recipes-extended/qatlib/files/qatlib.sh
 create mode 100644 recipes-extended/qatlib/qatlib_git.bb

diff --git a/recipes-extended/qatlib/files/qatlib.sh 
b/recipes-extended/qatlib/files/qatlib.sh
new file mode 100755
index 0000000..b4439ce
--- /dev/null
+++ b/recipes-extended/qatlib/files/qatlib.sh
@@ -0,0 +1,2 @@
+export PATH=/opt/intel/qatlib/bin:$PATH
+export LD_LIBRARY_PATH=/opt/intel/qatlib/lib:$LD_LIBRARY_PATH
diff --git a/recipes-extended/qatlib/qatlib_git.bb 
b/recipes-extended/qatlib/qatlib_git.bb
new file mode 100644
index 0000000..89e2d7e
--- /dev/null
+++ b/recipes-extended/qatlib/qatlib_git.bb
@@ -0,0 +1,84 @@
+DESCRIPTION = "Intel QuickAssist Technology Library (QATlib)"
+HOMEPAGE = "https://github.com/intel/qatlib";
+
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=64dc5eee9d532c8a1633bb63ed0d1aac"
+
+COMPATIBLE_MACHINE = "null"
+COMPATIBLE_HOST:x86-x32 = 'null'
+COMPATIBLE_HOST:libc-musl:class-target = 'null'
+
+SRC_URI = "git://github.com/intel/qatlib.git;protocol=https;branch=main \
+           file://qatlib.sh \
+          "
+SRCREV = "142e305970ec66a860945d20bb7c330f99ed900b"
+PV = "23.11.0+git${SRCPV}"
+S = "${WORKDIR}/git"
+
+inherit autotools systemd useradd
+
+DEPENDS = "openssl zlib nasm-native"
+
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM:${PN} = "qat"
+
+PREFIX = "/opt/intel/qatlib"
+SYSTEMD_SERVICE:${PN} = "qat.service"
+SYSTEMD_AUTO_ENABLE = "enable"
+
+do_configure () {
+    cd ${S}
+    ./autogen.sh
+
+    # 1) The systemd unit path "/lib/systemd/system" cannot be correctly 
passed to build system of QATlib. So hardcoded here.
+    # 2) Checking "cross_compiling" is not smart and sometimes causes fatal 
error due to wrong path of ELF file interpreter.
+    ./configure --enable-service --prefix=${PREFIX} 
systemdsystemunitdir=${systemd_unitdir}/system cross_compiling=yes
+}
+
+do_compile () {
+    cd ${S}
+    oe_runmake
+    oe_runmake samples
+}
+
+do_install () {
+    cd ${S}
+    export DESTDIR=${D}
+    oe_runmake install-exec
+    oe_runmake install-dist_systemd_scriptsSCRIPTS
+    oe_runmake install-man
+    oe_runmake install-pkgincludeHEADERS
+    oe_runmake samples-install
+
+    install -d ${D}${systemd_unitdir}/system
+    install -m 0644 quickassist/utilities/service/qat.service 
${D}${systemd_unitdir}/system
+
+    install -d ${D}${sysconfdir}/profile.d
+    install -m 0755 ${WORKDIR}/qatlib.sh ${D}${sysconfdir}/profile.d
+}
+
+SYSROOT_DIRS += "/opt"
+
+PACKAGES = "${PN}-dbg ${PN}-dev ${PN}-doc ${PN}-staticdev ${PN}-samples ${PN}"
+
+FILES:${PN}-dev = "/opt/intel/qatlib/lib/*.so"
+
+FILES:${PN}-dbg = "/opt/intel/qatlib/bin/.debug/* \
+                   /opt/intel/qatlib/lib/.debug/* \
+                   /opt/intel/qatlib/sbin/.debug/* \
+                  "
+
+FILES:${PN}-doc = "/opt/intel/qatlib/share/man"
+
+FILES:${PN}-staticdev = "/opt/intel/qatlib/include/* \
+                          /opt/intel/qatlib/lib/*.a \
+                         "
+
+FILES:${PN}-samples = "/opt/intel/qatlib/bin/*sample* \
+                       /opt/intel/qatlib/share/qat \
+                      "
+
+FILES:${PN} = "/opt/intel/qatlib/* \
+               ${systemd_unitdir}/system \
+               ${sysconfdir}/profile.d/qatlib.sh \
+              "
-- 
2.39.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8180): 
https://lists.yoctoproject.org/g/meta-intel/message/8180
Mute This Topic: https://lists.yoctoproject.org/mt/103014413/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-intel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to