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: <0e863a4baea59865aff0d1b5657f548bc0aa8d2a.1737441631.git.viresh.kumar@linaro.org>
Date: Tue, 21 Jan 2025 12:26:39 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Sudeep Holla <sudeep.holla@....com>
Cc: Viresh Kumar <viresh.kumar@...aro.org>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Alex Bennée <alex.bennee@...aro.org>,
	Bill Mills <bill.mills@...aro.org>,
	linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] firmware: arm_ffa: Setup of_node for ffa devices

Match and bind the of_node for the FFA device.

Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
---
 drivers/firmware/arm_ffa/bus.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c
index dea3eb741d95..ca526e438e71 100644
--- a/drivers/firmware/arm_ffa/bus.c
+++ b/drivers/firmware/arm_ffa/bus.c
@@ -7,6 +7,8 @@
 
 #include <linux/arm_ffa.h>
 #include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/fs.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -187,6 +189,32 @@ bool ffa_device_is_valid(struct ffa_device *ffa_dev)
 	return valid;
 }
 
+static void ffa_device_of_setup(struct ffa_device *ffa_dev)
+{
+	struct device_node *np;
+	uuid_t uuid;
+	u32 val;
+
+	/* vm-id and UUID must match */
+	for_each_compatible_node(np, NULL, "arm,ffa") {
+		if (of_property_read_u32(np, "vm-id", &val))
+			continue;
+
+		if (ffa_dev->vm_id != val)
+			continue;
+
+		if (of_property_read_u32_array(np, "uuid", (u32 *)&uuid,
+					       sizeof(uuid) / sizeof(u32)))
+			continue;
+
+		if (!uuid_equal(&ffa_dev->uuid, &uuid))
+			continue;
+
+		device_set_node(&ffa_dev->dev, of_fwnode_handle(np));
+		break;
+	}
+}
+
 struct ffa_device *
 ffa_device_register(const struct ffa_partition_info *part_info,
 		    const struct ffa_ops *ops)
@@ -222,6 +250,8 @@ ffa_device_register(const struct ffa_partition_info *part_info,
 	import_uuid(&uuid, (u8 *)part_info->uuid);
 	uuid_copy(&ffa_dev->uuid, &uuid);
 
+	ffa_device_of_setup(ffa_dev);
+
 	ret = device_register(&ffa_dev->dev);
 	if (ret) {
 		dev_err(dev, "unable to register device %s err=%d\n",
-- 
2.31.1.272.g89b43f80a514


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ