Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp919952pxj; Fri, 21 May 2021 02:10:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3lJ2AHqGzPZiVpK4J6HhEW5JVJ+f159bbbnHm2S6sbzx8EwJUXEmTFp4ttDK4ZSOpfPTO X-Received: by 2002:a05:6402:845:: with SMTP id b5mr9784856edz.9.1621588235356; Fri, 21 May 2021 02:10:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621588235; cv=none; d=google.com; s=arc-20160816; b=xiD5/hnX3ansU0oAUoeCH3Nqdf03NSuRyMaHrEFz/yyFVraVc4vK0Hdg21hG5S1yj0 VPkiMzo+Thf9ZJZKF4TvK0niJBhPXAH6RVd8Mqqk+vpMf3S8tuYcVU3VPKJGq0/CqQvX 562vQsGCt/Ojebzhdy79mq6fFxY4XW48UuTyX/kRAb2lyduGdg2Bed2jLNDYOhRQZB9Q S+xzHhu/nLsfNl0p3GQ33BnVhwW3WA2WSg5zS+NN41uQdWcTj8PBb9dLxbipriz0kisT yA3huTy0uAp7w2xu8E0/q6X4mowUS5onYJSwNVY5LM4MzbP/fbjnrbN5rTT8oZ7+J2AZ R47g== 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=buMCqeHtuyOXGkkJdrNGUndmaHGXH2/Q3tPpeh7Q5cA=; b=0XMl39HahYQ2vnyuo+6WyLT38RdXrsYIAyJKW8uKjLAu9kAOgSKFlaTpPvlYLhpr09 OG0o98kd9bCFBiw4UGPl8BDSdTnZ8Zd8R+kmGGCvnG1havpPASAv22o9frJ5ekbRJ0m5 /t7Vef6tn17dTLhWcONcwBICUnqbsfItB8todF12o+8GtMM2pju8I9ynSlFe4i6EwuAq FqoEl2ArQDnniW3/RBzOxyEFLibLgy9LyyOvuyHim1xhIhrI3uAaX7TzlKbjDoQX9WHb j6ia74s/1SqGqh+MrFIahac5KBa4vUbYwy6zCP9iv6gBSXq15CZgCUOtFGEiH1pcsJHQ H4Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hT2PUE9p; 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 z7si4595278edq.422.2021.05.21.02.10.11; Fri, 21 May 2021 02:10:35 -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=hT2PUE9p; 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 S237980AbhEUB7I (ORCPT + 99 others); Thu, 20 May 2021 21:59:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237361AbhEUB7I (ORCPT ); Thu, 20 May 2021 21:59:08 -0400 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47A91C061763 for ; Thu, 20 May 2021 18:57:46 -0700 (PDT) Received: by mail-qt1-x82a.google.com with SMTP id c10so14292986qtx.10 for ; Thu, 20 May 2021 18:57:46 -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=buMCqeHtuyOXGkkJdrNGUndmaHGXH2/Q3tPpeh7Q5cA=; b=hT2PUE9pbBqC/T2A7RTVjvJ1O766UgLwHeIEZJM8DBHFPqQBoZn8X4MrbGh2wDjIak tcQQyXqdxHneAQLSty9xqo4R7U3vAfuTcByWCRfTcpMwL+h+zgGhm6xhwOAmJKTspVh0 +Jk+y2ArCyP5RdULKTjGO67uFJblHvxvZe34rNye+fxoYZhbqtvE3cl0VtF1Q66oPrHe DhfKfaugXta1FsdxFteRefQBZKm8Fdh1oQVMScrykfCe/oUgtkssJ0CjqaF3ad+AHMQb VLSPXzoMFg/1m3/Sx+8J+mJNiwPaVoZGETobFfr4tcJdCAn8u9NL7Hh1Max4vfPTsRLX oDug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; 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=buMCqeHtuyOXGkkJdrNGUndmaHGXH2/Q3tPpeh7Q5cA=; b=OFUp66my8erzQg4ZCmdprHah8CvDJotz+vwOD9rbrdHj6c7XeCNRzn6505lJDCGpd9 6rVNF42VGNOhvCtaSABhl/fBMh8gMsPJKt6O4X3728GksUKGisr1YIe/xaSNUpN7E051 HkHanzQk7/EPfqM7td7RPJ/MU7ZCrioUmW3Y5TvZWMU8tXaGxfba2MbvpfFZ9Jm7NE3U i6laqx/cQgRdUHPQJghAFEa5KOmtVhmWP3S65RXrKDpNNqg207O1zrBWbfuXo3WkjAx8 pu0ZuwC/TsiPo7P3ZnrHi9pFzVaShM7mON8haBLjUvdKMDjJ1jygg9wyis7dmWb8qcrD VP+A== X-Gm-Message-State: AOAM5319iaxE08GG9A6oHR6dlcCVgz8VWxQrU5x87XHYa7R9UnFMbfww 2lHIXDbMsDrV1SYvtB3fPKxDWQ== X-Received: by 2002:ac8:5396:: with SMTP id x22mr8556084qtp.170.1621562265469; Thu, 20 May 2021 18:57:45 -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 p11sm3365920qtl.82.2021.05.20.18.57.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 May 2021 18:57:45 -0700 (PDT) Subject: Re: [PATCH v3 16/17] crypto: qce: Defer probing if BAM dma channel is not yet initialized To: Bhupesh Sharma , linux-arm-msm@vger.kernel.org Cc: Bjorn Andersson , Rob Herring , Andy Gross , Herbert Xu , "David S . Miller" , Stephen Boyd , Michael Turquette , Vinod Koul , dmaengine@vger.kernel.org, linux-clk@vger.kernel.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bhupesh.linux@gmail.com References: <20210519143700.27392-1-bhupesh.sharma@linaro.org> <20210519143700.27392-17-bhupesh.sharma@linaro.org> From: Thara Gopinath Message-ID: Date: Thu, 20 May 2021 21:57:38 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210519143700.27392-17-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 5/19/21 10:36 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. So, I do not understand what issue you faced with the current code ordering. When bam dma is not initialized, qce_dma_request will fail and rest the error path kicks in. To me the correct ordering for enabling a driver is to turn on clocks and interconnect before requesting for dma. Unless, there is a specific issue, I will ask for that order to be maintained. Warm Regards Thara > > Cc: Thara Gopinath > Cc: Bjorn Andersson > Cc: Rob Herring > Cc: Andy Gross > Cc: Herbert Xu > Cc: David S. Miller > Cc: Stephen Boyd > Cc: Michael Turquette > Cc: Vinod Koul > Cc: dmaengine@vger.kernel.org > Cc: linux-clk@vger.kernel.org > Cc: linux-crypto@vger.kernel.org > Cc: devicetree@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: bhupesh.linux@gmail.com > Signed-off-by: Bhupesh Sharma > --- > drivers/crypto/qce/core.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c > index 8b3e2b4580c2..207221d5b996 100644 > --- a/drivers/crypto/qce/core.c > +++ b/drivers/crypto/qce/core.c > @@ -218,6 +218,14 @@ static int qce_crypto_probe(struct platform_device *pdev) > if (ret < 0) > goto err_out; > > + /* 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 = devm_of_icc_get(qce->dev, "memory"); > if (IS_ERR(qce->mem_path)) > return dev_err_probe(dev, PTR_ERR(qce->mem_path), > @@ -269,10 +277,6 @@ static int qce_crypto_probe(struct platform_device *pdev) > 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; > @@ -287,12 +291,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: >