UIO: make MAX_UIO_MAPS configurable by menuconfig
PATCH 1/1 UIO: make MAX_UIO_MAPS configurable by menuconfig
Now each uio device can only support 5 memory entry. 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 we set a range for the config in menuconfig. The range is set as 1 to 512. The default value is still 5 to keep consistent with current code.
--- drivers/uio/Kconfig | 9 +++++++++ include/linux/uio_driver.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/uio/Kconfig +9 -0
@@ -165,4 +165,13 @@ 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 UIO_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 uio device configurable. + endif
include/linux/uio_driver.h +1 -1
@@ -44,7 +44,7 @@ struct uio_mem {struct uio_map *map; }; -#define MAX_UIO_MAPS 5 +#define MAX_UIO_MAPS CONFIG_MAX_UIO_MAPSstruct uio_portio ;
Signature · 1 line
2.12.3
kbuild test robot
build botThank you for the patch! Yet something to improve:
Hi Qiang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on v5.6-rc4 next-20200306]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Qiang-Su/UIO-make-MAX_UIO_MAPS-configurable-by-menuconfig/20200306-192239 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 1f836f5b10f2524d33efde47d2b694b861ecf319 config: nds32-randconfig-a001-20200306 (attached as .config) compiler: nds32le-linux-gcc (GCC) 9.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=nds32
If you fix the issue, kindly add following tag
All error/warnings (new ones prefixed by >>):
In file included from drivers//uio/uio.c:26:
>> include/linux/uio_driver.h:47:22: error: 'CONFIG_MAX_UIO_MAPS' undeclared here (not in a function); did you mean 'CONFIG_UIO_MAX_UIO_MAPS'?
47 | #define MAX_UIO_MAPS CONFIG_MAX_UIO_MAPS
| ^~~~~~~~~~~~~~~~~~~
>> include/linux/uio_driver.h:102:22: note: in expansion of macro 'MAX_UIO_MAPS'
102 | struct uio_mem mem[MAX_UIO_MAPS];
| ^~~~~~~~~~~~vim +47 include/linux/uio_driver.h
46
> 47 #define MAX_UIO_MAPS CONFIG_MAX_UIO_MAPS
48
49 struct uio_portio;
50
51 /**
52 * struct uio_port - description of a UIO port region
53 * @name: name of the port region for identification
54 * @start: start of port region
55 * @size: size of port region
56 * @porttype: type of port (see UIO_PORT_* below)
57 * @portio: for use by the UIO core only.
58 */
59 struct uio_port {
60 const char *name;
61 unsigned long start;
62 unsigned long size;
63 int porttype;
64 struct uio_portio *portio;
65 };
66
67 #define MAX_UIO_PORT_REGIONS 5
68
69 struct uio_device {
70 struct module *owner;
71 struct device dev;
72 int minor;
73 atomic_t event;
74 struct fasync_struct *async_queue;
75 wait_queue_head_t wait;
76 struct uio_info *info;
77 struct mutex info_lock;
78 struct kobject *map_dir;
79 struct kobject *portio_dir;
80 };
81
82 /**
83 * struct uio_info - UIO device capabilities
84 * @uio_dev: the UIO device this info belongs to
85 * @name: device name
86 * @version: device driver version
87 * @mem: list of mappable memory regions, size==0 for end of list
88 * @port: list of port regions, size==0 for end of list
89 * @irq: interrupt number or UIO_IRQ_CUSTOM
90 * @irq_flags: flags for request_irq()
91 * @priv: optional private data
92 * @handler: the device's irq handler
93 * @mmap: mmap operation for this uio device
94 * @open: open operation for this uio device
95 * @release: release operation for this uio device
96 * @irqcontrol: disable/enable irqs when 0/1 is written to /dev/uioX
97 */
98 struct uio_info {
99 struct uio_device *uio_dev;
100 const char *name;
101 const char *version;
> 102 struct uio_mem mem[MAX_UIO_MAPS]; 103 struct uio_port port[MAX_UIO_PORT_REGIONS];
104 long irq;
105 unsigned long irq_flags;
106 void *priv;
107 irqreturn_t (*handler)(int irq, struct uio_info *dev_info);
108 int (*mmap)(struct uio_info *info, struct vm_area_struct *vma);
109 int (*open)(struct uio_info *info, struct inode *inode);
110 int (*release)(struct uio_info *info, struct inode *inode);
111 int (*irqcontrol)(struct uio_info *info, s32 irq_on);
112 };
113
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kbuild test robot
build botThank you for the patch! Yet something to improve:
Hi Qiang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on v5.6-rc4 next-20200306]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Qiang-Su/UIO-make-MAX_UIO_MAPS-configurable-by-menuconfig/20200306-192239 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 1f836f5b10f2524d33efde47d2b694b861ecf319 config: x86_64-randconfig-s0-20200306 (attached as .config) compiler: gcc-4.9 (Debian 4.9.2-10+deb8u1) 4.9.2 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
In file included from drivers/uio/uio.c:26:0:
>> include/linux/uio_driver.h:47:22: error: 'CONFIG_MAX_UIO_MAPS' undeclared here (not in a function)
#define MAX_UIO_MAPS CONFIG_MAX_UIO_MAPS
^
include/linux/uio_driver.h:102:22: note: in expansion of macro 'MAX_UIO_MAPS'
struct uio_mem mem[MAX_UIO_MAPS];
^vim +/CONFIG_MAX_UIO_MAPS +47 include/linux/uio_driver.h
46
> 47 #define MAX_UIO_MAPS CONFIG_MAX_UIO_MAPS
48 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org