-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meta-hailo: Fix the CMA issue when PVU was integrated
PVU-based DMA isolation brings SWIO TLB to the table and the maximum allowable number of contiguous slabs to map is 128 by default, but meta-hailo requires more than 128. Hence increase it to 256 when meta-hailo is included. Signed-off-by: Li Hua Qian <[email protected]>
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
recipes-kernel/linux/files/patches-6.1/0100-swiotlb-Make-IO_TLB_SEGSIZE-configurable.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Li Hua Qian <[email protected]> | ||
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 <[email protected]> | ||
--- | ||
include/linux/swiotlb.h | 6 +++++- | ||
kernel/dma/Kconfig | 7 +++++++ | ||
2 files changed, 12 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h | ||
index 35bc4e281c21..bf1e1f5cd67b 100644 | ||
--- a/include/linux/swiotlb.h | ||
+++ b/include/linux/swiotlb.h | ||
@@ -22,7 +22,11 @@ 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 | ||
+#ifdef CONFIG_SWIOTLB_SEGSIZE | ||
+#define IO_TLB_SEGSIZE CONFIG_SWIOTLB_SEGSIZE | ||
+#else | ||
+#define IO_TLB_SEGSIZE 128 | ||
+#endif | ||
|
||
/* | ||
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters