Skip to content

Commit 0c18547

Browse files
committed
qat: add support for QAT Gen6
Linux 6.16 added the support for qat_6xxx. Update qat_plugin and NodeFeatureRules to detect the new device (PF 4948, VF 4949). qat_6xxx adds new service 'decomp' for decompression only operations and the capability to configure all three services simultaneously so the plugin and initcontainer are adapted to that. Moreover, 'dcc' service (available on both Gen4 and Gen6) was missing so add that too. Signed-off-by: Mikko Ylinen <[email protected]>
1 parent 2c21b7a commit 0c18547

File tree

10 files changed

+53
-33
lines changed

10 files changed

+53
-33
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ The summary of resources available via plugins in this repository is given in th
242242
* [intelgpu-job.yaml](demo/intelgpu-job.yaml)
243243
* `iaa.intel.com` : `wq-user-[shared or dedicated]`
244244
* [iaa-accel-config-demo-pod.yaml](demo/iaa-accel-config-demo-pod.yaml)
245-
* `qat.intel.com` : `generic` or `cy`/`dc`/`asym-dc`/`sym-dc`
245+
* `qat.intel.com` : `generic` or `cy`/`dc`/`asym-[dc|decom]`/`sym-[dc|decomp]`/`asym-[dc|decomp]`/`asym-sym-[dc|decomp]`/`dcc`/`decomp`
246246
* [compress-perf-dpdk-pod-requesting-qat-dc.yaml](deployments/qat_dpdk_app/compress-perf/compress-perf-dpdk-pod-requesting-qat-dc.yaml)
247247
* [crypto-perf-dpdk-pod-requesting-qat-cy.yaml](deployments/qat_dpdk_app/crypto-perf/crypto-perf-dpdk-pod-requesting-qat-cy.yaml)
248248
* `sgx.intel.com` : `epc`

cmd/qat_plugin/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Supported Devices include, but may not be limited to, the following:
3232
The QAT device plugin provides access to QAT hardware accelerated cryptographic and compression features
3333
through the SR-IOV virtual functions (VF). Demonstrations are provided utilising [DPDK](https://doc.dpdk.org/) and [OpenSSL](https://www.openssl.org/).
3434

35-
QAT Kubernetes resources show up as `qat.intel.com/generic` on systems _before_ QAT Gen4 (4th Gen Xeon&reg;) and `qat.intel.com/[cy|dc]` on QAT Gen4.
35+
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+.
3636

3737
## Modes and Configuration Options
3838

@@ -130,8 +130,10 @@ In addition to the default configuration, you can add device-specific configurat
130130

131131
| Device | Possible Configuration | How To Customize | Options | Notes |
132132
|:-------|:-----------------------|:-----------------|:--------|:------|
133-
| 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. |
134-
| 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. |
133+
| 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. |
134+
| 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+ |
135+
136+
**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`.
135137

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

@@ -225,7 +227,7 @@ In order to utilise the QAT device plugin, QuickAssist SR-IOV virtual functions
225227
You can verify this on your nodes by checking for the relevant PCI identifiers:
226228

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

231233
[1]:https://www-ssl.intel.com/content/www/us/en/design/products-and-solutions/processors-and-chipsets/purley/intel-xeon-scalable-processors.html

cmd/qat_plugin/dpdkdrv/dpdkdrv.go

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ var qatDeviceDriver = map[string]string{
6666
"4943": "4xxxvf",
6767
"4945": "4xxxvf",
6868
"4947": "420xxvf",
69+
"4949": "6xxxvf",
6970
"37c9": "c6xxvf",
7071
"6f55": "d15xxvf",
7172
}
@@ -352,7 +353,7 @@ func readDeviceConfiguration(pfDev string) string {
352353
}
353354

354355
if err2 == nil && len(qatCfgServices) != 0 {
355-
return strings.TrimSpace(string(qatCfgServices))
356+
return strings.Join(strings.SplitN(strings.TrimSpace(string(qatCfgServices)), ";", 3), "-")
356357
}
357358
}
358359

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

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

419420
if _, ok := devicesWithCapabilities[devID]; !ok {
@@ -426,27 +427,13 @@ func getDeviceCapabilities(device string) (string, error) {
426427
return defaultCapabilities, nil
427428
}
428429

429-
switch readDeviceConfiguration(pfDev) {
430-
case "sym;asym":
430+
switch services := readDeviceConfiguration(pfDev); {
431+
case services == "sym-asym":
431432
return "cy", nil
432-
case "asym;sym":
433+
case services == "asym-sym":
433434
return "cy", nil
434-
case "dc":
435-
return "dc", nil
436-
case "sym":
437-
return "sym", nil
438-
case "asym":
439-
return "asym", nil
440-
case "asym;dc":
441-
return "asym-dc", nil
442-
case "dc;asym":
443-
return "asym-dc", nil
444-
case "sym;dc":
445-
return "sym-dc", nil
446-
case "dc;sym":
447-
return "sym-dc", nil
448435
default:
449-
return defaultCapabilities, nil
436+
return services, nil
450437
}
451438
}
452439

cmd/qat_plugin/dpdkdrv/dpdkdrv_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,34 @@ func TestScan(t *testing.T) {
484484
maxDevNum: 1,
485485
expectedDevNum: 1,
486486
},
487+
{
488+
name: "vfio-pci DPDKdriver with no kernel bound driver and where vfdevID is equal to qatDevId (4949), PF with decomp capabilities from sysfs",
489+
dpdkDriver: "vfio-pci",
490+
kernelVfDrivers: []string{"6xxxvf"},
491+
dirs: []string{
492+
"sys/bus/pci/drivers/6xxx",
493+
"sys/bus/pci/drivers/vfio-pci",
494+
"sys/devices/pci0000:02/0000:02:00.0",
495+
"sys/devices/pci0000:02/0000:02:00.0/qat",
496+
"sys/kernel/debug/qat_6xxx_0000:02:00.0",
497+
"sys/bus/pci/devices/0000:02:01.0",
498+
},
499+
files: map[string][]byte{
500+
"sys/devices/pci0000:02/0000:02:00.0/device": []byte("0x4948"),
501+
"sys/devices/pci0000:02/0000:02:00.0/qat/state": []byte("up"),
502+
"sys/devices/pci0000:02/0000:02:00.0/qat/cfg_services": []byte("decomp"),
503+
"sys/bus/pci/devices/0000:02:01.0/device": []byte("0x4949"),
504+
},
505+
symlinks: map[string]string{
506+
"sys/bus/pci/devices/0000:02:01.0/iommu_group": "sys/kernel/iommu_groups/vfiotestfile",
507+
"sys/bus/pci/devices/0000:02:01.0/physfn": "sys/devices/pci0000:02/0000:02:00.0",
508+
"sys/bus/pci/drivers/6xxx/0000:02:00.0": "sys/devices/pci0000:02/0000:02:00.0",
509+
"sys/bus/pci/devices/0000:02:00.0": "sys/devices/pci0000:02/0000:02:00.0",
510+
"sys/devices/pci0000:02/0000:02:00.0/virtfn0": "sys/bus/pci/devices/0000:02:01.0",
511+
},
512+
maxDevNum: 1,
513+
expectedDevNum: 1,
514+
},
487515
{
488516
name: "vfio-pci DPDKdriver with no kernel bound driver and where vfdevID is equal to qatDevId (4941), two PFs with dc and cy capabilities",
489517
dpdkDriver: "vfio-pci",

cmd/qat_plugin/qat_plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func main() {
4040
mode := flag.String("mode", "dpdk", "plugin mode which can be either dpdk (default) or kernel")
4141

4242
dpdkDriver := flag.String("dpdk-driver", "vfio-pci", "DPDK Device driver for configuring the QAT device")
43-
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")
43+
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")
4444
preferredAllocationPolicy := flag.String("allocation-policy", "", "Modes of allocating QAT devices: balanced and packed")
4545
maxNumDevices := flag.Int("max-num-devices", 64, "maximum number of QAT devices to be provided to the QuickAssist device plugin")
4646
flag.Parse()

demo/qat-autoreset.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
NODE_NAME="${NODE_NAME:-}"
3-
ENABLED_QAT_PF_PCIIDS=${ENABLED_QAT_PF_PCIIDS:-37c8 4940 4942 4944 4946}
3+
ENABLED_QAT_PF_PCIIDS=${ENABLED_QAT_PF_PCIIDS:-37c8 4940 4942 4944 4946 4948}
44

55
AUTORESET_ENABLED="NONE"
66
AUTORESET_ENABLED_FOUND="FALSE"

demo/qat-init.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/usr/bin/env bash
22
# This script is based on qatlib's qat_init.sh
33
NODE_NAME="${NODE_NAME:-}"
4-
ENABLED_QAT_PF_PCIIDS=${ENABLED_QAT_PF_PCIIDS:-37c8 4940 4942 4944 4946}
5-
SERVICES_LIST="sym asym sym;asym dc sym;dc asym;dc"
4+
ENABLED_QAT_PF_PCIIDS=${ENABLED_QAT_PF_PCIIDS:-37c8 4940 4942 4944 4946 4948}
5+
# TODO: check against qatlib
6+
SERVICES_LIST="sym asym sym;asym dc sym;dc asym;dc dcc decomp asym;sym;dc asym;sym;decomp"
67
QAT_4XXX_DEVICE_PCI_ID="0x4940"
78
QAT_401XX_DEVICE_PCI_ID="0x4942"
89
QAT_402XX_DEVICE_PCI_ID="0x4944"
910
QAT_420XX_DEVICE_PCI_ID="0x4946"
11+
QAT_6XXX_DEVICE_PCI_ID="0x4948"
1012
SERVICES_ENABLED="NONE"
1113
SERVICES_ENABLED_FOUND="FALSE"
1214

@@ -39,7 +41,7 @@ sysfs_config() {
3941
if [ "$SERVICES_ENABLED_FOUND" = "TRUE" ]; then
4042
for DEVPATH in $DEVS; do
4143
PCI_DEV=$(cat "$DEVPATH"/device 2> /dev/null)
42-
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
44+
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
4345
continue
4446
fi
4547

deployments/nfd/overlays/node-feature-rules/node-feature-rules.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ spec:
9595
- feature: pci.device
9696
matchExpressions:
9797
vendor: {op: In, value: ["8086"]}
98-
device: {op: In, value: ["37c8", "4940", "4942", "4944", "4946"]}
98+
device: {op: In, value: ["37c8", "4940", "4942", "4944", "4946", "4948"]}
9999
class: {op: In, value: ["0b40"]}
100100
- feature: kernel.loadedmodule
101101
matchExpressions:

deployments/operator/crd/bases/deviceplugin.intel.com_qatdeviceplugins.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ spec:
8383
- 4xxxvf
8484
- 420xxvf
8585
- c4xxxvf
86+
- 6xxxvf
8687
type: string
8788
type: array
8889
logLevel:

pkg/apis/deviceplugin/v1/qatdeviceplugin_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121

2222
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2323

24-
// +kubebuilder:validation:Enum={"dh895xccvf","c6xxvf","c3xxxvf","d15xxvf","4xxxvf", "420xxvf", "c4xxxvf"}
24+
// +kubebuilder:validation:Enum={"dh895xccvf","c6xxvf","c3xxxvf","d15xxvf","4xxxvf", "420xxvf", "c4xxxvf", "6xxxvf"}
2525

2626
// KernelVfDriver is a VF device driver for QuickAssist devices.
2727
type KernelVfDriver string

0 commit comments

Comments
 (0)