Skip to content

qat: QAT Gen6 #2094

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/lib-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
required: false
type: string
env:
no_base_check: "['intel-qat-plugin-kerneldrv', 'intel-idxd-config-initcontainer', 'crypto-perf', 'opae-nlb-demo', 'intel-gpu-levelzero']"
no_base_check: "['intel-idxd-config-initcontainer', 'crypto-perf', 'opae-nlb-demo', 'intel-gpu-levelzero']"

permissions:
contents: read
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lib-validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ jobs:
- name: Check Dockerfiles
run: make check-dockerfiles
- run: make go-mod-tidy
- run: make BUILDTAGS=kerneldrv
- run: make test BUILDTAGS=kerneldrv
- run: make
- run: make test
env:
UNITTEST: 1
- run: make check-github-actions
Expand All @@ -77,9 +77,9 @@ jobs:
strategy:
matrix:
version:
- 1.30.x
- 1.31.x
- 1.32.x
- 1.33.x
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
Expand Down
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
version: "2"
run:
build-tags:
- kerneldrv
tests: true
linters:
default: none
Expand Down
2 changes: 0 additions & 2 deletions .trivyignore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ misconfigurations:
paths:
- dlb_plugin/base/intel-dlb-plugin.yaml
- fpga_plugin/base/intel-fpga-plugin-daemonset.yaml
- qat_plugin/base/intel-qat-kernel-plugin.yaml
- qat_plugin/overlays/qat_initcontainer/qat_initcontainer.yaml

- id: AVD-KSV-0017
Expand All @@ -13,7 +12,6 @@ misconfigurations:
- dlb_plugin/overlays/dlb_initcontainer/dlb_initcontainer.yaml
- dsa_plugin/overlays/dsa_initcontainer/dsa_initcontainer.yaml
- iaa_plugin/overlays/iaa_initcontainer/iaa_initcontainer.yaml
- qat_plugin/base/intel-qat-kernel-plugin.yaml
- qat_plugin/overlays/qat_initcontainer/qat_initcontainer.yaml

- id: AVD-KSV-0047
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ BUILDER ?= "docker"
EXTRA_BUILD_ARGS ?= ""

CERT_MANAGER_VERSION ?= v1.15.2
CONTROLLER_GEN_VERSION ?= v0.17.0
CONTROLLER_GEN_VERSION ?= v0.18.0
GOLANGCI_LINT_VERSION ?= v2.1.6
KIND_VERSION ?= v0.23.0
GOLICENSES_VERSION ?= v1.6.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ The summary of resources available via plugins in this repository is given in th
* [iaa-accel-config-demo-pod.yaml](demo/iaa-accel-config-demo-pod.yaml)
* `npu.intel.com` : `accel`
* [intel-npu-workload.yaml](demo/intel-npu-workload.yaml)
* `qat.intel.com` : `generic` or `cy`/`dc`/`asym-dc`/`sym-dc`
* `qat.intel.com` : `generic` or `cy`/`dc`/`asym-[dc|decomp]`/`sym-[dc|decomp]`/`asym-[dc|decomp]`/`asym-sym-[dc|decomp]`/`dcc`/`decomp`
* [compress-perf-dpdk-pod-requesting-qat-dc.yaml](deployments/qat_dpdk_app/compress-perf/compress-perf-dpdk-pod-requesting-qat-dc.yaml)
* [crypto-perf-dpdk-pod-requesting-qat-cy.yaml](deployments/qat_dpdk_app/crypto-perf/crypto-perf-dpdk-pod-requesting-qat-cy.yaml)
* `sgx.intel.com` : `epc`
Expand Down
10 changes: 6 additions & 4 deletions cmd/qat_plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Supported Devices include, but may not be limited to, the following:
The QAT device plugin provides access to QAT hardware accelerated cryptographic and compression features
through the SR-IOV virtual functions (VF). Demonstrations are provided utilising [DPDK](https://doc.dpdk.org/) and [OpenSSL](https://www.openssl.org/).

QAT Kubernetes resources show up as `qat.intel.com/generic` on systems _before_ QAT Gen4 (4th Gen Xeon®) and `qat.intel.com/[cy|dc]` on QAT Gen4.
QAT Kubernetes resources show up as `qat.intel.com/generic` on systems _before_ QAT Gen4 (4th Gen Xeon&reg;) and `qat.intel.com/[<configured services>]` on QAT Gen4+.

## Modes and Configuration Options

Expand Down Expand Up @@ -120,8 +120,10 @@ In addition to the default configuration, you can add device-specific configurat

| Device | Possible Configuration | How To Customize | Options | Notes |
|:-------|:-----------------------|:-----------------|:--------|:------|
| 4xxx, 401xx, 402xx, 420xx | [cfg_services](https://github.com/torvalds/linux/blob/v6.6-rc5/Documentation/ABI/testing/sysfs-driver-qat) reports the configured services (crypto services or compression services) of the QAT device. | `ServicesEnabled=<value>` | compress:`dc`, crypto:`sym;asym`, <br>crypto+compress:`asym;dc`,<br>crypto+compress:`sym;dc` | 4xxx/401xx/402xx: Linux 6.0+ kernel. 420xx: Linux 6.8+ kernel. |
| 4xxx, 401xx, 402xx, 420xx | [auto_reset](https://github.com/torvalds/linux/blob/a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6/Documentation/ABI/testing/sysfs-driver-qat#L145) reports the setting of the QAT device's automatic error recovery functionality. | `AutoresetEnabled=<value>` | `on`, `off`, | Linux 6.8+ kernel. |
| 4xxx, 401xx, 402xx, 420xx, 6xxx | [cfg_services](https://github.com/torvalds/linux/blob/v6.16/Documentation/ABI/testing/sysfs-driver-qat) reports the configured services (crypto services or compression services) of the QAT device. | `ServicesEnabled=<value>` | Available services: compress:`dc`, de-compress: `decomp`, (`6xxx` only), dc chaining feature: `dcc`, symmetric crypto: `sym`, asymmetric crypto: `asym`, | 4xxx/401xx/402xx/6xxx: Linux 6.0+, 420xx: Linux 6.8+, 6xxx Linux 6.16. |
| 4xxx, 401xx, 402xx, 420xx, 6xxx | [auto_reset](https://github.com/torvalds/linux/blob/v6.16/Documentation/ABI/testing/sysfs-driver-qat#L145) reports the setting of the QAT device's automatic error recovery functionality. | `AutoresetEnabled=<value>` | `on`, `off`, | 4xxx/401xx/402xx/420xx: Linux 6.8+, 6xxx: Linux 6.16+ |

**Note:** Service combinations are permitted for all services except `dcc`. On QAT Gen4 devices (`qat_4xxx` driver) a maximum of two services can be combined and on QAT Gen6 devices (`qat_6xxx` driver) a maximum of three services can be combined. The order of services is not significant. For instance, `sym;asym` is functionally equivalent to `asym;sym`.

To create a provisioning `configMap`, run the following command before deploying initcontainer:

Expand Down Expand Up @@ -215,7 +217,7 @@ In order to utilise the QAT device plugin, QuickAssist SR-IOV virtual functions
You can verify this on your nodes by checking for the relevant PCI identifiers:

```bash
for i in 0442 0443 18a1 37c9 6f55 19e3 4941 4943 4945 4947; do lspci -d 8086:$i; done
for i in 0442 0443 18a1 37c9 6f55 19e3 4941 4943 4945 4947 4949; do lspci -d 8086:$i; done
```

[1]:https://www-ssl.intel.com/content/www/us/en/design/products-and-solutions/processors-and-chipsets/purley/intel-xeon-scalable-processors.html
Expand Down
32 changes: 10 additions & 22 deletions cmd/qat_plugin/dpdkdrv/dpdkdrv.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var qatDeviceDriver = map[string]string{
"4943": "4xxxvf",
"4945": "4xxxvf",
"4947": "420xxvf",
"4949": "6xxxvf",
"37c9": "c6xxvf",
"6f55": "d15xxvf",
}
Expand Down Expand Up @@ -352,7 +353,7 @@ func readDeviceConfiguration(pfDev string) string {
}

if err2 == nil && len(qatCfgServices) != 0 {
return strings.TrimSpace(string(qatCfgServices))
return strings.Join(strings.SplitN(strings.TrimSpace(string(qatCfgServices)), ";", 3), "-")
}
}

Expand Down Expand Up @@ -392,8 +393,7 @@ func getDeviceHealthiness(device string, lookup map[string]string) string {
hbStatusFile := filepath.Join(filepath.Dir(filepath.Join(pfDev, "../../")), "kernel/debug",
fmt.Sprintf("qat_%s_%s/heartbeat/status", driver, filepath.Base(pfDev)))

// If status reads "-1", the device is considered bad:
// https://github.com/torvalds/linux/blob/v6.6-rc5/Documentation/ABI/testing/debugfs-driver-qat
// If status reads "-1", the device is considered bad.
if data, err := os.ReadFile(hbStatusFile); err == nil && strings.Split(string(data), "\n")[0] == "-1" {
healthiness = pluginapi.Unhealthy
}
Expand All @@ -414,6 +414,7 @@ func getDeviceCapabilities(device string) (string, error) {
"4943": {}, // QAT Gen4 (401xx) VF PCI ID
"4945": {}, // QAT Gen4 (402xx) VF PCI ID
"4947": {}, // QAT Gen4 (420xx) VF PCI ID
"4949": {}, // QAT Gen6 (6xxx) VF PCI ID
}

if _, ok := devicesWithCapabilities[devID]; !ok {
Expand All @@ -426,27 +427,14 @@ func getDeviceCapabilities(device string) (string, error) {
return defaultCapabilities, nil
}

switch readDeviceConfiguration(pfDev) {
case "sym;asym":
services := readDeviceConfiguration(pfDev)
switch services {
case "sym-asym":
fallthrough
case "asym-sym":
return "cy", nil
case "asym;sym":
return "cy", nil
case "dc":
return "dc", nil
case "sym":
return "sym", nil
case "asym":
return "asym", nil
case "asym;dc":
return "asym-dc", nil
case "dc;asym":
return "asym-dc", nil
case "sym;dc":
return "sym-dc", nil
case "dc;sym":
return "sym-dc", nil
default:
return defaultCapabilities, nil
return services, nil
}
}

Expand Down
28 changes: 28 additions & 0 deletions cmd/qat_plugin/dpdkdrv/dpdkdrv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,34 @@ func TestScan(t *testing.T) {
maxDevNum: 1,
expectedDevNum: 1,
},
{
name: "vfio-pci DPDKdriver with no kernel bound driver and where vfdevID is equal to qatDevId (4949), PF with decomp capabilities from sysfs",
dpdkDriver: "vfio-pci",
kernelVfDrivers: []string{"6xxxvf"},
dirs: []string{
"sys/bus/pci/drivers/6xxx",
"sys/bus/pci/drivers/vfio-pci",
"sys/devices/pci0000:02/0000:02:00.0",
"sys/devices/pci0000:02/0000:02:00.0/qat",
"sys/kernel/debug/qat_6xxx_0000:02:00.0",
"sys/bus/pci/devices/0000:02:01.0",
},
files: map[string][]byte{
"sys/devices/pci0000:02/0000:02:00.0/device": []byte("0x4948"),
"sys/devices/pci0000:02/0000:02:00.0/qat/state": []byte("up"),
"sys/devices/pci0000:02/0000:02:00.0/qat/cfg_services": []byte("decomp"),
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x4949"),
},
symlinks: map[string]string{
"sys/bus/pci/devices/0000:02:01.0/iommu_group": "sys/kernel/iommu_groups/vfiotestfile",
"sys/bus/pci/devices/0000:02:01.0/physfn": "sys/devices/pci0000:02/0000:02:00.0",
"sys/bus/pci/drivers/6xxx/0000:02:00.0": "sys/devices/pci0000:02/0000:02:00.0",
"sys/bus/pci/devices/0000:02:00.0": "sys/devices/pci0000:02/0000:02:00.0",
"sys/devices/pci0000:02/0000:02:00.0/virtfn0": "sys/bus/pci/devices/0000:02:01.0",
},
maxDevNum: 1,
expectedDevNum: 1,
},
{
name: "vfio-pci DPDKdriver with no kernel bound driver and where vfdevID is equal to qatDevId (4941), two PFs with dc and cy capabilities",
dpdkDriver: "vfio-pci",
Expand Down
2 changes: 1 addition & 1 deletion cmd/qat_plugin/qat_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func main() {
)

dpdkDriver := flag.String("dpdk-driver", "vfio-pci", "DPDK Device driver for configuring the QAT device")
kernelVfDrivers := flag.String("kernel-vf-drivers", "4xxxvf,420xxvf", "Comma separated VF Device Driver of the QuickAssist Devices in the system. Devices supported: DH895xCC, C62x, C3xxx, C4xxx, 4xxx, 420xxx, and D15xx")
kernelVfDrivers := flag.String("kernel-vf-drivers", "4xxxvf,420xxvf", "Comma separated VF Device Driver of the QuickAssist Devices in the system. Devices supported: DH895xCC, C62x, C3xxx, C4xxx, 4xxx, 420xxx, 6xxx, and D15xx")
preferredAllocationPolicy := flag.String("allocation-policy", "", "Modes of allocating QAT devices: balanced and packed")
maxNumDevices := flag.Int("max-num-devices", 64, "maximum number of QAT devices to be provided to the QuickAssist device plugin")
flag.Parse()
Expand Down
2 changes: 1 addition & 1 deletion demo/qat-autoreset.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
NODE_NAME="${NODE_NAME:-}"
ENABLED_QAT_PF_PCIIDS=${ENABLED_QAT_PF_PCIIDS:-37c8 4940 4942 4944 4946}
ENABLED_QAT_PF_PCIIDS=${ENABLED_QAT_PF_PCIIDS:-37c8 4940 4942 4944 4946 4948}

AUTORESET_ENABLED="NONE"
AUTORESET_ENABLED_FOUND="FALSE"
Expand Down
8 changes: 5 additions & 3 deletions demo/qat-init.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/usr/bin/env bash
# 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}
SERVICES_LIST="sym asym sym;asym dc sym;dc asym;dc"
ENABLED_QAT_PF_PCIIDS=${ENABLED_QAT_PF_PCIIDS:-37c8 4940 4942 4944 4946 4948}
# TODO: check against qatlib
SERVICES_LIST="sym asym sym;asym dc sym;dc asym;dc dcc decomp asym;sym;dc asym;sym;decomp"
QAT_4XXX_DEVICE_PCI_ID="0x4940"
QAT_401XX_DEVICE_PCI_ID="0x4942"
QAT_402XX_DEVICE_PCI_ID="0x4944"
QAT_420XX_DEVICE_PCI_ID="0x4946"
QAT_6XXX_DEVICE_PCI_ID="0x4948"
SERVICES_ENABLED="NONE"
SERVICES_ENABLED_FOUND="FALSE"

Expand Down Expand Up @@ -39,7 +41,7 @@ sysfs_config() {
if [ "$SERVICES_ENABLED_FOUND" = "TRUE" ]; then
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
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" ] && [ "$PCI_DEV" != "$QAT_6XXX_DEVICE_PCI_ID" ]; then
continue
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.18.0
name: acceleratorfunctions.fpga.intel.com
spec:
group: fpga.intel.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.18.0
name: fpgaregions.fpga.intel.com
spec:
group: fpga.intel.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ spec:
- feature: pci.device
matchExpressions:
vendor: {op: In, value: ["8086"]}
device: {op: In, value: ["37c8", "4940", "4942", "4944", "4946"]}
device: {op: In, value: ["37c8", "4940", "4942", "4944", "4946", "4948"]}
class: {op: In, value: ["0b40"]}
- feature: kernel.loadedmodule
matchExpressions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.18.0
name: dlbdeviceplugins.deviceplugin.intel.com
spec:
group: deviceplugin.intel.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.18.0
name: dsadeviceplugins.deviceplugin.intel.com
spec:
group: deviceplugin.intel.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.18.0
name: fpgadeviceplugins.deviceplugin.intel.com
spec:
group: deviceplugin.intel.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.18.0
name: gpudeviceplugins.deviceplugin.intel.com
spec:
group: deviceplugin.intel.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.18.0
name: iaadeviceplugins.deviceplugin.intel.com
spec:
group: deviceplugin.intel.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.18.0
name: npudeviceplugins.deviceplugin.intel.com
spec:
group: deviceplugin.intel.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.18.0
name: qatdeviceplugins.deviceplugin.intel.com
spec:
group: deviceplugin.intel.com
Expand Down Expand Up @@ -83,6 +83,7 @@ spec:
- 4xxxvf
- 420xxvf
- c4xxxvf
- 6xxxvf
type: string
type: array
logLevel:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.18.0
name: sgxdeviceplugins.deviceplugin.intel.com
spec:
group: deviceplugin.intel.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.18.0
name: acceleratorfunctions.fpga.intel.com
spec:
group: fpga.intel.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.18.0
name: fpgaregions.fpga.intel.com
spec:
group: fpga.intel.com
Expand Down
Loading