Message ID | 20221109160708.507481-1-ludvig.parsson@axis.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422253wru; Wed, 9 Nov 2022 08:10:03 -0800 (PST) X-Google-Smtp-Source: AMsMyM7VycbCO44f+niQdbGyZim5ezYElLJGJ+D4kwYxdz/9905TlKYMFDFmmRz5Gv9BRhDgshT4 X-Received: by 2002:a17:907:802:b0:781:8017:b2df with SMTP id wv2-20020a170907080200b007818017b2dfmr57851686ejb.606.1668010203091; Wed, 09 Nov 2022 08:10:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668010203; cv=none; d=google.com; s=arc-20160816; b=vrlgVjAR5JfT1XMB2thgrOzwtgnjbpvOqsIOTVXXAsOZX7H/jz+fXGTrpwYbp75+bD foCj5arjVpiST3/JLMjtwR5x0BBCsxg9ZCQ/u7YTiMOTrVMsMmtBK0OjTMcF3kHxWQer J4B9oBOZHPSxfqSdDSri3Mjrl39AuxIBC8McNrQv8ai1YpxfUPnzmAJapHjegYatmPB2 mH308/HFMYm4K/GA/RT5ddEkEIGkTfWrn2Erb+DLxXDJQcG8+3pCYsNlFLCZyJyntkts a/0j4FYQk+fnRsvfGQh9nnDno7fCAzvDNnogsLqRK3yPQEhEZKUAwG/zFgoOoISJZjK3 FJFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=YgabzxKTXgysBcMfO1IfjanutclXzioMtt7d8m0oLoE=; b=QCGmkZ0JYuxvB//aYSou3s1sJ4m/imDoFitMXAfN9/YE8NmOdf6d48wlmU2ZEIu66A pnn7L0InGUNv9/32YL84Ma+EVnbQr3AcNz2oMZ8RyulD6sG9/GueKZ0hMfxC6ei3zx9K ccPLDij4Peq1PzelRCeg3mzUba7jSd5Yejau+1116j2PEcTMfEN0HtvEmNjIX1Hbr21C N0pBntsnPoyzcPsyK10ONCXQ8R/1TFF4e/+efjfEUD9Gasa0VFHwIsquxP0kTbtifIEo s7rJe0L3tLCwMxVsmWSwh7CvLZxLxoaOLSNY80EhIGF/Raep7dOCmntb69D/DR9kfYZ+ Wpsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=Nqxhv9yh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020aa7c908000000b004593c35a8bcsi13980522edt.214.2022.11.09.08.09.38; Wed, 09 Nov 2022 08:10:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=Nqxhv9yh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230356AbiKIQH3 (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Wed, 9 Nov 2022 11:07:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbiKIQH2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 9 Nov 2022 11:07:28 -0500 Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DB6120F53 for <linux-kernel@vger.kernel.org>; Wed, 9 Nov 2022 08:07:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1668010046; x=1699546046; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=YgabzxKTXgysBcMfO1IfjanutclXzioMtt7d8m0oLoE=; b=Nqxhv9yhr1XAjrbDa00ZEOjdWBPN8fNZS/NnhGET3Qc4do3kQYAv/OOx 9ze8XChcC6Lcx9mZmNcRlM7hfmr5pPo1jAFHzQVSyRNb1eXJUBh2Qgfc4 2l1H4rifEtd9XwcQEpAUEida8KxedmV416sTfKkanLKORBxEUTgrmbs6R Ej5ovwFTCoCfck/dgaLHTr4aFRBpqxcyimh7wzrC5LRYKvq1qJdgO9H3R Vo+kDULP+XbgwZqsSN4deM7kHE1I/YbkBj6dYMCjlbbXd0huHpXVVHbc7 OeSgIVEVFjQJ6PNYET8MWj56H7CVsP69+F3khraBGhzqwVgPeC4T+2YFq g==; From: =?utf-8?q?Ludvig_P=C3=A4rsson?= <ludvig.parsson@axis.com> To: Jens Wiklander <jens.wiklander@linaro.org> CC: <kernel@axis.com>, =?utf-8?q?Ludvig_P=C3=A4rsson?= <ludvig.parsson@axis.com>, Sumit Garg <sumit.garg@linaro.org>, <op-tee@lists.trustedfirmware.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH] tee: optee: Populate child nodes in probe function Date: Wed, 9 Nov 2022 17:07:08 +0100 Message-ID: <20221109160708.507481-1-ludvig.parsson@axis.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749035466339428373?= X-GMAIL-MSGID: =?utf-8?q?1749035466339428373?= |
Series |
tee: optee: Populate child nodes in probe function
|
|
Commit Message
Ludvig Pärsson
Nov. 9, 2022, 4:07 p.m. UTC
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.
Signed-off-by: Ludvig Pärsson <ludvig.parsson@axis.com>
---
drivers/tee/optee/smc_abi.c | 5 +++++
1 file changed, 5 insertions(+)
Comments
On Wed, 9 Nov 2022 at 21:37, Ludvig Pärsson <ludvig.parsson@axis.com> wrote: > > 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. > What error print do you observe? I suppose this case is already handled by scmi optee driver via -EPROBE_DEFER. -Sumit > 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 <ludvig.parsson@axis.com> > --- > drivers/tee/optee/smc_abi.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c > index a1c1fa1a9c28..be6f02fd5a7f 100644 > --- a/drivers/tee/optee/smc_abi.c > +++ b/drivers/tee/optee/smc_abi.c > @@ -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 >
On Thu, 2022-11-10 at 16:23 +0530, Sumit Garg wrote: > On Wed, 9 Nov 2022 at 21:37, Ludvig Pärsson <ludvig.parsson@axis.com> > wrote: > > > > 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. > > > > 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 initialized tee_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 > > 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 <ludvig.parsson@axis.com> > > --- > > drivers/tee/optee/smc_abi.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/tee/optee/smc_abi.c > > b/drivers/tee/optee/smc_abi.c > > index a1c1fa1a9c28..be6f02fd5a7f 100644 > > --- a/drivers/tee/optee/smc_abi.c > > +++ b/drivers/tee/optee/smc_abi.c > > @@ -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 > >
On Thu, 10 Nov 2022 at 17:39, Ludvig Pärsson <Ludvig.Parsson@axis.com> wrote: > > On Thu, 2022-11-10 at 16:23 +0530, Sumit Garg wrote: > > On Wed, 9 Nov 2022 at 21:37, Ludvig Pärsson <ludvig.parsson@axis.com> > > wrote: > > > > > > 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. > > > > > > > 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 > initialized > tee_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. 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 > > BR, > Ludvig > > > > 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 <ludvig.parsson@axis.com> > > > --- > > > drivers/tee/optee/smc_abi.c | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/drivers/tee/optee/smc_abi.c > > > b/drivers/tee/optee/smc_abi.c > > > index a1c1fa1a9c28..be6f02fd5a7f 100644 > > > --- a/drivers/tee/optee/smc_abi.c > > > +++ b/drivers/tee/optee/smc_abi.c > > > @@ -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 > > > >
On Fri, 2022-11-11 at 15:27 +0530, Sumit Garg wrote: > On Thu, 10 Nov 2022 at 17:39, Ludvig Pärsson > <Ludvig.Parsson@axis.com> wrote: > > > > On Thu, 2022-11-10 at 16:23 +0530, Sumit Garg wrote: > > > On Wed, 9 Nov 2022 at 21:37, Ludvig Pärsson < > > > ludvig.parsson@axis.com> > > > wrote: > > > > > > > > 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. > > > > > > > > > > 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 > > initialized > > tee_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. > > 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 > > > > BR, > > Ludvig > > > > > > 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 <ludvig.parsson@axis.com> > > > > --- > > > > drivers/tee/optee/smc_abi.c | 5 +++++ > > > > 1 file changed, 5 insertions(+) > > > > > > > > diff --git a/drivers/tee/optee/smc_abi.c > > > > b/drivers/tee/optee/smc_abi.c > > > > index a1c1fa1a9c28..be6f02fd5a7f 100644 > > > > --- a/drivers/tee/optee/smc_abi.c > > > > +++ b/drivers/tee/optee/smc_abi.c > > > > @@ -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 > > > > > >
On Wed, Nov 09, 2022 at 05:07:08PM +0100, Ludvig Pärsson wrote: > 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. > > Signed-off-by: Ludvig Pärsson <ludvig.parsson@axis.com> > --- > drivers/tee/optee/smc_abi.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c > index a1c1fa1a9c28..be6f02fd5a7f 100644 > --- a/drivers/tee/optee/smc_abi.c > +++ b/drivers/tee/optee/smc_abi.c > @@ -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.
On Fri, 11 Nov 2022 at 21:43, Sudeep Holla <sudeep.holla@arm.com> wrote: > > On Wed, Nov 09, 2022 at 05:07:08PM +0100, Ludvig Pärsson wrote: > > 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. > > > > Signed-off-by: Ludvig Pärsson <ludvig.parsson@axis.com> > > --- > > drivers/tee/optee/smc_abi.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c > > index a1c1fa1a9c28..be6f02fd5a7f 100644 > > --- a/drivers/tee/optee/smc_abi.c > > +++ b/drivers/tee/optee/smc_abi.c > > @@ -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. > 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 > -- > Regards, > Sudeep
diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c index a1c1fa1a9c28..be6f02fd5a7f 100644 --- a/drivers/tee/optee/smc_abi.c +++ b/drivers/tee/optee/smc_abi.c @@ -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;