Skip to contentSkip to conversation

firmware: arm_ffa: Treat missing FF-A feature on a platform as a probe miss

PATCH Applied Sudeep Holla 3 participants 5 messages May 26 – May 27

Subsystems (4)
lore
Share & tools
lore

Sudeep Holla

author maintainer
#0 lore raw

PATCH 1/1 firmware: arm_ffa: Treat missing FF-A feature on a platform as a probe miss

When FF-A initialisation is driven from a platform device probe, systems that do not implement FF-A can return -EOPNOTSUPP from the early transport or version discovery paths. Driver core treats that as a matched probe failure and prints:

| arm-ffa arm-ffa: probe with driver arm-ffa failed with error -95

That is noisy for a firmware interface that can be absent on otherwise valid systems. Driver core already treats -ENODEV and -ENXIO as quiet rejected matches, so translate only the early unsupported discovery cases to -ENODEV. Keep later setup failures unchanged so real FF-A initialisation problems are still reported as probe failures.

---
 drivers/firmware/arm_ffa/driver.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/firmware/arm_ffa/driver.c +5 -2
index 54984e1b9741..0f468362c288 100644
@@ -2109,7 +2109,7 @@ static int ffa_probe(struct platform_device *pdev)
 
 	ret = ffa_transport_init(&invoke_ffa_fn);
 	if (ret)
-		return ret;
+		return ret == -EOPNOTSUPP ? -ENODEV : ret;
 
 	drv_info = kzalloc_obj(*drv_info);
 	if (!drv_info)
@@ -2117,8 +2117,11 @@ static int ffa_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, drv_info);
 
 	ret = ffa_version_check(&drv_info->version);
-	if (ret)
+	if (ret) {
+		if (ret == -EOPNOTSUPP)
+			ret = -ENODEV;
 		goto free_drv_info;
+	}
 
 	if (ffa_id_get(&drv_info->vm_id)) {
 		pr_err("failed to obtain VM id for self\n");
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

LGTM.

Quoted 49 lines · Sudeep Holla

When FF-A initialisation is driven from a platform device probe, systems that do not implement FF-A can return -EOPNOTSUPP from the early transport or version discovery paths. Driver core treats that as a matched probe failure and prints:

| arm-ffa arm-ffa: probe with driver arm-ffa failed with error -95

That is noisy for a firmware interface that can be absent on otherwise valid systems. Driver core already treats -ENODEV and -ENXIO as quiet rejected matches, so translate only the early unsupported discovery cases to -ENODEV. Keep later setup failures unchanged so real FF-A initialisation problems are still reported as probe failures.

---
 drivers/firmware/arm_ffa/driver.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/firmware/arm_ffa/driver.c +5 -2
index 54984e1b9741..0f468362c288 100644
@@ -2109,7 +2109,7 @@ static int ffa_probe(struct platform_device *pdev)
 
 	ret = ffa_transport_init(&invoke_ffa_fn);
 	if (ret)
-		return ret;
+		return ret == -EOPNOTSUPP ? -ENODEV : ret;
 
 	drv_info = kzalloc_obj(*drv_info);
 	if (!drv_info)
@@ -2117,8 +2117,11 @@ static int ffa_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, drv_info);
 
 	ret = ffa_version_check(&drv_info->version);
-	if (ret)
+	if (ret) {
+		if (ret == -EOPNOTSUPP)
+			ret = -ENODEV;
 		goto free_drv_info;
+	}
 
 	if (ffa_id_get(&drv_info->vm_id)) {
 		pr_err("failed to obtain VM id for self\n");
Signature · 1 line
2.43.0
Signature · 2 lines
Sincerely,
Yeoreum Yun
Tested-by on v1 1/1
#2 lore raw
In reply to Sudeep Holla
Quoted 13 lines · Sudeep Holla

When FF-A initialisation is driven from a platform device probe, systems that do not implement FF-A can return -EOPNOTSUPP from the early transport or version discovery paths. Driver core treats that as a matched probe failure and prints:

| arm-ffa arm-ffa: probe with driver arm-ffa failed with error -95

That is noisy for a firmware interface that can be absent on otherwise valid systems. Driver core already treats -ENODEV and -ENXIO as quiet rejected matches, so translate only the early unsupported discovery cases to -ENODEV. Keep later setup failures unchanged so real FF-A initialisation problems are still reported as probe failures.

Quoted 3 lines

Appears to work for me.

Quoted 33 lines
---
 drivers/firmware/arm_ffa/driver.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/firmware/arm_ffa/driver.c +5 -2
index 54984e1b9741..0f468362c288 100644
@@ -2109,7 +2109,7 @@ static int ffa_probe(struct platform_device *pdev)
 
 	ret = ffa_transport_init(&invoke_ffa_fn);
 	if (ret)
-		return ret;
+		return ret == -EOPNOTSUPP ? -ENODEV : ret;
 
 	drv_info = kzalloc_obj(*drv_info);
 	if (!drv_info)
@@ -2117,8 +2117,11 @@ static int ffa_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, drv_info);
 
 	ret = ffa_version_check(&drv_info->version);
-	if (ret)
+	if (ret) {
+		if (ret == -EOPNOTSUPP)
+			ret = -ENODEV;
 		goto free_drv_info;
+	}
 
 	if (ffa_id_get(&drv_info->vm_id)) {
 		pr_err("failed to obtain VM id for self\n");
Signature · 1 line
2.43.0
Signature · 2 lines
Cheers,
Nathan
author maintainer
#3 lore raw
Quoted 14 lines · Nathan Chancellor
Quoted 13 lines · Sudeep Holla

When FF-A initialisation is driven from a platform device probe, systems that do not implement FF-A can return -EOPNOTSUPP from the early transport or version discovery paths. Driver core treats that as a matched probe failure and prints:

| arm-ffa arm-ffa: probe with driver arm-ffa failed with error -95

That is noisy for a firmware interface that can be absent on otherwise valid systems. Driver core already treats -ENODEV and -ENXIO as quiet rejected matches, so translate only the early unsupported discovery cases to -ENODEV. Keep later setup failures unchanged so real FF-A initialisation problems are still reported as probe failures.

Quoted 8 lines
Quoted 3 lines

Appears to work for me.

Thanks for reporting and testing. Much appreciated!

Signature · 2 lines
Regards,
Sudeep
author maintainer Applied
#4 lore raw
In reply to Sudeep Holla
Quoted 8 lines · Sudeep Holla

When FF-A initialisation is driven from a platform device probe, systems that do not implement FF-A can return -EOPNOTSUPP from the early transport or version discovery paths. Driver core treats that as a matched probe failure and prints:

| arm-ffa arm-ffa: probe with driver arm-ffa failed with error -95

[...]

Applied to sudeep.holla/linux (for-next/ffa/updates), thanks!

[1/1] firmware: arm_ffa: Treat missing FF-A feature on a platform as a probe miss

      https://git.kernel.org/sudeep.holla/c/18706ea68fc4

--
Regards,
Sudeep