Skip to contentSkip to conversation

uio: make MAX_UIO_MAPS & MAX_UIO_PORT_REGIONS configurable

PATCH In review Ramon Fried 2 participants 5 messages Apr 13, 2022 Userspace I/O (UIO)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uio: make MAX_UIO_MAPS & MAX_UIO_PORT_REGIONS configurable

MAX_UIO_MAPS and MAX_UIO_PORT_REGIONS are hard-coded to 5. This is not always sufficiant for some drivers.
Make the MAX_UIO_MAPS and MAX_UIO_PORT_REGIONS configurable by providing Kconfig int option with the defaut value of 5.

---
 drivers/uio/Kconfig        | 14 ++++++++++++++
 include/linux/uio_driver.h |  4 ++--
 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/uio/Kconfig +14 -0
index 2e16c5338e5b..bc1fe83cec13 100644
@@ -13,6 +13,20 @@ menuconfig UIO
 
 if UIO
 
+config UIO_MAX_MAPS
+	int "Maximum of memory nodes each uio device support(1-128)"
+	range 1 128
+	default 5
+	help
+	  Maximum memory mapping each uio device can support.
+
+config UIO_MAX_PORT_REGIONS
+	int "Maximum of port regions each uio device support(1-128)"
+	range 1 128
+	default 5
+	help
+	  Maximum port regions each uio device can support.
+
 config UIO_CIF
 	tristate "generic Hilscher CIF Card driver"
 	depends on PCI
include/linux/uio_driver.h +2 -2
index 47c5962b876b..f7dc47347c71 100644
@@ -44,7 +44,7 @@ struct uio_mem {
 	struct uio_map		*map;
 };
 
-#define MAX_UIO_MAPS	5
+#define MAX_UIO_MAPS	CONFIG_UIO_MAX_MAPS
 
 struct uio_portio;
 
@@ -64,7 +64,7 @@ struct uio_port {
 	struct uio_portio	*portio;
 };
 
-#define MAX_UIO_PORT_REGIONS	5
+#define MAX_UIO_PORT_REGIONS	CONFIG_UIO_MAX_PORT_REGIONS
 
 struct uio_device {
 	struct module           *owner;
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 2 lines · Ramon Fried

MAX_UIO_MAPS and MAX_UIO_PORT_REGIONS are hard-coded to 5. This is not always sufficiant for some drivers.

Why not? What in-kernel drivers need more than this?

Quoted 2 lines

Make the MAX_UIO_MAPS and MAX_UIO_PORT_REGIONS configurable by providing Kconfig int option with the defaut value of 5.

Spelling check?

Quoted 12 lines
---
 drivers/uio/Kconfig        | 14 ++++++++++++++
 include/linux/uio_driver.h |  4 ++--
 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/uio/Kconfig +0 -0
index 2e16c5338e5b..bc1fe83cec13 100644

drivers/uio/Kconfig menuconfig UIO · line 17

Quoted 5 lines
drivers/uio/Kconfig +2 -0
@@ -13,6 +13,20 @@ menuconfig UIO
 
 if UIO
 
+config UIO_MAX_MAPS
+	int "Maximum of memory nodes each uio device support(1-128)"

Space before "(" please.

drivers/uio/Kconfig menuconfig UIO · line 21

Quoted 4 lines
drivers/uio/Kconfig +4 -0
+	range 1 128
+	default 5
+	help
+	  Maximum memory mapping each uio device can support.

Any hints as to what this means in more detail?

drivers/uio/Kconfig menuconfig UIO · line 28

Quoted 7 lines
drivers/uio/Kconfig +7 -0
+
+config UIO_MAX_PORT_REGIONS
+	int "Maximum of port regions each uio device support(1-128)"
+	range 1 128
+	default 5
+	help
+	  Maximum port regions each uio device can support.

Again more detail please.

thanks,

greg k-h

#2 lore raw
Quoted 6 lines · Greg KH
Quoted 2 lines · Ramon Fried

MAX_UIO_MAPS and MAX_UIO_PORT_REGIONS are hard-coded to 5. This is not always sufficiant for some drivers.

Why not? What in-kernel drivers need more than this?

Obviously kernel drivers don't need more, but I'm developing a driver that needs more.

Quoted 5 lines
Quoted 3 lines

Make the MAX_UIO_MAPS and MAX_UIO_PORT_REGIONS configurable by providing Kconfig int option with the defaut value of 5.

Spelling check?

Ack, will do.

Quoted 14 lines
Quoted 14 lines
---
 drivers/uio/Kconfig        | 14 ++++++++++++++
 include/linux/uio_driver.h |  4 ++--
 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/uio/Kconfig +0 -0
index 2e16c5338e5b..bc1fe83cec13 100644
@@ -13,6 +13,20 @@ menuconfig UIO
 
Quoted 6 lines

drivers/uio/Kconfig menuconfig UIO · line 17

Quoted 4 lines
drivers/uio/Kconfig +2 -0
 if UIO
 
+config UIO_MAX_MAPS
+     int "Maximum of memory nodes each uio device support(1-128)"

Space before "(" please.

Ack

Quoted 7 lines

drivers/uio/Kconfig menuconfig UIO · line 21

Quoted 5 lines
drivers/uio/Kconfig +4 -0
+     range 1 128
+     default 5
+     help
+       Maximum memory mapping each uio device can support.

Any hints as to what this means in more detail?

Sure.

Quoted 10 lines

drivers/uio/Kconfig menuconfig UIO · line 28

Quoted 8 lines
drivers/uio/Kconfig +7 -0
+
+config UIO_MAX_PORT_REGIONS
+     int "Maximum of port regions each uio device support(1-128)"
+     range 1 128
+     default 5
+     help
+       Maximum port regions each uio device can support.

Again more detail please.

Sure.

Quoted 4 lines

thanks,

greg k-h

maintainer
#3 lore raw
Quoted 9 lines · Ramon Fried
Quoted 6 lines · Greg KH
Quoted 2 lines · Ramon Fried

MAX_UIO_MAPS and MAX_UIO_PORT_REGIONS are hard-coded to 5. This is not always sufficiant for some drivers.

Why not? What in-kernel drivers need more than this?

Obviously kernel drivers don't need more, but I'm developing a driver that needs more.

Great, let's consider this change at the same time you submit your driver, otherwise it doesn't make much sense now, right?

thanks,

greg k-h

#4 lore raw
Quoted 8 lines · Greg KH
Quoted 6 lines · Ramon Fried
Quoted 5 lines · Greg KH
Quoted 2 lines · Ramon Fried

MAX_UIO_MAPS and MAX_UIO_PORT_REGIONS are hard-coded to 5. This is not always sufficiant for some drivers.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Why not? What in-kernel drivers need more than this?

Obviously kernel drivers don't need more, but I'm developing a driver that needs more.

Great, let's consider this change at the same time you submit your driver, otherwise it doesn't make much sense now, right?

NP.

Quoted 4 lines

thanks,

greg k-h