Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qat: init: detect all system QAT devices #2000

Merged
merged 3 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/lib-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,18 @@ jobs:
matrix:
include:
- name: e2e-dsa-gnr
targetjob: e2e-dsa SKIP="(App:dpdk-test)"
targetjob: e2e-dsa SKIP="(App:(dpdk-test|accel-config))"
runner: simics-gnr
images:
- intel-dsa-plugin
- intel-idxd-config-initcontainer
- accel-config-demo
- intel-deviceplugin-operator
- name: e2e-iaa-gnr
targetjob: e2e-iaa
targetjob: e2e-iaa SKIP="(App:accel-config)"
runner: simics-gnr
images:
- intel-iaa-plugin
- intel-idxd-config-initcontainer
- accel-config-demo
- intel-deviceplugin-operator
- name: e2e-qat-gnrd
targetjob: e2e-qat FOCUS="Mode:dpdk" SKIP="(App:(crypto-perf|compress-perf|qat-engine)|Functionality)"
Expand Down
4 changes: 2 additions & 2 deletions build/docker/intel-dlb-initcontainer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ ARG DIR=/intel-device-plugins-for-kubernetes
WORKDIR $DIR
COPY . .
RUN install -D ${DIR}/LICENSE /install_root/licenses/intel-device-plugins-for-kubernetes/LICENSE
ARG TOYBOX_VERSION="0.8.11"
ARG TOYBOX_SHA256="83a3a88cbe1fa30f099c2f58295baef4637aaf988085aaea56e03aa29168175d"
ARG TOYBOX_VERSION="0.8.12"
ARG TOYBOX_SHA256="3c529d93923dde67d048e7bcbd5d1bc0dd1ad09362269e2415f5f2eaab349b5b"
ARG ROOT=/install_root
RUN apt-get update && apt-get --no-install-recommends -y install musl musl-tools musl-dev
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Expand Down
4 changes: 2 additions & 2 deletions build/docker/intel-fpga-initcontainer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ RUN install -D ${DIR}/LICENSE /install_root/licenses/intel-device-plugins-for-ku
--save_path /install_root/licenses/$CMD/go-licenses ; \
else mkdir -p /install_root/licenses/$CMD/go-licenses/ && cd licenses/$CMD && cp -r * /install_root/licenses/$CMD/go-licenses/ ; fi
###
ARG TOYBOX_VERSION="0.8.11"
ARG TOYBOX_SHA256="83a3a88cbe1fa30f099c2f58295baef4637aaf988085aaea56e03aa29168175d"
ARG TOYBOX_VERSION="0.8.12"
ARG TOYBOX_SHA256="3c529d93923dde67d048e7bcbd5d1bc0dd1ad09362269e2415f5f2eaab349b5b"
ARG ROOT=/install_root
RUN apt-get update && apt-get --no-install-recommends -y install musl musl-tools musl-dev
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Expand Down
4 changes: 2 additions & 2 deletions build/docker/intel-gpu-initcontainer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ RUN install -D ${DIR}/LICENSE /install_root/licenses/intel-device-plugins-for-ku
--save_path /install_root/licenses/$CMD/go-licenses ; \
else mkdir -p /install_root/licenses/$CMD/go-licenses/ && cd licenses/$CMD && cp -r * /install_root/licenses/$CMD/go-licenses/ ; fi
###
ARG TOYBOX_VERSION="0.8.11"
ARG TOYBOX_SHA256="83a3a88cbe1fa30f099c2f58295baef4637aaf988085aaea56e03aa29168175d"
ARG TOYBOX_VERSION="0.8.12"
ARG TOYBOX_SHA256="3c529d93923dde67d048e7bcbd5d1bc0dd1ad09362269e2415f5f2eaab349b5b"
ARG ROOT=/install_root
RUN apt-get update && apt-get --no-install-recommends -y install musl musl-tools musl-dev
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Expand Down
4 changes: 2 additions & 2 deletions build/docker/intel-qat-initcontainer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ ARG DIR=/intel-device-plugins-for-kubernetes
WORKDIR $DIR
COPY . .
RUN install -D ${DIR}/LICENSE /install_root/licenses/intel-device-plugins-for-kubernetes/LICENSE
ARG TOYBOX_VERSION="0.8.11"
ARG TOYBOX_SHA256="83a3a88cbe1fa30f099c2f58295baef4637aaf988085aaea56e03aa29168175d"
ARG TOYBOX_VERSION="0.8.12"
ARG TOYBOX_SHA256="3c529d93923dde67d048e7bcbd5d1bc0dd1ad09362269e2415f5f2eaab349b5b"
ARG ROOT=/install_root
RUN apt-get update && apt-get --no-install-recommends -y install musl musl-tools musl-dev
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Expand Down
4 changes: 2 additions & 2 deletions build/docker/intel-sgx-initcontainer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ RUN install -D ${DIR}/LICENSE /install_root/licenses/intel-device-plugins-for-ku
--save_path /install_root/licenses/$CMD/go-licenses ; \
else mkdir -p /install_root/licenses/$CMD/go-licenses/ && cd licenses/$CMD && cp -r * /install_root/licenses/$CMD/go-licenses/ ; fi
###
ARG TOYBOX_VERSION="0.8.11"
ARG TOYBOX_SHA256="83a3a88cbe1fa30f099c2f58295baef4637aaf988085aaea56e03aa29168175d"
ARG TOYBOX_VERSION="0.8.12"
ARG TOYBOX_SHA256="3c529d93923dde67d048e7bcbd5d1bc0dd1ad09362269e2415f5f2eaab349b5b"
ARG ROOT=/install_root
RUN apt-get update && apt-get --no-install-recommends -y install musl musl-tools musl-dev
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Expand Down
4 changes: 2 additions & 2 deletions build/docker/lib/toybox_build.docker
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG TOYBOX_VERSION="0.8.11"
ARG TOYBOX_SHA256="83a3a88cbe1fa30f099c2f58295baef4637aaf988085aaea56e03aa29168175d"
ARG TOYBOX_VERSION="0.8.12"
ARG TOYBOX_SHA256="3c529d93923dde67d048e7bcbd5d1bc0dd1ad09362269e2415f5f2eaab349b5b"

ARG ROOT=/install_root

Expand Down
14 changes: 6 additions & 8 deletions build/docker/toybox-config-static
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# ToyBox version: KCONFIG_VERSION
# Tue Apr 23 18:03:07 2024
# Wed Mar 19 11:18:16 2025
#
# CONFIG_TOYBOX_ON_ANDROID is not set
CONFIG_TOYBOX_FORK=y
Expand Down Expand Up @@ -105,6 +105,7 @@ CONFIG_TEST_GLUE=y
#
# CONFIG_ARP is not set
# CONFIG_ARPING is not set
# CONFIG_AWK is not set
# CONFIG_BC is not set
# CONFIG_BOOTCHARTD is not set
# CONFIG_BRCTL is not set
Expand Down Expand Up @@ -138,22 +139,18 @@ CONFIG_TEST_GLUE=y
# CONFIG_IPCRM is not set
# CONFIG_IPCS is not set
# CONFIG_KLOGD is not set
# CONFIG_KLOGD_SOURCE_RING_BUFFER is not set
# CONFIG_LAST is not set
# CONFIG_LSOF is not set
# CONFIG_MAN is not set
# CONFIG_MDEV is not set
# CONFIG_MDEV_CONF is not set
# CONFIG_MKE2FS is not set
# CONFIG_MKE2FS_JOURNAL is not set
# CONFIG_MKE2FS_GEN is not set
# CONFIG_MKE2FS_LABEL is not set
# CONFIG_MKE2FS_EXTENDED is not set
# CONFIG_MODPROBE is not set
# CONFIG_MORE is not set
# CONFIG_ROUTE is not set
CONFIG_SH=y
# CONFIG_BREAK is not set
# CONFIG_CD is not set
# CONFIG_CONTINUE is not set
# CONFIG_DECLARE is not set
# CONFIG_EXIT is not set
# CONFIG_SET is not set
Expand All @@ -163,6 +160,7 @@ CONFIG_SH=y
# CONFIG_EXPORT is not set
# CONFIG_JOBS is not set
# CONFIG_LOCAL is not set
# CONFIG_RETURN is not set
# CONFIG_SHIFT is not set
# CONFIG_SOURCE is not set
# CONFIG_WAIT is not set
Expand Down Expand Up @@ -237,7 +235,7 @@ CONFIG_SH=y
# CONFIG_LSATTR is not set
# CONFIG_CHATTR is not set
# CONFIG_LSMOD is not set
CONFIG_LSPCI=y
# CONFIG_LSPCI is not set
# CONFIG_LSUSB is not set
# CONFIG_MAKEDEVS is not set
# CONFIG_MCOOKIE is not set
Expand Down
25 changes: 14 additions & 11 deletions build/docker/toybox-config-ubi9-micro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# ToyBox version: KCONFIG_VERSION
# Wed Sep 6 10:24:35 2023
# Wed Mar 19 11:21:03 2025
#
# CONFIG_TOYBOX_ON_ANDROID is not set
CONFIG_TOYBOX_FORK=y
Expand Down Expand Up @@ -35,6 +35,7 @@ CONFIG_TOYBOX_FORK=y
# CONFIG_FALSE is not set
# CONFIG_FILE is not set
# CONFIG_FIND is not set
# CONFIG_FOLD is not set
# CONFIG_GETCONF is not set
CONFIG_GREP=y
CONFIG_EGREP=y
Expand Down Expand Up @@ -86,10 +87,10 @@ CONFIG_FGREP=y
# CONFIG_TIME is not set
# CONFIG_TOUCH is not set
# CONFIG_TRUE is not set
# CONFIG_TSORT is not set
# CONFIG_TTY is not set
# CONFIG_ULIMIT is not set
# CONFIG_ARCH is not set
# CONFIG_LINUX32 is not set
# CONFIG_UNAME is not set
# CONFIG_UNIQ is not set
# CONFIG_UNLINK is not set
Expand All @@ -104,12 +105,14 @@ CONFIG_FGREP=y
#
# CONFIG_ARP is not set
# CONFIG_ARPING is not set
# CONFIG_AWK is not set
# CONFIG_BC is not set
# CONFIG_BOOTCHARTD is not set
# CONFIG_BRCTL is not set
# CONFIG_CHSH is not set
# CONFIG_CROND is not set
# CONFIG_CRONTAB is not set
# CONFIG_CSPLIT is not set
# CONFIG_DHCP is not set
# CONFIG_DHCP6 is not set
# CONFIG_DHCPD is not set
Expand All @@ -118,10 +121,8 @@ CONFIG_FGREP=y
# CONFIG_DUMPLEASES is not set
# CONFIG_EXPR is not set
# CONFIG_FDISK is not set
# CONFIG_FOLD is not set
# CONFIG_FSCK is not set
# CONFIG_GETFATTR is not set
# CONFIG_GETOPT is not set
# CONFIG_GETTY is not set
# CONFIG_GITCOMPAT is not set
# CONFIG_GITCLONE is not set
Expand All @@ -138,22 +139,18 @@ CONFIG_FGREP=y
# CONFIG_IPCRM is not set
# CONFIG_IPCS is not set
# CONFIG_KLOGD is not set
# CONFIG_KLOGD_SOURCE_RING_BUFFER is not set
# CONFIG_LAST is not set
# CONFIG_LSOF is not set
# CONFIG_MAN is not set
# CONFIG_MDEV is not set
# CONFIG_MDEV_CONF is not set
# CONFIG_MKE2FS is not set
# CONFIG_MKE2FS_JOURNAL is not set
# CONFIG_MKE2FS_GEN is not set
# CONFIG_MKE2FS_LABEL is not set
# CONFIG_MKE2FS_EXTENDED is not set
# CONFIG_MODPROBE is not set
# CONFIG_MORE is not set
# CONFIG_ROUTE is not set
# CONFIG_SH is not set
# CONFIG_BREAK is not set
# CONFIG_CD is not set
# CONFIG_CONTINUE is not set
# CONFIG_DECLARE is not set
# CONFIG_EXIT is not set
# CONFIG_SET is not set
Expand All @@ -163,6 +160,7 @@ CONFIG_FGREP=y
# CONFIG_EXPORT is not set
# CONFIG_JOBS is not set
# CONFIG_LOCAL is not set
# CONFIG_RETURN is not set
# CONFIG_SHIFT is not set
# CONFIG_SOURCE is not set
# CONFIG_WAIT is not set
Expand Down Expand Up @@ -213,6 +211,7 @@ CONFIG_FGREP=y
# CONFIG_FREERAMDISK is not set
# CONFIG_FSFREEZE is not set
# CONFIG_FSYNC is not set
# CONFIG_GETOPT is not set
# CONFIG_GPIODETECT is not set
# CONFIG_GPIOFIND is not set
# CONFIG_GPIOINFO is not set
Expand All @@ -230,15 +229,17 @@ CONFIG_FGREP=y
# CONFIG_INSMOD is not set
# CONFIG_IONICE is not set
# CONFIG_IORENICE is not set
# CONFIG_LINUX32 is not set
# CONFIG_LOGIN is not set
# CONFIG_LOSETUP is not set
# CONFIG_LSATTR is not set
# CONFIG_CHATTR is not set
# CONFIG_LSMOD is not set
CONFIG_LSPCI=y
# CONFIG_LSPCI is not set
# CONFIG_LSUSB is not set
# CONFIG_MAKEDEVS is not set
# CONFIG_MCOOKIE is not set
# CONFIG_MEMEATER is not set
# CONFIG_MIX is not set
# CONFIG_MKPASSWD is not set
# CONFIG_MKSWAP is not set
Expand Down Expand Up @@ -282,6 +283,7 @@ CONFIG_LSPCI=y
# CONFIG_TASKSET is not set
# CONFIG_TIMEOUT is not set
# CONFIG_TRUNCATE is not set
# CONFIG_TS is not set
# CONFIG_UCLAMPSET is not set
# CONFIG_UPTIME is not set
# CONFIG_USLEEP is not set
Expand Down Expand Up @@ -382,6 +384,7 @@ CONFIG_TOYBOX_LSM_NONE=y
# CONFIG_TOYBOX_FLOAT is not set
# CONFIG_TOYBOX_HELP is not set
# CONFIG_TOYBOX_HELP_DASHDASH is not set
# CONFIG_TOYBOX_ZHELP is not set
# CONFIG_TOYBOX_FREE is not set
# CONFIG_TOYBOX_NORECURSE is not set
# CONFIG_TOYBOX_DEBUG is not set
Expand Down
15 changes: 11 additions & 4 deletions demo/qat-autoreset.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
#!/usr/bin/env bash
NODE_NAME="${NODE_NAME:-}"
ENABLED_QAT_PF_PCIIDS=${ENABLED_QAT_PF_PCIIDS:-37c8 4940 4942 4944 4946}
DEVS=$(for pf in $ENABLED_QAT_PF_PCIIDS; do lspci -n | grep -e "$pf" | grep -o -e "^\\S*"; done)

AUTORESET_ENABLED="NONE"
AUTORESET_ENABLED_FOUND="FALSE"
AUTORESET_OPTIONS_LIST="on off"

DEVS=""
for DEV in $(realpath /sys/bus/pci/devices/*); do
for PF in $ENABLED_QAT_PF_PCIIDS; do
if grep -q "$PF" "$DEV"/device; then
DEVS="$DEV $DEVS"
fi
done
done

check_config() {
[ -f "conf/qat.conf" ] && AUTORESET_ENABLED=$(grep "^AutoresetEnabled=" conf/qat.conf | cut -d= -f 2 | grep '\S')
[ -f "conf/qat-$NODE_NAME.conf" ] && AUTORESET_ENABLED=$(grep "^AutoresetEnabled=" conf/qat-"$NODE_NAME".conf | cut -d= -f 2 | grep '\S')
Expand All @@ -25,9 +33,8 @@ check_config() {

enable_auto_reset() {
if [ "$AUTORESET_ENABLED_FOUND" = "TRUE" ]; then
for dev in $DEVS; do
devpath="/sys/bus/pci/devices/0000:$dev"
autoreset_path="$devpath/qat/auto_reset"
for devpath in $DEVS; do
autoreset_path="$devpath"/qat/auto_reset
if ! test -w "$autoreset_path"; then
echo "error: $autoreset_path is not found or not writable. Check if QAT driver module is loaded. Skipping..."
exit 1
Expand Down
22 changes: 14 additions & 8 deletions demo/qat-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# This script is based on qatlib's qat_init.sh
NODE_NAME="${NODE_NAME:-}"
ENABLED_QAT_PF_PCIIDS=${ENABLED_QAT_PF_PCIIDS:-37c8 4940 4942 4944 4946}
DEVS=$(for pf in $ENABLED_QAT_PF_PCIIDS; do lspci -n | grep -e "$pf" | grep -o -e "^\\S*"; done)
SERVICES_LIST="sym asym sym;asym dc sym;dc asym;dc"
QAT_4XXX_DEVICE_PCI_ID="0x4940"
QAT_401XX_DEVICE_PCI_ID="0x4942"
Expand All @@ -11,6 +10,15 @@ QAT_420XX_DEVICE_PCI_ID="0x4946"
SERVICES_ENABLED="NONE"
SERVICES_ENABLED_FOUND="FALSE"

DEVS=""
for DEV in $(realpath /sys/bus/pci/devices/*); do
for PF in $ENABLED_QAT_PF_PCIIDS; do
if grep -q "$PF" "$DEV"/device; then
DEVS="$DEV $DEVS"
fi
done
done

check_config() {
[ -f "conf/qat.conf" ] && SERVICES_ENABLED=$(grep "^ServicesEnabled=" conf/qat.conf | cut -d= -f 2 | grep '\S')
[ -f "conf/qat-$NODE_NAME.conf" ] && SERVICES_ENABLED=$(grep "^ServicesEnabled=" conf/qat-"$NODE_NAME".conf | cut -d= -f 2 | grep '\S')
Expand All @@ -29,8 +37,7 @@ check_config() {

sysfs_config() {
if [ "$SERVICES_ENABLED_FOUND" = "TRUE" ]; then
for dev in $DEVS; do
DEVPATH="/sys/bus/pci/devices/0000:$dev"
for DEVPATH in $DEVS; do
PCI_DEV=$(cat "$DEVPATH"/device 2> /dev/null)
if [ "$PCI_DEV" != "$QAT_4XXX_DEVICE_PCI_ID" ] && [ "$PCI_DEV" != "$QAT_401XX_DEVICE_PCI_ID" ] && [ "$PCI_DEV" != "$QAT_402XX_DEVICE_PCI_ID" ] && [ "$PCI_DEV" != "$QAT_420XX_DEVICE_PCI_ID" ]; then
continue
Expand All @@ -45,15 +52,14 @@ sysfs_config() {
echo "$SERVICES_ENABLED" > "$DEVPATH"/qat/cfg_services
CURRENT_SERVICES=$(cat "$DEVPATH"/qat/cfg_services)
fi
echo "Device $dev configured with services: $CURRENT_SERVICES"
echo "Device $DEVPATH configured with services: $CURRENT_SERVICES"
done
fi
}

enable_sriov() {
for dev in $DEVS; do
DEVPATH="/sys/bus/pci/devices/0000:$dev"
NUMVFS="$DEVPATH/sriov_numvfs"
for DEVPATH in $DEVS; do
NUMVFS="$DEVPATH"/sriov_numvfs
if ! test -w "$NUMVFS"; then
echo "error: $NUMVFS is not found or not writable. Check if QAT driver module is loaded"
exit 1
Expand All @@ -65,7 +71,7 @@ enable_sriov() {
if [ "$(cat "$NUMVFS")" -ne 0 ]; then
echo "$DEVPATH already configured"
else
tee "$NUMVFS" < "$DEVPATH/sriov_totalvfs"
tee "$NUMVFS" < "$DEVPATH"/sriov_totalvfs
VFDEVS=$(realpath -L "$DEVPATH"/virtfn*)
for vfdev in $VFDEVS; do
BSF=$(basename "$vfdev")
Expand Down