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: <20240626-scmi-driver-v1-2-f16d777e004a@nxp.com>
Date: Wed, 26 Jun 2024 14:58:40 +0800
From: "Peng Fan (OSS)" <peng.fan@....nxp.com>
To: Sudeep Holla <sudeep.holla@....com>, 
 Cristian Marussi <cristian.marussi@....com>
Cc: arm-scmi@...r.kernel.org, linux-arm-kernel@...ts.infradead.org, 
 linux-kernel@...r.kernel.org, Peng Fan <peng.fan@....com>
Subject: [PATCH 2/2] firmware: arm_scmi: create scmi_devices that not have
 of_node

From: Peng Fan <peng.fan@....com>

The scmi protocol device tree node is expected to have consumers or
per node properties expect `reg`. For System power management protocol,
if no per node channel information, no need to add it in device tree,
and it will also trigger dtbs_check error "scmi: 'protocol@12' does not
match any of the regexes: 'pinctrl-[0-9]+'".

To enable system power protocol, need to explictily create the scmi
device and bind with protocol driver.

Signed-off-by: Peng Fan <peng.fan@....com>
---
 drivers/firmware/arm_scmi/driver.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 6b6957f4743f..eac4dab979c2 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -2952,7 +2952,7 @@ static int scmi_debugfs_raw_mode_setup(struct scmi_info *info)
 
 static int scmi_probe(struct platform_device *pdev)
 {
-	int ret;
+	int i, ret;
 	char *err_str = "probe failure\n";
 	struct scmi_handle *handle;
 	const struct scmi_desc *desc;
@@ -2960,6 +2960,7 @@ static int scmi_probe(struct platform_device *pdev)
 	bool coex = IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT_COEX);
 	struct device *dev = &pdev->dev;
 	struct device_node *child, *np = dev->of_node;
+	uint32_t protocols[] = { SCMI_PROTOCOL_SYSTEM, SCMI_PROTOCOL_POWERCAP };
 
 	desc = of_device_get_match_data(dev);
 	if (!desc)
@@ -3114,6 +3115,36 @@ static int scmi_probe(struct platform_device *pdev)
 		scmi_create_protocol_devices(child, info, prot_id, NULL);
 	}
 
+	/* Create devices that not have a device node */
+	for (i = 0; i < ARRAY_SIZE(protocols); i++) {
+		void *p;
+		u32 prot_id = protocols[i];
+
+		p = idr_find(&info->active_protocols, prot_id);
+		if (p)
+			continue;
+
+		if (!scmi_is_protocol_implemented(handle, prot_id)) {
+			dev_info(dev, "SCMI protocol %d not implemented\n",
+				 protocols[i]);
+			continue;
+		}
+
+		ret = scmi_txrx_setup(info, NULL, prot_id);
+		if (ret) {
+			dev_err(dev, "SCMI protocol %d txrx setup fail(%d)\n",
+				prot_id, ret);
+			continue;
+		}
+
+		ret = idr_alloc(&info->active_protocols, NULL,
+				prot_id, prot_id + 1, GFP_KERNEL);
+		if (ret != prot_id)
+			continue;
+
+		scmi_create_protocol_devices(NULL, info, prot_id, NULL);
+	}
+
 	return 0;
 
 notification_exit:

-- 
2.37.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ