lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 20 Jun 2022 21:47:57 +0800
From:   Dong Aisheng <aisheng.dong@....com>
To:     broonie@...nel.org
Cc:     linux-kernel@...r.kernel.org, dongas86@...il.com,
        l.stach@...gutronix.de, peng.fan@....com, shawnguo@...nel.org,
        Dong Aisheng <aisheng.dong@....com>
Subject: [PATCH RFC 1/2] regmap: add option to disable debugfs

The regmap core will create debugfs by default for each instance.
However, it's fairly possible that some devices may not work properly
with regmap registers dump via debugfs due to it may be in suspend
state (e.g. Power domain is off).

Current regmap core does not support runtime pm for MMIO bus.
Although there have been several retries [1] in community but finally
didn't get accepted.

This patch adds an option to allow drivers to claim no debugfs support
due to possible platform limitations.

1. Link: https://lkml.iu.edu/hypermail/linux/kernel/1204.0/01646.html

Cc: Mark Brown <broonie@...nel.org>
Cc: Lucas Stach <l.stach@...gutronix.de>
Signed-off-by: Dong Aisheng <aisheng.dong@....com>
---
 drivers/base/regmap/regmap-debugfs.c | 3 ++-
 drivers/base/regmap/regmap.c         | 3 +++
 include/linux/regmap.h               | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 817eda2075aa..82082a5f1729 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -556,9 +556,10 @@ void regmap_debugfs_init(struct regmap *map)
 	 * a mutex or a spinlock, but if the regmap owner decided to disable
 	 * all locking mechanisms, this is no longer the case. For safety:
 	 * don't create the debugfs entries if locking is disabled.
+	 * Or disabled explicitly in driver.
 	 */
 	if (map->debugfs_disable) {
-		dev_dbg(map->dev, "regmap locking disabled - not creating debugfs entries\n");
+		dev_dbg(map->dev, "regmap debugfs disabled - not creating debugfs entries\n");
 		return;
 	}
 
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index cb0be5e7b100..bb603b4271ef 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -812,6 +812,9 @@ struct regmap *__regmap_init(struct device *dev,
 		map->lock_arg = map;
 	}
 
+	if (config->disable_debugfs && !config->disable_locking)
+		regmap_debugfs_disable(map);
+
 	/*
 	 * When we write in fast-paths with regmap_bulk_write() don't allocate
 	 * scratch buffers with sleeping allocations.
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index d5b08f4f0dc0..db967a331d36 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -282,6 +282,7 @@ typedef void (*regmap_unlock)(void *);
  * @disable_locking: This regmap is either protected by external means or
  *                   is guaranteed not to be accessed from multiple threads.
  *                   Don't use any locking mechanisms.
+ * @disable_debugfs: Optional, don't create debugfs entries for this regmap.
  * @lock:	  Optional lock callback (overrides regmap's default lock
  *		  function, based on spinlock or mutex).
  * @unlock:	  As above for unlocking.
@@ -383,6 +384,7 @@ struct regmap_config {
 	bool (*readable_noinc_reg)(struct device *dev, unsigned int reg);
 
 	bool disable_locking;
+	bool disable_debugfs;
 	regmap_lock lock;
 	regmap_unlock unlock;
 	void *lock_arg;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ