Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1543659pxb; Wed, 20 Oct 2021 07:11:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6ry75TtM1TUiN7o2DeN2CFklxwH9zI/Rr9KORlqThcDI1Dl708GqbgTzrjpe0QwOpQBhm X-Received: by 2002:a63:1422:: with SMTP id u34mr213461pgl.130.1634739073750; Wed, 20 Oct 2021 07:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634739073; cv=none; d=google.com; s=arc-20160816; b=Rl9cOGkP/DHvb9fZrAoFTQheDQt/bzMcMc9GO8vXrCUjBRa0OsyXgu7RSfhDjfyiR/ UQhypXjZlb8EDvCpfzp4lyo2pbxPZA/foNguMLFS2Cy18DjTlJJGNxVzU6p2i/03NGEN qBQNB5AJ6Q9adg8Cpbz3Q5h+CGQZlhSlAWuv4S6d4Stmu7j2LzO/Mq8mezYE0QZXkdMq fDoksyC1IFDGEbQH17OoKB6ZWcyFok5ywVXRsHD5gx70JNdG+owuMQqQwiWgMI2LGMzK TvmzKEN90f+TUzAGBfvLgprPtGBDDlRi3qwWXeqa4GvJ/nxmuXs1b2TKor3CG0nsuHNt cXcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=A+7/tYuokduAraYDaM/MNqe/qPgiHwjLTlChysTQILI=; b=iNiG1IN6r5MKyfyLqCZrIY0v+yluhite41DaBVC3t2dKwxOgnp90OzVm3GVSG5gsel I/uPGV5ZtJHx3ftZZ6QuB+O/PeIgPWqbj15IjtVfyLOBIkxWn/IUsG706LOGFiBKF+GR H2nZFRjqpS0cZxF8m1kmLdXq7ZWxnmJ9u/dpBj8JuqQrHA1grCXjZSJE/XQo/yXks2qm aB9YoxtlkFw29beYuFiPFNcrNHzXwk6TAshSqFVvlzINzN5Wp7qZ3NzsnnfqtAjwyPfj rwRK2pMppHV8L7WLXWZeGmMcS5FGw6+QiEqnDD/hbk2KC3BssbrEjB/QDFRiR+GaB20d IX7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fd6AaurL; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x1si3771608pgj.465.2021.10.20.07.10.55; Wed, 20 Oct 2021 07:11:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fd6AaurL; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229842AbhJTOM6 (ORCPT + 99 others); Wed, 20 Oct 2021 10:12:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbhJTOM4 (ORCPT ); Wed, 20 Oct 2021 10:12:56 -0400 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DFC4C061749 for ; Wed, 20 Oct 2021 07:10:41 -0700 (PDT) Received: by mail-qt1-x834.google.com with SMTP id r17so3076728qtx.10 for ; Wed, 20 Oct 2021 07:10:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=A+7/tYuokduAraYDaM/MNqe/qPgiHwjLTlChysTQILI=; b=Fd6AaurLzQDPJogWpED/+njhBQ3CRKq0XqHJwDRFZWQ6++ZyhNIOta2z/xbkRQWN73 Dt/hkKIQHIsJIZlgJaOzu6TtOwOphlh4L0nL0a5Rjkj71JRtxOzu2MgCELlSWZia5B4G ZY/dv+KrrG/F4NX21qGOVdjQBY6LhhwK/4gfO/geSIG0dpF4HSanqLU3H+NEoqCe8z5K iGi/bVr+7ikhfTxSVXfaYkH0N3v6AZn8ODXM2R9A1hdySqkTflzY5xIHG7zSc6wQhXuc JiKJPtF9GbXSBhYis/cLGOHAasts6knNp+ZGoFjrZgBtG0W8ZIUveGsZ320+8GkiU53u xFEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=A+7/tYuokduAraYDaM/MNqe/qPgiHwjLTlChysTQILI=; b=aDqsdLWhXwUNK0lqYjhlNFzahvVZ/XCGE0tZb0d7iP9tJZg5kaRrZ3Bv7Byxwj/4Vc ZMMaJDekFSXy4Afv6vW6UHS0MGvrIFWFpdp9ouTldQs82umjAZsLloZcP2sznmoO+FKn JfqR5raaQwa3JQodUzsi6vFL0qepc8rJOLNdUAEIr1TmZnCS2rIwYwNAXJ1Se0ODcOzG DJfGz6JwmdoPtsVDHIXty2tUf3jQlXPWU1MjDhnLV+q5ScoEf4b50kieUYfN+eiQzBc4 bX1aJhLQC4rZoK7VxXU2ILR5xwboZMbezpT/yIojyzkVRHrLDBqOtILUwyV5LfFWA0S9 rpow== X-Gm-Message-State: AOAM533bVKsRrMgjEKx41d2jgj36ruTW0zaa0aDvp5AvP4VrQ8kNnxEk dzHhwSXw52S3BNzBfnFPUnG6Gg== X-Received: by 2002:ac8:5903:: with SMTP id 3mr195093qty.74.1634739040791; Wed, 20 Oct 2021 07:10:40 -0700 (PDT) Received: from [192.168.1.93] (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.gmail.com with ESMTPSA id m16sm1119634qkn.15.2021.10.20.07.10.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Oct 2021 07:10:40 -0700 (PDT) Subject: Re: [PATCH v4 18/20] crypto: qce: Defer probing if BAM dma channel is not yet initialized To: Bhupesh Sharma , linux-arm-msm@vger.kernel.org, linux-crypto@vger.kernel.org Cc: bhupesh.linux@gmail.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org, agross@kernel.org, herbert@gondor.apana.org.au, davem@davemloft.net, Bjorn Andersson References: <20211013105541.68045-1-bhupesh.sharma@linaro.org> <20211013105541.68045-19-bhupesh.sharma@linaro.org> From: Thara Gopinath Message-ID: Date: Wed, 20 Oct 2021 10:10:39 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20211013105541.68045-19-bhupesh.sharma@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 10/13/21 6:55 AM, Bhupesh Sharma wrote: > Since the Qualcomm qce crypto driver needs the BAM dma driver to be > setup first (to allow crypto operations), it makes sense to defer > the qce crypto driver probing in case the BAM dma driver is not yet > probed. > > Move the code leg requesting dma channels earlier in the > probe() flow. This fixes the qce probe failure issues when both qce > and BMA dma are compiled as static part of the kernel. Hi Bhupesh, I am quite curious to know the nature of probe failure you are seeing with the current sequence. I am not against changing the sequence but for me when a driver is enabled, it is clocks first, interconnect next and then dma. Also I have tested the current sequence on sm8150 with both the modules built in as static and I have not seen the failure. -- Warm Regards Thara (She/Her/Hers) > > Cc: Thara Gopinath > Cc: Bjorn Andersson > Signed-off-by: Bhupesh Sharma > --- > drivers/crypto/qce/core.c | 20 ++++++++++++-------- > 1 file changed, 12 insertions(+), 8 deletions(-) > > diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c > index cb8c77709e1e..c6f686126fc9 100644 > --- a/drivers/crypto/qce/core.c > +++ b/drivers/crypto/qce/core.c > @@ -209,9 +209,19 @@ static int qce_crypto_probe(struct platform_device *pdev) > if (ret < 0) > return ret; > > + /* qce driver requires BAM dma driver to be setup first. > + * In case the dma channel are not set yet, this check > + * helps use to return -EPROBE_DEFER earlier. > + */ > + ret = qce_dma_request(qce->dev, &qce->dma); > + if (ret) > + return ret; > + > qce->mem_path = of_icc_get(qce->dev, "memory"); > - if (IS_ERR(qce->mem_path)) > + if (IS_ERR(qce->mem_path)) { > + qce_dma_release(&qce->dma); > return PTR_ERR(qce->mem_path); > + } > > qce->core = devm_clk_get_optional(qce->dev, "core"); > if (IS_ERR(qce->core)) { > @@ -247,10 +257,6 @@ static int qce_crypto_probe(struct platform_device *pdev) > if (ret) > goto err_clks_iface; > > - ret = qce_dma_request(qce->dev, &qce->dma); > - if (ret) > - goto err_clks; > - > ret = qce_check_version(qce); > if (ret) > goto err_clks; > @@ -265,12 +271,10 @@ static int qce_crypto_probe(struct platform_device *pdev) > > ret = qce_register_algs(qce); > if (ret) > - goto err_dma; > + goto err_clks; > > return 0; > > -err_dma: > - qce_dma_release(&qce->dma); > err_clks: > clk_disable_unprepare(qce->bus); > err_clks_iface: >