All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arun Iyengar <aiyengar1990@gmail.com>
To: Mark Brown <broonie@kernel.org>, Lee Jones <lee@kernel.org>,
	 Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	 Johan Hovold <johan@kernel.org>,
	driver-core@lists.linux.dev,  mfd@lists.linux.dev,
	linux-kernel@vger.kernel.org,  Heiko Stuebner <heiko@sntech.de>,
	linux-rockchip@lists.infradead.org,
	 linux-arm-kernel@lists.infradead.org,
	Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v3 2/2] mfd: syscon: Give each syscon its own lockdep class
Date: Sat, 28 Nov 2026 19:06:25 +0000	[thread overview]
Message-ID: <20261128-syscon-lockdep-v3-2-2c786aa075bf@gmail.com> (raw)
In-Reply-To: <20261128-syscon-lockdep-v3-0-2c786aa075bf@gmail.com>

All syscon regmaps share the lockdep class of the regmap_init_mmio() call
site. On RK3588 the VO1 GRF calls clk_enable() under its regmap lock, while
the CRU's GRF gates take the SYS GRF regmap lock under enable_lock. Lockdep
reports a circular dependency and turns itself off.

Give each syscon its own class.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/mfd/syscon.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 21a7fcdd2737..e0d5558b3382 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -13,6 +13,7 @@
 #include <linux/err.h>
 #include <linux/hwspinlock.h>
 #include <linux/list.h>
+#include <linux/lockdep.h>
 #include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
@@ -29,6 +30,7 @@ struct syscon {
 	struct regmap *regmap;
 	struct reset_control *reset;
 	struct list_head list;
+	struct lock_class_key lock_key;
 };
 
 static const struct regmap_config syscon_regmap_config = {
@@ -62,6 +64,9 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res)
 	if (!base)
 		return ERR_PTR(-ENOMEM);
 
+	lockdep_register_key(&syscon->lock_key);
+	syscon_config.lock_key = &syscon->lock_key;
+
 	/* Parse the device's DT node for an endianness specification */
 	if (of_property_read_bool(np, "big-endian"))
 		syscon_config.val_format_endian = REGMAP_ENDIAN_BIG;
@@ -162,6 +167,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res)
 	regmap_exit(regmap);
 err_regmap:
 	iounmap(base);
+	lockdep_unregister_key(&syscon->lock_key);
 	return ERR_PTR(ret);
 }
 

-- 
2.55.0


WARNING: multiple messages have this Message-ID (diff)
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Mark Brown <broonie@kernel.org>, Lee Jones <lee@kernel.org>,
	 Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	 Johan Hovold <johan@kernel.org>,
	driver-core@lists.linux.dev,  mfd@lists.linux.dev,
	linux-kernel@vger.kernel.org,  Heiko Stuebner <heiko@sntech.de>,
	linux-rockchip@lists.infradead.org,
	 linux-arm-kernel@lists.infradead.org,
	Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v3 2/2] mfd: syscon: Give each syscon its own lockdep class
Date: Sat, 28 Nov 2026 19:06:25 +0000	[thread overview]
Message-ID: <20261128-syscon-lockdep-v3-2-2c786aa075bf@gmail.com> (raw)
In-Reply-To: <20261128-syscon-lockdep-v3-0-2c786aa075bf@gmail.com>

From: Arun Iyengar <aiyengar1990@gmail.com>

All syscon regmaps share the lockdep class of the regmap_init_mmio() call
site. On RK3588 the VO1 GRF calls clk_enable() under its regmap lock, while
the CRU's GRF gates take the SYS GRF regmap lock under enable_lock. Lockdep
reports a circular dependency and turns itself off.

Give each syscon its own class.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/mfd/syscon.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 21a7fcdd2737..e0d5558b3382 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -13,6 +13,7 @@
 #include <linux/err.h>
 #include <linux/hwspinlock.h>
 #include <linux/list.h>
+#include <linux/lockdep.h>
 #include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
@@ -29,6 +30,7 @@ struct syscon {
 	struct regmap *regmap;
 	struct reset_control *reset;
 	struct list_head list;
+	struct lock_class_key lock_key;
 };
 
 static const struct regmap_config syscon_regmap_config = {
@@ -62,6 +64,9 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res)
 	if (!base)
 		return ERR_PTR(-ENOMEM);
 
+	lockdep_register_key(&syscon->lock_key);
+	syscon_config.lock_key = &syscon->lock_key;
+
 	/* Parse the device's DT node for an endianness specification */
 	if (of_property_read_bool(np, "big-endian"))
 		syscon_config.val_format_endian = REGMAP_ENDIAN_BIG;
@@ -162,6 +167,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res)
 	regmap_exit(regmap);
 err_regmap:
 	iounmap(base);
+	lockdep_unregister_key(&syscon->lock_key);
 	return ERR_PTR(ret);
 }
 

-- 
2.55.0



WARNING: multiple messages have this Message-ID (diff)
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Mark Brown <broonie@kernel.org>, Lee Jones <lee@kernel.org>,
	 Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	 Johan Hovold <johan@kernel.org>,
	driver-core@lists.linux.dev,  mfd@lists.linux.dev,
	linux-kernel@vger.kernel.org,  Heiko Stuebner <heiko@sntech.de>,
	linux-rockchip@lists.infradead.org,
	 linux-arm-kernel@lists.infradead.org,
	Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v3 2/2] mfd: syscon: Give each syscon its own lockdep class
Date: Sat, 28 Nov 2026 19:06:25 +0000	[thread overview]
Message-ID: <20261128-syscon-lockdep-v3-2-2c786aa075bf@gmail.com> (raw)
In-Reply-To: <20261128-syscon-lockdep-v3-0-2c786aa075bf@gmail.com>

From: Arun Iyengar <aiyengar1990@gmail.com>

All syscon regmaps share the lockdep class of the regmap_init_mmio() call
site. On RK3588 the VO1 GRF calls clk_enable() under its regmap lock, while
the CRU's GRF gates take the SYS GRF regmap lock under enable_lock. Lockdep
reports a circular dependency and turns itself off.

Give each syscon its own class.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/mfd/syscon.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 21a7fcdd2737..e0d5558b3382 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -13,6 +13,7 @@
 #include <linux/err.h>
 #include <linux/hwspinlock.h>
 #include <linux/list.h>
+#include <linux/lockdep.h>
 #include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
@@ -29,6 +30,7 @@ struct syscon {
 	struct regmap *regmap;
 	struct reset_control *reset;
 	struct list_head list;
+	struct lock_class_key lock_key;
 };
 
 static const struct regmap_config syscon_regmap_config = {
@@ -62,6 +64,9 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res)
 	if (!base)
 		return ERR_PTR(-ENOMEM);
 
+	lockdep_register_key(&syscon->lock_key);
+	syscon_config.lock_key = &syscon->lock_key;
+
 	/* Parse the device's DT node for an endianness specification */
 	if (of_property_read_bool(np, "big-endian"))
 		syscon_config.val_format_endian = REGMAP_ENDIAN_BIG;
@@ -162,6 +167,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res)
 	regmap_exit(regmap);
 err_regmap:
 	iounmap(base);
+	lockdep_unregister_key(&syscon->lock_key);
 	return ERR_PTR(ret);
 }
 

-- 
2.55.0



_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  parent reply	other threads:[~2026-11-28 19:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 19:06 [PATCH v3 0/2] mfd: syscon: Give each syscon its own lockdep class Arun Iyengar
2026-11-28 19:06 ` Arun Iyengar via B4 Relay
2026-11-28 19:06 ` Arun Iyengar via B4 Relay
2026-11-28 19:06 ` [PATCH v3 1/2] regmap: Add an optional lockdep class to struct regmap_config Arun Iyengar
2026-11-28 19:06   ` Arun Iyengar via B4 Relay
2026-11-28 19:06   ` Arun Iyengar via B4 Relay
2026-11-28 19:06 ` Arun Iyengar [this message]
2026-11-28 19:06   ` [PATCH v3 2/2] mfd: syscon: Give each syscon its own lockdep class Arun Iyengar via B4 Relay
2026-11-28 19:06   ` Arun Iyengar via B4 Relay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261128-syscon-lockdep-v3-2-2c786aa075bf@gmail.com \
    --to=aiyengar1990@gmail.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko@sntech.de \
    --cc=johan@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mfd@lists.linux.dev \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.