Skip to contentSkip to conversation

modify the IO_TLB_SEGSIZE to configtable as flexible requirement about IOMMU/SW-IOMMU.

PATCH In review xiaomin1 2 participants 2 messages Jan 26, 2015

Subsystems (2)
lore
Share & tools
lore

xiaomin1

author
#0 lore raw

PATCH 1/1 modify the IO_TLB_SEGSIZE to configtable as flexible requirement about IOMMU/SW-IOMMU.

The maximum of SW-IOMMU is limited to 2^11*128 = 256K.
While in different platform and different requirements this seems improper. So modify the IO_TLB_SEGSIZE to configtable is make sense. Example:
If 1M bytes are requied. There has an error like.

[ 33.293120] DMA: Out of SW-IOMMU space for 1048576 bytes at device gadget
---
 include/linux/swiotlb.h |    2 +-
 lib/Kconfig             |    4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
include/linux/swiotlb.h +1 -1
index e7a018e..5ab10b9 100644
@@ -14,7 +14,7 @@ extern int swiotlb_force;
  * 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_DEFAULT_IO_TLB_SEGSIZE
 
 /*
  * log of the size of each IO TLB slab.  The number of slabs is command line
lib/Kconfig +4 -0
index 54cf309..76f1108 100644
@@ -518,4 +518,8 @@ source "lib/fonts/Kconfig"
 config ARCH_HAS_SG_CHAIN
 	def_bool n
 
+config DEFAULT_IO_TLB_SEGSIZE
+	int
+	default 128
+
 endmenu
Signature · 1 line
1.7.9.5
#1 lore raw

(For some reason the "Date:" header of this message is 16 hours into the future. Ie, it claims to be for (UTC) 2015-01-26, 19.30 but actually was probably sent around (UTC) 2015-01-26, 03.30. This made this message stick at the top of the mail folder it ended up in. And that was about the only reason why I even scanned it.)

Quoted 3 lines · On Tue, 2015-01-27 at 03:30 +0800, xiaomin1 wrote:

The maximum of SW-IOMMU is limited to 2^11*128 = 256K.
While in different platform and different requirements this seems improper. So modify the IO_TLB_SEGSIZE to configtable is make sense.

configurable?

Ditto for the summary.

Quoted 2 lines

Example:
If 1M bytes are requied. There has an error like.

required one will run into an error like:

or something similar.

Quoted 1 line
[ 33.293120] DMA: Out of SW-IOMMU space for 1048576 bytes at device gadget

So in order to solve that and use 1M this new option needs to be set at 512?

Quoted 26 lines
---
 include/linux/swiotlb.h |    2 +-
 lib/Kconfig             |    4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
include/linux/swiotlb.h +1 -1
index e7a018e..5ab10b9 100644
@@ -14,7 +14,7 @@ extern int swiotlb_force;
  * 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_DEFAULT_IO_TLB_SEGSIZE
 
 /*
  * log of the size of each IO TLB slab.  The number of slabs is command line
lib/Kconfig +0 -0
index 54cf309..76f1108 100644

lib/Kconfig source "lib/fonts/Kconfig" · line 522

Quoted 5 lines
lib/Kconfig +2 -0
@@ -518,4 +518,8 @@ source "lib/fonts/Kconfig"
 config ARCH_HAS_SG_CHAIN
 	def_bool n
 
+config DEFAULT_IO_TLB_SEGSIZE
+	int

No "prompt", so to change this value one needs to edit the .config manually. Is that intended?

lib/Kconfig source "lib/fonts/Kconfig" · line 523

Quoted 1 line
lib/Kconfig +1 -0
+	default 128

According to include/linux/swiotlb.h this needs to be a power of 2. Shouldn't that be explained here too? Ditto the 2K unit size. And should a range of useful values be specified?

(These are not rhetorical questions: I know nothing about all this. This also means I might just not be part of the intended audience for this option.)

lib/Kconfig source "lib/fonts/Kconfig" · line 524

Quoted 1 line
lib/Kconfig +0 -0
 endmenu

Paul Bolle