diff --git a/kas/opt/meta-hailo.yml b/kas/opt/meta-hailo.yml index a8f1ae64e..e7c0b490c 100644 --- a/kas/opt/meta-hailo.yml +++ b/kas/opt/meta-hailo.yml @@ -14,6 +14,8 @@ header: local_conf_header: hailo: | IOT2050_META_HAILO = "1" + hailo_override: | + OVERRIDES .= ":meta-hailo" repos: meta-iot2050: diff --git a/recipes-kernel/linux/files/iot2050_defconfig_hailo.cfg b/recipes-kernel/linux/files/iot2050_defconfig_hailo.cfg new file mode 100644 index 000000000..2a0ce3004 --- /dev/null +++ b/recipes-kernel/linux/files/iot2050_defconfig_hailo.cfg @@ -0,0 +1 @@ +CONFIG_SWIOTLB_SEGSIZE=256 diff --git a/recipes-kernel/linux/files/patches-6.1/0100-swiotlb-Make-IO_TLB_SEGSIZE-configurable.patch b/recipes-kernel/linux/files/patches-6.1/0100-swiotlb-Make-IO_TLB_SEGSIZE-configurable.patch new file mode 100644 index 000000000..a488c7f58 --- /dev/null +++ b/recipes-kernel/linux/files/patches-6.1/0100-swiotlb-Make-IO_TLB_SEGSIZE-configurable.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Li Hua Qian +Date: Tue, 3 Dec 2024 14:49:59 +0800 +Subject: [PATCH] swiotlb: Make IO_TLB_SEGSIZE configurable + +In some applications, the default value of 128 is not sufficient for +memory allocation and can cause runtime errors. This change makes +IO_TLB_SEGSIZE configurable, allowing it to be increased if needed. + +Signed-off-by: Li Hua Qian +--- + include/linux/swiotlb.h | 2 +- + kernel/dma/Kconfig | 7 +++++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h +index 35bc4e281c21..09d0ad1304a9 100644 +--- a/include/linux/swiotlb.h ++++ b/include/linux/swiotlb.h +@@ -22,7 +22,7 @@ struct scatterlist; + * must be a power of 2. What is the appropriate value ? + * The complexity of {map,unmap}_single is linearly dependent on this value. + */ +-#define IO_TLB_SEGSIZE 128 ++#define IO_TLB_SEGSIZE CONFIG_SWIOTLB_SEGSIZE + + /* + * log of the size of each IO TLB slab. The number of slabs is command line +diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig +index 56866aaa2ae1..2eebe8836100 100644 +--- a/kernel/dma/Kconfig ++++ b/kernel/dma/Kconfig +@@ -80,6 +80,13 @@ config SWIOTLB + bool + select NEED_DMA_MAP_STATE + ++config SWIOTLB_SEGSIZE ++ int "SWIOTLB segment size" ++ default 128 ++ help ++ Set the maximum allowable number of contiguous slabs to map. ++ Must be a power of 2. ++ + config DMA_RESTRICTED_POOL + bool "DMA Restricted Pool" + depends on OF && OF_RESERVED_MEM && SWIOTLB diff --git a/recipes-kernel/linux/linux-iot2050-6.1.inc b/recipes-kernel/linux/linux-iot2050-6.1.inc index 5e1b5f117..927e2b31e 100644 --- a/recipes-kernel/linux/linux-iot2050-6.1.inc +++ b/recipes-kernel/linux/linux-iot2050-6.1.inc @@ -17,6 +17,17 @@ def get_patches(d, patchdir): return ' '.join(['file://' + patch[len(files_dir)+1:] for patch in patches]) +def get_extra_cfg(d): + import re + + overrides = d.getVar('OVERRIDES') + extra_cfg = "" + + if re.search("meta-hailo", overrides): + extra_cfg += " file://iot2050_defconfig_hailo.cfg" + + return extra_cfg + SRC_URI += " \ https://cdn.kernel.org/pub/linux/kernel/projects/cip/6.1/linux-cip-${PV}.tar.xz \ ${@get_patches(d, 'patches-6.1')} \ @@ -24,7 +35,8 @@ SRC_URI += " \ file://${KERNEL_DEFCONFIG} \ file://iot2050_defconfig_extra.cfg" SRC_URI:append:pvu-dma = " \ - file://iot2050_defconfig_pvu.cfg" + file://iot2050_defconfig_pvu.cfg \ + ${@get_extra_cfg(d)}" S = "${WORKDIR}/linux-cip-${PV}"