aboutsummaryrefslogtreecommitdiff
path: root/drivers/base/firmware_loader/fallback_table.c
AgeCommit message (Collapse)AuthorFilesLines
2023-10-11fw loader: Remove the now superfluous sentinel element from ctl_table arrayJoel Granados1-1/+0
This commit comes at the tail end of a greater effort to remove the empty elements at the end of the ctl_table arrays (sentinels) which will reduce the overall build time size of the kernel and run time memory bloat by ~64 bytes per sentinel (further information Link : https://lore.kernel.org/all/ZO5Yx5JFogGi%[email protected]/) Remove sentinel from firmware_config_table Signed-off-by: Joel Granados <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
2022-01-22firmware_loader: move firmware sysctl to its own filesXiaoming Ni1-2/+23
Patch series "sysctl: 3rd set of kernel/sysctl cleanups", v2. This is the third set of patches to help address cleaning the kitchen seink in kernel/sysctl.c and to move sysctls away to where they are actually implemented / used. This patch (of 8): kernel/sysctl.c is a kitchen sink where everyone leaves their dirty dishes, this makes it very difficult to maintain. To help with this maintenance let's start by moving sysctls to places where they actually belong. The proc sysctl maintainers do not want to know what sysctl knobs you wish to add for your own piece of code, we just care about the core logic. So move the firmware configuration sysctl table to the only place where it is used, and make it clear that if sysctls are disabled this is not used. [[email protected]: export register_firmware_config_sysctl and unregister_firmware_config_sysctl to modules] [[email protected]: use EXPORT_SYMBOL_NS_GPL instead] [[email protected]: fix that so it compiles] Link: https://lkml.kernel.org/r/[email protected] [[email protected]: major commit log update to justify the move] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Xiaoming Ni <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Stephen Rothwell <[email protected]> Cc: Kees Cook <[email protected]> Cc: Iurii Zaikin <[email protected]> Cc: Eric Biederman <[email protected]> Cc: Stephen Kitt <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: "Theodore Ts'o" <[email protected]> Cc: Al Viro <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]> Cc: John Ogness <[email protected]> Cc: Douglas Gilbert <[email protected]> Cc: James E.J. Bottomley <[email protected]> Cc: Martin K. Petersen <[email protected]> Cc: Lukas Middendorf <[email protected]> Cc: Antti Palosaari <[email protected]> Cc: Amir Goldstein <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Benjamin LaHaise <[email protected]> Cc: Clemens Ladisch <[email protected]> Cc: David Airlie <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Jan Kara <[email protected]> Cc: Joel Becker <[email protected]> Cc: Joonas Lahtinen <[email protected]> Cc: Joseph Qi <[email protected]> Cc: Julia Lawall <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Paul Turner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Phillip Potter <[email protected]> Cc: Qing Wang <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Sebastian Reichel <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Tetsuo Handa <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2020-04-28firmware_loader: move fw_fallback_config to a private kernel symbol namespaceLuis Chamberlain1-1/+1
Take advantage of the new kernel symbol namespacing functionality, and export the fw_fallback_config symbol only to a new private firmware loader namespace. This would prevent misuses from other drivers and makes it clear the goal is to keep this private to the firmware loader only. It should also make it clearer for folks git grep'ing for users of the symbol that this exported symbol is private, and prevent future accidental removals of the exported symbol. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-04-26firmware_loader: revert removal of the fw_fallback_config exportLuis Chamberlain1-0/+1
Christoph's patch removed two unsused exported symbols, however, one symbol is used by the firmware_loader itself. If CONFIG_FW_LOADER=m so the firmware_loader is modular but CONFIG_FW_LOADER_USER_HELPER=y we fail the build at mostpost. ERROR: modpost: "fw_fallback_config" [drivers/base/firmware_loader/firmware_class.ko] undefined! This happens because the variable fw_fallback_config is built into the kernel if CONFIG_FW_LOADER_USER_HELPER=y always, so we need to grant access to the firmware loader module by exporting it. Revert only one hunk from his patch. Fixes: 739604734bd8 ("firmware_loader: remove unused exports") Reported-by: Randy Dunlap <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-04-17firmware_loader: remove unused exportsChristoph Hellwig1-2/+0
Neither fw_fallback_config nor firmware_config_table are used by modules. Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-07-18proc/sysctl: add shared variables for range checkMatteo Croce1-7/+6
In the sysctl code the proc_dointvec_minmax() function is often used to validate the user supplied value between an allowed range. This function uses the extra1 and extra2 members from struct ctl_table as minimum and maximum allowed value. On sysctl handler declaration, in every source file there are some readonly variables containing just an integer which address is assigned to the extra1 and extra2 members, so the sysctl range is enforced. The special values 0, 1 and INT_MAX are very often used as range boundary, leading duplication of variables like zero=0, one=1, int_max=INT_MAX in different source files: $ git grep -E '\.extra[12].*&(zero|one|int_max)' |wc -l 248 Add a const int array containing the most commonly used values, some macros to refer more easily to the correct array member, and use them instead of creating a local one for every object file. This is the bloat-o-meter output comparing the old and new binary compiled with the default Fedora config: # scripts/bloat-o-meter -d vmlinux.o.old vmlinux.o add/remove: 2/2 grow/shrink: 0/2 up/down: 24/-188 (-164) Data old new delta sysctl_vals - 12 +12 __kstrtab_sysctl_vals - 12 +12 max 14 10 -4 int_max 16 - -16 one 68 - -68 zero 128 28 -100 Total: Before=20583249, After=20583085, chg -0.00% [[email protected]: tipc: remove two unused variables] Link: http://lkml.kernel.org/r/[email protected] [[email protected]: fix net/ipv6/sysctl_net_ipv6.c] [[email protected]: proc/sysctl: make firmware loader table conditional] Link: http://lkml.kernel.org/r/[email protected] [[email protected]: fix fs/eventpoll.c] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Matteo Croce <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Kees Cook <[email protected]> Reviewed-by: Aaron Tomlin <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Stephen Rothwell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2019-01-22firmware_loader: move CONFIG_FW_LOADER_USER_HELPER switch to MakefileMasahiro Yamada1-5/+0
The whole code of fallback_table.c is surrounded by #ifdef of CONFIG_FW_LOADER_USER_HELPER. Move the CONFIG_FW_LOADER_USER_HELPER switch to Makefile so that it is not compiled at all when this CONFIG option is disabled. I also removed the confusing comment, "Module or buit-in [sic]". CONFIG_FW_LOADER_USER_HELPER is a boolean option. (If it were a module, CONFIG_FW_LOADER_USER_HELPER_MODULE would be defined instead.) Signed-off-by: Masahiro Yamada <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-03-20firmware: enable to force disable the fallback mechanism at run timeLuis R. Rodriguez1-0/+9
You currently need four different kernel builds to test the firmware API fully. By adding a proc knob to force disable the fallback mechanism completely we are able to reduce the amount of kernels you need built to test the firmware API down to two. Acked-by: Kees Cook <[email protected]> Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-03-20firmware: enable run time change of forcing fallback loaderLuis R. Rodriguez1-0/+17
Currently one requires to test four kernel configurations to test the firmware API completely: 0) CONFIG_FW_LOADER=y 1) o CONFIG_FW_LOADER=y o CONFIG_FW_LOADER_USER_HELPER=y 2) o CONFIG_FW_LOADER=y o CONFIG_FW_LOADER_USER_HELPER=y o CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y 3) When CONFIG_FW_LOADER=m the built-in stuff is disabled, we have no current tests for this. We can reduce the requirements to three kernel configurations by making fw_config.force_sysfs_fallback a proc knob we flip on off. For kernels that disable CONFIG_IKCONFIG_PROC this can also enable one to inspect if CONFIG_FW_LOADER_USER_HELPER_FALLBACK was enabled at build time by checking the proc value at boot time. Acked-by: Kees Cook <[email protected]> Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-03-20firmware: move firmware loader into its own directoryLuis R. Rodriguez1-0/+29
This will make it much easier to manage as we manage to keep trimming componnents down into their own files to more easily manage and maintain this codebase. Suggested-by: Kees Cook <[email protected]> Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>