@@ -20,6 +20,11 @@ int __init register_fw_debugfs(void)
&fw_debug.force_sysfs_fallback))
goto err_out;
+ if (!debugfs_create_bool("ignore_sysfs_fallback", S_IRUSR | S_IWUSR,
+ debugfs_firmware,
+ &fw_debug.ignore_sysfs_fallback))
+ goto err_out;
+
return 0;
err_out:
debugfs_remove_recursive(debugfs_firmware);
@@ -12,9 +12,13 @@
* as if one had enabled CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y.
* Useful to help debug a CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
* functionality on a kernel where that config entry has been disabled.
+ * @ignore_sysfs_fallback: force to disable the sysfs fallback mechanism.
+ * This emulates the behaviour as if we had set the kernel
+ * config CONFIG_FW_LOADER_USER_HELPER=n.
*/
struct firmware_debug {
bool force_sysfs_fallback;
+ bool ignore_sysfs_fallback;
};
extern struct firmware_debug fw_debug;
@@ -26,6 +30,11 @@ static inline bool fw_debug_force_sysfs_fallback(void)
{
return fw_debug.force_sysfs_fallback;
}
+
+static inline bool fw_debug_ignore_sysfs_fallback(void)
+{
+ return fw_debug.ignore_sysfs_fallback;
+}
#else
static inline int register_fw_debugfs(void)
{
@@ -39,6 +48,11 @@ static inline bool fw_debug_force_sysfs_fallback(void)
{
return false;
}
+
+static inline bool fw_debug_ignore_sysfs_fallback(void)
+{
+ return false;
+}
#endif /* CONFIG_FW_LOADER_DEBUG */
#endif /* __FIRMWARE_DEBUG_H */
@@ -1170,6 +1170,11 @@ static bool fw_force_sysfs_fallback(unsigned int opt_flags)
static bool fw_run_sysfs_fallback(unsigned int opt_flags)
{
+ if (fw_debug_ignore_sysfs_fallback()) {
+ pr_info("Ignoring firmware sysfs fallback due to debugfs knob\n");
+ return false;
+ }
+
if ((opt_flags & FW_OPT_NOFALLBACK))
return false;
One can build a kernel without CONFIG_FW_LOADER_USER_HELPER being enabled, but testing it requires a unique kernel configuration most folks do not enable. This makes it hard to test. Provide a debugfs facility to enable us to emulate such kernels. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> --- drivers/base/firmware_debug.c | 5 +++++ drivers/base/firmware_debug.h | 14 ++++++++++++++ drivers/base/firmware_loader.c | 5 +++++ 3 files changed, 24 insertions(+)