lkml.org 
[lkml]   [2020]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V2] UIO: make maximum memory and port regions configurable
Date
Now each uio device can only support 5 memory regions and
5 port regions. It is far from enough for some big system.
On the other hand, the hard-coded style is not flexible.

Consider the marco is used as array index, so a range for
the config is set in menuconfig. The range is set as 1 to 512.
The default value is still set as 5 to keep consistent with
current code.

Signed-off-by: Qiang Su <suqiang4@huawei.com>
Reported-by: kbuild test robot <lkp@intel.com>
---
Changes since v1:
- also make port regions configurable in menuconfig.
- fix kbuild errors.
---
drivers/uio/Kconfig | 18 ++++++++++++++++++
include/linux/uio_driver.h | 4 ++--
2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 202ee81cfc2b..cee7d93cfea2 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -165,4 +165,22 @@ config UIO_HV_GENERIC
to network and storage devices from userspace.

If you compile this as a module, it will be called uio_hv_generic.
+
+config MAX_UIO_MAPS
+ depends on UIO
+ int "Maximum of memory nodes each uio device support(1-512)"
+ range 1 512
+ default 5
+ help
+ make the max number of memory regions in uio device configurable.
+
+config MAX_UIO_PORT_REGIONS
+ depends on UIO
+ int "Maximum of port regions each uio device support(1-512)"
+ range 1 512
+ default 5
+ help
+ make the max number of port regions in uio device configurable.
+
+
endif
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 01081c4726c0..5dc60088834c 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -44,7 +44,7 @@ struct uio_mem {
struct uio_map *map;
};

-#define MAX_UIO_MAPS 5
+#define MAX_UIO_MAPS CONFIG_MAX_UIO_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_MAX_UIO_PORT_REGIONS

struct uio_device {
struct module *owner;
--
2.12.3
\
 
 \ /
  Last update: 2020-03-07 09:10    [W:0.068 / U:0.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site