tee: optee: Populate child nodes in probe function
Subsystems (2)
PATCH 1/1 tee: optee: Populate child nodes in probe function
Currently there is no dependency between the "linaro,scmi-optee" driver and the tee_core. If the scmi-optee driver gets probed before the tee_bus_type is initialized, then we will get an unwanted error print.
This patch enables putting scmi-optee nodes as children to the optee node in devicetree, which indirectly creates the missing dependency.
--- drivers/tee/optee/smc_abi.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/tee/optee/smc_abi.c +5 -0
@@ -1533,6 +1533,11 @@ static int optee_probe(struct platform_device *pdev)if (rc) goto err_disable_shm_cache; +/* Populate any dependent child node (if any) */ + rc =devm_of_platform_populate (&pdev->dev); +if (rc) + goto err_disable_shm_cache; +pr_info ("initialized driver\n" );return 0 ;
Signature · 1 line
2.30.2
Quoted 5 lines · Ludvig Pärsson
Currently there is no dependency between the "linaro,scmi-optee" driver and the
tee_core. If the scmi-optee driver gets probed before thetee_bus_typeis initialized, then we will get an unwanted error print.
What error print do you observe? I suppose this case is already handled by scmi optee driver via -EPROBE_DEFER.
-Sumit
Quoted 27 lines
This patch enables putting scmi-optee nodes as children to the optee node in devicetree, which indirectly creates the missing dependency.
Signed-off-by Ludvig Pärsson <[email protected]>--- drivers/tee/optee/smc_abi.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/tee/optee/smc_abi.c +5
-1@@ -1533,6 +1533,11 @@ static int optee_probe(struct platform_device *pdev)if (rc) goto err_disable_shm_cache; +/* Populate any dependent child node (if any) */ + rc =devm_of_platform_populate (&pdev->dev); +if (rc) + goto err_disable_shm_cache; +pr_info ("initialized driver\n" );return 0 ; --2.30.2
Quoted 10 lines · Sumit Garg
Quoted 7 lines · Ludvig Pärsson
Currently there is no dependency between the "linaro,scmi-optee" driver
and thetee_core. If the scmi-optee driver gets probed before thetee_bus_typeis initialized, then we will get an unwanted error print.
Quoted 5 lines
What error print do you observe? I suppose this case is already handled by scmi optee driver via -EPROBE_DEFER.
-Sumit
Hi Sumit,
The error print is in driver_register().
This is kind of what happens:scmi_driver_init()scmi_probe()
scmi_optee_link_supplier()
scmi_optee_init()
driver_register() <--- pr_err() if tee_bus_type is not
initializedtee_init() <--- tee_bus_type gets initialized here
The scmi_optee_link_supplier() will always return -EPROBE_DEFER the first time because scmi_optee_private is initialized in scmi_optee_service_probe, which is only called after the driver is registered in scmi_optee_init. Right now the driver_register fails because tee_bus_type is not initialized which is printing the unwanted error print. Another side effect of this is that scmi_optee_link_supplier() will return -EPROBE_DEFER a second time, and scmi_probe will be successful the third time instead of the second time.
BR,
Ludvig
Quoted 31 lines
Quoted 31 lines
This patch enables putting scmi-optee nodes as children to the optee
node in devicetree, which indirectly creates the missing dependency.Signed-off-by Ludvig Pärsson <[email protected]>---
drivers/tee/optee/smc_abi.c | 5 +++++1 file changed, 5 insertions(+)drivers/tee/optee/smc_abi.c +5
-1@@ -1533,6 +1533,11 @@ static int optee_probe(struct platform_device *pdev) if (rc) goto err_disable_shm_cache; + /* Populate any dependent child node (if any) */ + rc = devm_of_platform_populate(&pdev->dev); + if (rc) + goto err_disable_shm_cache; + pr_info("initialized driver\n"); return 0; --2.30.2
Quoted 30 lines · Ludvig Pärsson
Quoted 10 lines · Sumit Garg
Quoted 7 lines · Ludvig Pärsson
Currently there is no dependency between the "linaro,scmi-optee" driver
and thetee_core. If the scmi-optee driver gets probed before thetee_bus_typeis initialized, then we will get an unwanted error print.Quoted 5 lines
What error print do you observe? I suppose this case is already handled by scmi optee driver via -EPROBE_DEFER.
-Sumit
Hi Sumit,
The error print is in
driver_register().This is kind of what happens:
scmi_driver_init()scmi_probe()
scmi_optee_link_supplier()
scmi_optee_init()
driver_register()<---pr_err()iftee_bus_typeis not
initializedtee_init()<---tee_bus_typegets initialized here
Quoted 9 lines
The
scmi_optee_link_supplier()will always return -EPROBE_DEFER the first time becausescmi_optee_privateis initialized inscmi_optee_service_probe, which is only called after the driver is registered inscmi_optee_init. Right now thedriver_registerfails becausetee_bus_typeis not initialized which is printing the unwanted error print. Another side effect of this is thatscmi_optee_link_supplier()will return -EPROBE_DEFER a second time, andscmi_probewill be successful the third time instead of the second time.
Thanks for the report. It rather looks like an inter subsystem dependency problem. Check if this [1] patch resolves your problem?
[1] https://lkml.org/lkml/2022/11/11/329
-Sumit
Quoted 36 lines
BR,
LudvigQuoted 31 lines
Quoted 31 lines
This patch enables putting scmi-optee nodes as children to the optee
node in devicetree, which indirectly creates the missing dependency.Signed-off-by Ludvig Pärsson <[email protected]>--- drivers/tee/optee/smc_abi.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/tee/optee/smc_abi.c +5
-1@@ -1533,6 +1533,11 @@ static int optee_probe(struct platform_device *pdev)if (rc) goto err_disable_shm_cache; +/* Populate any dependent child node (if any) */ + rc =devm_of_platform_populate (&pdev->dev); +if (rc) + goto err_disable_shm_cache; +pr_info ("initialized driver\n" );return 0 ; --2.30.2
Quoted 47 lines · Sumit Garg
Quoted 33 lines · Ludvig Pärsson
Quoted 13 lines · Sumit Garg
Quoted 9 lines · Ludvig Pärsson
Currently there is no dependency between the "linaro,scmi- optee"
driver
and thetee_core. If the scmi-optee driver gets probed before thetee_bus_typeis initialized, then we will get an unwanted error print.Quoted 5 lines
What error print do you observe? I suppose this case is already handled by scmi optee driver via -EPROBE_DEFER.
-Sumit
Hi Sumit,
The error print is in
driver_register().This is kind of what happens:
scmi_driver_init()scmi_probe()
scmi_optee_link_supplier()
scmi_optee_init()
driver_register()<---pr_err()iftee_bus_typeis not initializedtee_init()<---tee_bus_typegets initialized hereQuoted 11 lines
The
scmi_optee_link_supplier()will always return -EPROBE_DEFER the first time becausescmi_optee_privateis initialized inscmi_optee_service_probe, which is only called after the driver is registered inscmi_optee_init. Right now thedriver_registerfails becausetee_bus_typeis not initialized which is printing the unwanted
error print. Another side effect of this is thatscmi_optee_link_supplier()will return -EPROBE_DEFER a second time, andscmi_probewill be successful the third time instead of the second time.
Quoted 7 lines
Thanks for the report. It rather looks like an inter subsystem dependency problem. Check if this [1] patch resolves your problem?
[1] https://lkml.org/lkml/2022/11/11/329
-Sumit
Yes, this solves the problem, but I don't think the maintainer for the SCMI subsystem likes the solution. Earlier this week I discussed this problem with Sudeep, Cristian and Etienne that are CCed in the submission you linked. Changing the initcall level was one of my suggestions which got instantly rejected. We agreed that the solution in the patch i submitted was probably the best one, but maybe they will change their minds.
BR,
Ludvig
Quoted 36 lines
Quoted 36 lines
BR,
LudvigQuoted 31 lines
Quoted 31 lines
This patch enables putting scmi-optee nodes as children to the optee
node in devicetree, which indirectly creates the missing dependency.Signed-off-by Ludvig Pärsson <[email protected]>---
drivers/tee/optee/smc_abi.c | 5 +++++1 file changed, 5 insertions(+)drivers/tee/optee/smc_abi.c +5
-1@@ -1533,6 +1533,11 @@ static int optee_probe(struct platform_device *pdev) if (rc) goto err_disable_shm_cache; + /* Populate any dependent child node (if any) */ + rc = devm_of_platform_populate(&pdev->dev); + if (rc) + goto err_disable_shm_cache; + pr_info("initialized driver\n"); return 0; --2.30.2
Quoted 17 lines · Ludvig Pärsson
Currently there is no dependency between the "linaro,scmi-optee" driver and the
tee_core. If the scmi-optee driver gets probed before thetee_bus_typeis initialized, then we will get an unwanted error print.This patch enables putting scmi-optee nodes as children to the optee node in devicetree, which indirectly creates the missing dependency.
Signed-off-by Ludvig Pärsson <[email protected]>--- drivers/tee/optee/smc_abi.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/tee/optee/smc_abi.c +0
-0
drivers/tee/optee/smc_abi.c static int optee_probe(struct platform_device *pdev) · line 1540
Quoted 8 lines
drivers/tee/optee/smc_abi.c +5
-0@@ -1533,6 +1533,11 @@ static int optee_probe(struct platform_device *pdev)if (rc) goto err_disable_shm_cache; +/* Populate any dependent child node (if any) */ + rc =devm_of_platform_populate (&pdev->dev); +if (rc) + goto err_disable_shm_cache; +
While I agree with idea of populating dependent child nodes from here, I am not sure if it is OK to give error if that fails or to just continue as there may be other users(like the user-space) for the OPTEE in general.
Signature · 2 lines
Regards, Sudeep
Quoted 22 lines · Sudeep Holla
Quoted 20 lines · Ludvig Pärsson
Currently there is no dependency between the "linaro,scmi-optee" driver and the
tee_core. If the scmi-optee driver gets probed before thetee_bus_typeis initialized, then we will get an unwanted error print.This patch enables putting scmi-optee nodes as children to the optee node in devicetree, which indirectly creates the missing dependency.
Signed-off-by Ludvig Pärsson <[email protected]>--- drivers/tee/optee/smc_abi.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/tee/optee/smc_abi.c +0
-0@@ -1533,6 +1533,11 @@ static int optee_probe(struct platform_device *pdev)if (rc) goto err_disable_shm_cache;
Quoted 10 lines
drivers/tee/optee/smc_abi.c static int optee_probe(struct platform_device *pdev) · line 1540
Quoted 5 lines
drivers/tee/optee/smc_abi.c +5
-0+/* Populate any dependent child node (if any) */ + rc =devm_of_platform_populate (&pdev->dev); +if (rc) + goto err_disable_shm_cache; +While I agree with idea of populating dependent child nodes from here, I am not sure if it is OK to give error if that fails or to just continue as there may be other users(like the user-space) for the OPTEE in general.
This uncertainty is simply because the inter subsystem dependency issue can't be resolved by this. See my comment regarding FF-A ABI on the other thread [1]
[1] https://lkml.org/lkml/2022/11/14/29
-Sumit
Quoted 3 lines
--
Regards,
Sudeep