mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Stephan Gerhold <stephan.gerhold@linaro.org>,
	Vinod Koul <vkoul@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Andy Gross <agross@kernel.org>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Yuvaraj Ranganathan <quic_yrangana@quicinc.com>,
	Anusha Rao <quic_anusha@quicinc.com>,
	Md Sadre Alam <quic_mdalam@quicinc.com>,
	linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Luca Weiss <luca.weiss@fairphone.com>
Subject: Re: [PATCH 8/8] dmaengine: qcom: bam_dma: Fix DT error handling for num-channels/ees
Date: Wed, 12 Feb 2025 23:19:10 +0100	[thread overview]
Message-ID: <a967c354-cb33-402a-8be5-2a89a5108946@oss.qualcomm.com> (raw)
In-Reply-To: <20250212-bam-dma-fixes-v1-8-f560889e65d8@linaro.org>

On 12.02.2025 6:03 PM, Stephan Gerhold wrote:
> When we don't have a clock specified in the device tree, we have no way to
> ensure the BAM is on. This is often the case for remotely-controlled or
> remotely-powered BAM instances. In this case, we need to read num-channels
> from the DT to have all the necessary information to complete probing.
> 
> However, at the moment invalid device trees without clock and without
> num-channels still continue probing, because the error handling is missing
> return statements. The driver will then later try to read the number of
> channels from the registers. This is unsafe, because it relies on boot
> firmware and lucky timing to succeed. Unfortunately, the lack of proper
> error handling here has been abused for several Qualcomm SoCs upstream,
> causing early boot crashes in several situations [1, 2].
> 
> Avoid these early crashes by erroring out when any of the required DT
> properties are missing. Note that this will break some of the existing DTs
> upstream (mainly BAM instances related to the crypto engine). However,
> clearly these DTs have never been tested properly, since the error in the
> kernel log was just ignored. It's safer to disable the crypto engine for
> these broken DTBs.
> 
> [1]: https://lore.kernel.org/r/CY01EKQVWE36.B9X5TDXAREPF@fairphone.com/
> [2]: https://lore.kernel.org/r/20230626145959.646747-1-krzysztof.kozlowski@linaro.org/
> 
> Cc: stable@vger.kernel.org
> Fixes: 48d163b1aa6e ("dmaengine: qcom: bam_dma: get num-channels and num-ees from dt")
> Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
> ---
>  drivers/dma/qcom/bam_dma.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
> index c14557efd577046adc74fa83fd45eb239977b5fa..a2f1f8902c7f88398a5412e8673e24b3c10bb86f 100644
> --- a/drivers/dma/qcom/bam_dma.c
> +++ b/drivers/dma/qcom/bam_dma.c
> @@ -1291,13 +1291,17 @@ static int bam_dma_probe(struct platform_device *pdev)
>  	if (!bdev->bamclk) {
>  		ret = of_property_read_u32(pdev->dev.of_node, "num-channels",
>  					   &bdev->num_channels);
> -		if (ret)
> +		if (ret) {
>  			dev_err(bdev->dev, "num-channels unspecified in dt\n");
> +			return ret;
> +		}
>  
>  		ret = of_property_read_u32(pdev->dev.of_node, "qcom,num-ees",
>  					   &bdev->num_ees);
> -		if (ret)
> +		if (ret) {
>  			dev_err(bdev->dev, "num-ees unspecified in dt\n");
> +			return ret;
> +		}

I like dev_err_probe, but this works too

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

  reply	other threads:[~2025-02-12 22:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12 17:03 [PATCH 0/8] " Stephan Gerhold
2025-02-12 17:03 ` [PATCH 1/8] arm64: dts: qcom: sm8350: Reenable crypto & cryptobam Stephan Gerhold
2025-02-12 17:03 ` [PATCH 2/8] arm64: dts: qcom: sm8450: Add missing properties for cryptobam Stephan Gerhold
2025-02-12 17:03 ` [PATCH 3/8] arm64: dts: qcom: sm8550: " Stephan Gerhold
2025-08-11  7:50   ` Neil Armstrong
2025-02-12 17:03 ` [PATCH 4/8] arm64: dts: qcom: sm8650: " Stephan Gerhold
2025-08-11  7:51   ` Neil Armstrong
2025-02-12 17:03 ` [PATCH 5/8] arm64: dts: qcom: sa8775p: " Stephan Gerhold
2025-02-12 17:03 ` [PATCH 6/8] arm64: dts: qcom: ipq9574: " Stephan Gerhold
2025-02-12 17:03 ` [PATCH 7/8] dt-bindings: dma: qcom: bam-dma: Add missing required properties Stephan Gerhold
2025-02-12 21:01   ` Konrad Dybcio
2025-02-13  9:13     ` Stephan Gerhold
2025-02-13 14:00       ` Konrad Dybcio
2025-02-13 15:22         ` Stephan Gerhold
2025-02-13 16:06           ` Konrad Dybcio
2025-02-19 22:27           ` Rob Herring
2025-02-20 10:09             ` Stephan Gerhold
2025-02-12 17:03 ` [PATCH 8/8] dmaengine: qcom: bam_dma: Fix DT error handling for num-channels/ees Stephan Gerhold
2025-02-12 22:19   ` Konrad Dybcio [this message]
2025-03-14 20:01 ` (subset) [PATCH 0/8] " Bjorn Andersson
2025-07-28  9:36 ` Vinod Koul
2025-08-05  4:58 ` Vinod Koul

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=a967c354-cb33-402a-8be5-2a89a5108946@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.weiss@fairphone.com \
    --cc=neil.armstrong@linaro.org \
    --cc=quic_anusha@quicinc.com \
    --cc=quic_mdalam@quicinc.com \
    --cc=quic_yrangana@quicinc.com \
    --cc=robh@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=stephan.gerhold@linaro.org \
    --cc=vkoul@kernel.org \
    /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®