From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Stephan Gerhold <stephan@gerhold.net>
Cc: Bjorn Andersson <andersson@kernel.org>,
Andy Gross <agross@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org
Subject: Re: [PATCH 09/14] rpmsg: qcom_smd: Use qcom_smem_is_available()
Date: Mon, 5 Jun 2023 21:45:36 +0200 [thread overview]
Message-ID: <909e2780-80d1-3c9d-7be3-bd2d0c0c6e69@linaro.org> (raw)
In-Reply-To: <ZH407yP8RQmTlQtf@gerhold.net>
On 5.06.2023 21:18, Stephan Gerhold wrote:
> On Mon, Jun 05, 2023 at 08:56:44PM +0200, Konrad Dybcio wrote:
>>
>>
>> On 5.06.2023 09:08, Stephan Gerhold wrote:
>>> Rather than looking up a dummy item from SMEM, use the new
>>> qcom_smem_is_available() function to make the code more clear
>>> (and reduce the overhead slightly).
>>>
>>> Add the same check to qcom_smd_register_edge() as well to ensure that
>>> it only succeeds if SMEM is already available - if a driver calls the
>>> function and SMEM is not available yet then the initial state will be
>>> read incorrectly and the RPMSG devices might never become available.
>>>
>>> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
>>> ---
>>> drivers/rpmsg/qcom_smd.c | 10 +++++-----
>>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
>>> index 7b9c298aa491..43f601c84b4f 100644
>>> --- a/drivers/rpmsg/qcom_smd.c
>>> +++ b/drivers/rpmsg/qcom_smd.c
>>> @@ -1479,6 +1479,9 @@ struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent,
>>> struct qcom_smd_edge *edge;
>>> int ret;
>>>
>>> + if (!qcom_smem_is_available())
>>> + return ERR_PTR(-EPROBE_DEFER);
>>> +
>>> edge = kzalloc(sizeof(*edge), GFP_KERNEL);
>>> if (!edge)
>>> return ERR_PTR(-ENOMEM);
>>> @@ -1553,12 +1556,9 @@ EXPORT_SYMBOL(qcom_smd_unregister_edge);
>>> static int qcom_smd_probe(struct platform_device *pdev)
>>> {
>>> struct device_node *node;
>>> - void *p;
>>>
>>> - /* Wait for smem */
>>> - p = qcom_smem_get(QCOM_SMEM_HOST_ANY, smem_items[0].alloc_tbl_id, NULL);
>>> - if (PTR_ERR(p) == -EPROBE_DEFER)
>>> - return PTR_ERR(p);
>>> + if (!qcom_smem_is_available())
>>> + return -EPROBE_DEFER;
>>>
>>> for_each_available_child_of_node(pdev->dev.of_node, node)
>>> qcom_smd_register_edge(&pdev->dev, node);
>> Hm.. we're not checking the return value here, at all.. Perhaps that
>> could be improved and we could only check for smem presence inside
>> qcom_smd_register_edge()?
>>
>
> I think the goal here it to register as many of the edges as possible,
> so we wouldn't necessarily want to abort if one of them fails. That's
> why it's enough to check for only for a possible -EPROBE_DEFER first.
Hm I guess that's the better option, killing the entire platform (no
rpm = no anything) because one edge failed to register would be not
very user friendly..
>
> But more importantly after this series this is legacy code that exists
> only for backwards compatibility with older DTBs. The probe function
> won't be called for DTBs in mainline anymore. So I think it's not worth
> to improve it much anymore. ;)
Right!
Konrad
>
> Thanks,
> Stephan
next prev parent reply other threads:[~2023-06-05 19:45 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
2023-06-05 7:08 ` [PATCH 01/14] dt-bindings soc: qcom: smd-rpm: Fix sort order Stephan Gerhold
2023-06-06 6:25 ` Krzysztof Kozlowski
2023-06-05 7:08 ` [PATCH 02/14] dt-bindings: soc: qcom: smd-rpm: Add MSM8909 to qcom,smd-channels Stephan Gerhold
2023-06-06 6:26 ` Krzysztof Kozlowski
2023-06-05 7:08 ` [PATCH 03/14] dt-bindings: soc: qcom: smd-rpm: Add some more compatibles Stephan Gerhold
2023-06-06 6:27 ` Krzysztof Kozlowski
2023-06-05 7:08 ` [PATCH 04/14] soc: qcom: smd-rpm: Match rpmsg channel instead of compatible Stephan Gerhold
2023-06-05 18:49 ` Konrad Dybcio
2023-06-05 7:08 ` [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem Stephan Gerhold
2023-06-05 8:33 ` Rob Herring
2023-06-05 9:16 ` Stephan Gerhold
2023-06-06 6:36 ` Krzysztof Kozlowski
2023-06-06 8:55 ` Stephan Gerhold
2023-06-07 8:32 ` Krzysztof Kozlowski
2023-06-05 7:08 ` [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example Stephan Gerhold
2023-06-05 8:33 ` Rob Herring
2023-06-05 9:20 ` Stephan Gerhold
2023-06-06 6:37 ` Krzysztof Kozlowski
2023-06-06 9:06 ` Stephan Gerhold
2023-06-06 9:17 ` Krzysztof Kozlowski
2023-06-05 7:08 ` [PATCH 07/14] dt-bindings: qcom: smd: Mark as deprecated Stephan Gerhold
2023-06-05 7:08 ` [PATCH 08/14] soc: qcom: smem: Add qcom_smem_is_available() Stephan Gerhold
2023-06-05 18:53 ` Konrad Dybcio
2023-06-05 19:13 ` Stephan Gerhold
2023-06-05 7:08 ` [PATCH 09/14] rpmsg: qcom_smd: Use qcom_smem_is_available() Stephan Gerhold
2023-06-05 18:56 ` Konrad Dybcio
2023-06-05 19:18 ` Stephan Gerhold
2023-06-05 19:45 ` Konrad Dybcio [this message]
2023-06-05 7:08 ` [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver Stephan Gerhold
2023-06-05 19:06 ` Konrad Dybcio
2023-06-05 19:51 ` Stephan Gerhold
2023-06-05 19:55 ` Konrad Dybcio
2023-06-05 20:31 ` kernel test robot
2023-06-05 7:08 ` [PATCH 11/14] arm64: dts: qcom: Add rpm-proc node for SMD platforms Stephan Gerhold
2023-06-05 19:07 ` Konrad Dybcio
2023-06-05 7:08 ` [PATCH 12/14] arm64: dts: qcom: Add rpm-proc node for GLINK gplatforms Stephan Gerhold
2023-06-05 19:43 ` Konrad Dybcio
2023-06-05 19:55 ` Stephan Gerhold
2023-06-05 7:08 ` [PATCH 13/14] ARM: dts: qcom: Add rpm-proc node for SMD platforms Stephan Gerhold
2023-06-05 7:08 ` [PATCH 14/14] ARM: dts: qcom: apq8064: Drop redundant /smd node Stephan Gerhold
2023-06-05 19:00 ` Konrad Dybcio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=909e2780-80d1-3c9d-7be3-bd2d0c0c6e69@linaro.org \
--to=konrad.dybcio@linaro.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=robh+dt@kernel.org \
--cc=stephan@gerhold.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®