summaryrefslogtreecommitdiff
path: root/scripts/package-build/linux-kernel/patches/intel-qat
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-05-06 20:30:20 +0200
committerGitHub <noreply@github.com>2026-05-06 20:30:20 +0200
commit7b3f05c3ecbb57f7b0111d2f030e461f5d6071e5 (patch)
tree34f97f8911e517216353ea1bacce659db5b5cf51 /scripts/package-build/linux-kernel/patches/intel-qat
parent0361367d9960c18e0aea54f04405cdcbfb2ff71a (diff)
parentb1151ea0bc7cce64c1398b5aa01eda607da74a37 (diff)
downloadvyos-build-7b3f05c3ecbb57f7b0111d2f030e461f5d6071e5.tar.gz
vyos-build-7b3f05c3ecbb57f7b0111d2f030e461f5d6071e5.zip
Merge pull request #1177 from c-po/kernel-6.18
T8147: Update Linux Kernel to 6.18
Diffstat (limited to 'scripts/package-build/linux-kernel/patches/intel-qat')
-rw-r--r--scripts/package-build/linux-kernel/patches/intel-qat/0001-qdm-use-iommu_paging_domain_alloc-on-linux-6.18.patch62
-rw-r--r--scripts/package-build/linux-kernel/patches/intel-qat/0002-libusdm-kernel-space-fix-include-paths.patch23
-rw-r--r--scripts/package-build/linux-kernel/patches/intel-qat/0003-qat-kbuild-map-extra_cflags-to-ccflags-y.patch26
-rw-r--r--scripts/package-build/linux-kernel/patches/intel-qat/0004-lac-kernel-space-ccflags-y.patch27
4 files changed, 138 insertions, 0 deletions
diff --git a/scripts/package-build/linux-kernel/patches/intel-qat/0001-qdm-use-iommu_paging_domain_alloc-on-linux-6.18.patch b/scripts/package-build/linux-kernel/patches/intel-qat/0001-qdm-use-iommu_paging_domain_alloc-on-linux-6.18.patch
new file mode 100644
index 00000000..ff2fc572
--- /dev/null
+++ b/scripts/package-build/linux-kernel/patches/intel-qat/0001-qdm-use-iommu_paging_domain_alloc-on-linux-6.18.patch
@@ -0,0 +1,62 @@
+From: Christian Breunig <christian@breunig.cc>
+Date: Tue, 28 Apr 2026 16:21:56 +0200
+Subject: [PATCH] iommu: add LINUX_VERSION_CODE conditional for 6.18
+
+---
+ .../qat/drivers/crypto/qat/qat_common/qdm.c | 22 ++++++++++++++++++-
+ 1 file changed, 21 insertions(+), 1 deletion(-)
+
+diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/qdm.c b/quickassist/qat/drivers/crypto/qat/qat_common/qdm.c
+index e4ca0e9..36090fb 100644
+--- a/quickassist/qat/drivers/crypto/qat/qat_common/qdm.c
++++ b/quickassist/qat/drivers/crypto/qat/qat_common/qdm.c
+@@ -9,10 +9,12 @@
+
+ #include <linux/iommu.h>
+ #include <linux/module.h>
++#include <linux/mutex.h>
+ #include <linux/pci.h>
+ #include "qdm.h"
+
+ static struct iommu_domain *domain;
++static DEFINE_MUTEX(qdm_domain_lock);
+
+ static bool iommu_configured_passthrough(void)
+ {
+@@ -70,6 +72,18 @@ int qdm_attach_device(struct device *dev)
+ return -ENODEV;
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 18, 0)
++ if (!domain && qdm_iommu_present() && !iommu_under_pt()) {
++ mutex_lock(&qdm_domain_lock);
++ if (!domain) {
++ domain = iommu_paging_domain_alloc(dev);
++ if (!domain)
++ pr_err("QAT: Failed to allocate a domain\n");
++ }
++ mutex_unlock(&qdm_domain_lock);
++ }
++#endif
++
+ if (!domain) {
+ if (iommu_under_pt()) {
+ dma_addr_t daddr;
+@@ -202,7 +216,13 @@ int __init qdm_init(void)
+ if (!qdm_iommu_present() || iommu_under_pt())
+ return 0;
+
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 18, 0)
++ /*
++ * Kernel 6.18+ no longer provides the legacy iommu_domain_alloc() API.
++ * Allocate the paging domain lazily when the first device attaches.
++ */
++ return 0;
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
+ domain = iommu_domain_alloc();
+ #else
+ domain = iommu_domain_alloc(&pci_bus_type);
+--
+2.39.5
+
diff --git a/scripts/package-build/linux-kernel/patches/intel-qat/0002-libusdm-kernel-space-fix-include-paths.patch b/scripts/package-build/linux-kernel/patches/intel-qat/0002-libusdm-kernel-space-fix-include-paths.patch
new file mode 100644
index 00000000..299cd89a
--- /dev/null
+++ b/scripts/package-build/linux-kernel/patches/intel-qat/0002-libusdm-kernel-space-fix-include-paths.patch
@@ -0,0 +1,23 @@
+From: Christian Breunig <christian@breunig.cc>
+Subject: [PATCH] libusdm_drv: fix EXTRA_CFLAGS include handling for kernel builds
+
+The kernel Makefile incorrectly concatenates "-I" with $(INCLUDES), but
+$(INCLUDES) already contains "-I..." entries from linux_2.6_kernel_space.mk.
+
+That yields broken compiler arguments like "-I-I/path/...", which breaks header
+lookup on newer GCC (observed as missing qae_mem.h / Osal.h during out-of-tree
+module builds against Linux 6.18).
+
+--- a/quickassist/utilities/libusdm_drv/linux/Makefile
++++ b/quickassist/utilities/libusdm_drv/linux/Makefile
+@@ -187,7 +187,9 @@ export OUTPUT_NAME
+ #kernel space rules here
+ #produce two artefacts: module and static library and copy them
+ ifeq ($(OS),linux)
+-EXTRA_CFLAGS+=-I$(INCLUDES) -Werror -ftree-ter
++# INCLUDES already contains "-I..." entries (see env_files/linux_2.6_kernel_space.mk).
++# Prefixing with "-I" again breaks header lookup on newer toolchains (GCC 14+).
++EXTRA_CFLAGS+=$(INCLUDES) -Werror -ftree-ter
+ obj-m+=$(OUTPUT_NAME).o
+ $(OUTPUT_NAME)-objs :=$(patsubst %.c,%.o, $(MODULE_SOURCES)) $(ADDITIONAL_KERNEL_LIBS)
+ lib-m := $(patsubst %.c,%.o, $(SOURCES)) $(patsubst %.S,%.o, $(ASM_SOURCES))
diff --git a/scripts/package-build/linux-kernel/patches/intel-qat/0003-qat-kbuild-map-extra_cflags-to-ccflags-y.patch b/scripts/package-build/linux-kernel/patches/intel-qat/0003-qat-kbuild-map-extra_cflags-to-ccflags-y.patch
new file mode 100644
index 00000000..acdd0c68
--- /dev/null
+++ b/scripts/package-build/linux-kernel/patches/intel-qat/0003-qat-kbuild-map-extra_cflags-to-ccflags-y.patch
@@ -0,0 +1,26 @@
+From: Christian Breunig <christian@breunig.cc>
+Subject: [PATCH] qat: map EXTRA_CFLAGS into ccflags-y for Linux 6.x kbuild
+
+Linux kbuild no longer applies EXTRA_CFLAGS for out-of-tree module builds the
+way older kernels did. Intel QAT's build system still funnels include paths and
+defines through EXTRA_CFLAGS (via env_files/linux_2.6_kernel_space.mk), which
+results in missing vendor headers (qae_mem.h, Osal.h, etc.) when building
+against newer kernels.
+
+Mirror EXTRA_CFLAGS into ccflags-y after including OS-specific rules so the
+flags reach the compiler.
+
+--- a/quickassist/build_system/build_files/rules.mk
++++ b/quickassist/build_system/build_files/rules.mk
+@@ -121,3 +121,11 @@
+
+ #include specific rules according to $(PROG_ACY)_OS and $(PROG_ACY)_OS_LEVEL
+ include $($(PROG_ACY)_BUILDSYSTEM_PATH)/build_files/OS/$($(PROG_ACY)_OS)_$($(PROG_ACY)_OS_LEVEL)_rules.mk
++
++# Linux kbuild (v6.x+) no longer honors EXTRA_CFLAGS for out-of-tree modules.
++# Intel QAT historically routes include paths and defines through EXTRA_CFLAGS via
++# env_files/linux_2.6_kernel_space.mk. Mirror those flags into ccflags-y so they
++# actually reach the compiler when invoking the kernel build system.
++ifdef KERNELRELEASE
++ccflags-y += $(EXTRA_CFLAGS)
++endif
diff --git a/scripts/package-build/linux-kernel/patches/intel-qat/0004-lac-kernel-space-ccflags-y.patch b/scripts/package-build/linux-kernel/patches/intel-qat/0004-lac-kernel-space-ccflags-y.patch
new file mode 100644
index 00000000..d2cffb62
--- /dev/null
+++ b/scripts/package-build/linux-kernel/patches/intel-qat/0004-lac-kernel-space-ccflags-y.patch
@@ -0,0 +1,27 @@
+From: Christian Breunig <christian@breunig.cc>
+Subject: [PATCH] lac: mirror EXTRA_CFLAGS into ccflags-y for kernel_space builds
+
+Lookaside Crypto access_layer skips rules.mk when ICP_OS_LEVEL is kernel_space.
+Linux 6.x kbuild ignores EXTRA_CFLAGS for external modules, so compilation of
+linux/icp_qa_module.c fails to find headers such as cpa.h.
+
+Mirror EXTRA_CFLAGS into ccflags-y for kernel-space builds before pulling in
+Core/OS fragments.
+
+--- a/quickassist/lookaside/access_layer/src/Makefile
++++ b/quickassist/lookaside/access_layer/src/Makefile
+@@ -227,6 +227,14 @@
+ include $(ICP_BUILDSYSTEM_PATH)/build_files/rules.mk
+ endif
+
++# Kernel-space builds skip rules.mk above. Linux 6.x kbuild ignores EXTRA_CFLAGS for
++# external modules; mirror flags into ccflags-y so headers like cpa.h resolve.
++ifeq ($(ICP_OS_LEVEL),kernel_space)
++ifdef KERNELRELEASE
++ccflags-y += $(EXTRA_CFLAGS)
++endif
++endif
++
+ include $(ICP_BUILDSYSTEM_PATH)/build_files/Core/$(ICP_CORE).mk
+ include $(ICP_BUILDSYSTEM_PATH)/build_files/OS/$(ICP_OS).mk
+