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]
Message-ID: <5d94d26b71dc74c6891a2c2b22fcee879e3737b1.1761753288.git.dan.carpenter@linaro.org>
Date: Wed, 29 Oct 2025 20:27:10 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Lee Jones <lee@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] mfd: syscon: Don't auto create "no-auto-mmio" syscons

Most syscons are created automaticall and accessed via MMIO. However,
some syscons can only be accessed via a custom regmap because they are
only accessible via the secure partition or via SCMI etc.  We register
these custom syscons by calling the of_syscon_register_regmap()
function.

However, the problem is that syscons are generally used by looking up
the phandle and if the syscon does not exist it is automatically
created as an MMIO syscon.  This creates an ordering problem where we
need to register the syscon before any other driver looks up a
phandle.

The fix is to add a "no-auto-mmio" property to the device tree.  That
will prevent the syscon from being created as an MMIO syscon.  When
the driver looks up the phandle it will get -EPROBE_DEFER if the
syscon has not been registered yet.

Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
 drivers/mfd/syscon.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index ae71a2710bed..063526f039d0 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -183,7 +183,7 @@ static struct regmap *device_node_get_regmap(struct device_node *np,
 		if (create_regmap)
 			syscon = of_syscon_register(np, check_res);
 		else
-			syscon = ERR_PTR(-EINVAL);
+			syscon = ERR_PTR(-EPROBE_DEFER);
 	}
 	mutex_unlock(&syscon_list_lock);
 
@@ -271,7 +271,13 @@ EXPORT_SYMBOL_GPL(device_node_to_regmap);
  */
 struct regmap *syscon_node_to_regmap(struct device_node *np)
 {
-	return device_node_get_regmap(np, of_device_is_compatible(np, "syscon"), true);
+	bool create = false;
+
+	if (of_device_is_compatible(np, "syscon") &&
+	    !of_get_property(np, "no-auto-mmio", NULL))
+		create = true;
+
+	return device_node_get_regmap(np, create, true);
 }
 EXPORT_SYMBOL_GPL(syscon_node_to_regmap);
 
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ