Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3618910pxb; Sun, 24 Oct 2021 06:54:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLfJ0i1dTYDAi0Ma44QQ29DApv1HswgOcjhsXMVcQpfTUSlfYji0zC66seJKkoy2NTsQiG X-Received: by 2002:a17:902:8bc3:b0:13e:9d00:a8f5 with SMTP id r3-20020a1709028bc300b0013e9d00a8f5mr11164083plo.79.1635083685115; Sun, 24 Oct 2021 06:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635083685; cv=none; d=google.com; s=arc-20160816; b=Zksz5MLXFVzTjoW0FpTrt0zB8Xx/za6N/AL7LVSeURNXFPI8Y7ZSuTQ6UOvfB+/EpG B9F/HC/4EfSp23YwmEysmfZh2Ifz5I08pO/KpaZnM3vVeka3hp328haKHbV2yIg1/y4n dJqu+rS7XUh/SBuGHlvP/ngTZj9LzWrfjnDKY2k5dT5fqA29WLjj7h/hTzOP4NfivlVa OZM+f2hEnegxlmVkv8B2k5Y8+/bQyXHZgJMbRmwRowqheuMWhtj5PDhgDWrtADkl3aUD mQHrez2hnrG+6XhtJvOJc6dljUDD8Vb1F7+qhXm8zC1EhBP5J7jb9bCAV6iSZhjFS5Xv wrXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cSsCh3PPVoUec6DmE2VMaXlfCFFc0zjGafS8ErHKy+Y=; b=psUM3s1mKSvcZoknspJq6TxN5+33MzRzsYEU5FAek2CXzsESzfj7y4g1qTz2KzzBKu FuD8YFJr/1rvx6IXYK/PK7kFnIij2yNIvgPxIpF8cGYGDbh/0gWP3Y4hCyk809DYo/1g 249FQCLtia/pzQJw+EIm0gBWszybt2uNsnc3AhLfboTRET63M0m8zozp5mIj7fFlv4Ok EdflBaOSGC0ASzg2lZUh2nvn42TjIL1p93M9FaEU4w/yukvnZgfRTqb5ercT/g/ig0TM I9mLslZDIiu3MWY7K1LCQZARq+i7/RPuP9a30StFkzzaKZns/kyO7AsS0R/1guHSGiTk SSWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p1fSY9Yq; 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 w4si19262613ply.108.2021.10.24.06.54.32; Sun, 24 Oct 2021 06:54:45 -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=p1fSY9Yq; 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 S231574AbhJXNzw (ORCPT + 99 others); Sun, 24 Oct 2021 09:55:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231372AbhJXNzr (ORCPT ); Sun, 24 Oct 2021 09:55:47 -0400 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16029C061243 for ; Sun, 24 Oct 2021 06:53:27 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id z126so11831240oiz.12 for ; Sun, 24 Oct 2021 06:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cSsCh3PPVoUec6DmE2VMaXlfCFFc0zjGafS8ErHKy+Y=; b=p1fSY9YqUh39fi590Ec1L8+OuyheR1Myhgq2knUpbe7qZs7CVAhRnOWYEuhK5Zl9/W fRNZnv23OZFn6RM8KpjzgcHzS0Oqq7X3NUwzicnch1cMJgGDMwrjYPbchIYMfO6KFyhX u5ArevZEf8Sq0lObqK23AVtLaRaj5ZOE5YprsXkj1lqK6FW4pWvK8TVKMb1JWjoK/UPf FV3FpO1JJJQJNSn5OHvU2K3qdH5CTYlti1bdbnk4lg+2J4TN59d0aTNo3r5MJq5BbZua wpT/GLjgIklzM3BNi8H/gDr/aqmsRnIOr5i6ZgNnPiW9wSQhFaCn3XAWJgr7m7BpCLmy vRGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cSsCh3PPVoUec6DmE2VMaXlfCFFc0zjGafS8ErHKy+Y=; b=L8IX+lru2Jh2dV6WqB87Zoc2xD9Sb138H/FOnoa1to0N4Wj2Mx4RkW9OJHRNGsZiIE u8P6LaZLvO0r4S7U35H3dVGRC9h51zwCHHnLw+00EvdZv4v6H7bzyIwTx1QcL7P7IQK5 3yhOEK55WhOl9JBzEnk47Wi0X45VmMhiJxKt7zmnp4sJYXsb+CkhBO3j9SAjpqumCsSx rzhUkPmD1zCf7FDsjlvzmT2a1UCXiLK35l8G2MSw8R/2GKSTdpZTmU2N/2TcxLEGksj6 PYIQWVjK+3fAvUBBVd28m3FUZ0AbD9pOxr9IKNeM+44SRwISeWsN74vVRXEGhMhyWLm4 OlIQ== X-Gm-Message-State: AOAM532UGTml8Nmv5tRJ9HQXSxLrPPFrZk111EP6vEvtWA6D+cQk0s5T P9s80DyGpx+YqQY+jJwYBkCzTROkYjXJx8nQyphJjg== X-Received: by 2002:a05:6808:181c:: with SMTP id bh28mr18806334oib.12.1635083605824; Sun, 24 Oct 2021 06:53:25 -0700 (PDT) MIME-Version: 1.0 References: <20211013105541.68045-1-bhupesh.sharma@linaro.org> <20211013105541.68045-15-bhupesh.sharma@linaro.org> <8f7eee67-7394-4938-7ace-f1dee397db2b@linaro.org> In-Reply-To: <8f7eee67-7394-4938-7ace-f1dee397db2b@linaro.org> From: Bhupesh Sharma Date: Sun, 24 Oct 2021 19:23:14 +0530 Message-ID: Subject: Re: [PATCH v4 14/20] crypto: qce: core: Add support to initialize interconnect path To: Vladimir Zapolskiy Cc: MSM , linux-crypto@vger.kernel.org, bhupesh.linux@gmail.com, Linux Kernel Mailing List , devicetree , Rob Herring , Andy Gross , Herbert Xu , "David S . Miller" , Thara Gopinath , Bjorn Andersson Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Vladimir, On Thu, 14 Oct 2021 at 00:49, Vladimir Zapolskiy wrote: > > Hi Bhupesh, > > On 10/13/21 1:55 PM, Bhupesh Sharma wrote: > > From: Thara Gopinath > > > > Crypto engine on certain Snapdragon processors like sm8150, sm8250, sm8350 > > etc. requires interconnect path between the engine and memory to be > > explicitly enabled and bandwidth set prior to any operations. Add support > > in the qce core to enable the interconnect path appropriately. > > > > Cc: Bjorn Andersson > > Cc: Rob Herring > > Signed-off-by: Bhupesh Sharma > > [Make header file inclusion alphabetical] > > Signed-off-by: Thara Gopinath > > --- > > drivers/crypto/qce/core.c | 35 ++++++++++++++++++++++++++++------- > > drivers/crypto/qce/core.h | 1 + > > 2 files changed, 29 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c > > index d3780be44a76..033c7278aa5d 100644 > > --- a/drivers/crypto/qce/core.c > > +++ b/drivers/crypto/qce/core.c > > @@ -5,6 +5,7 @@ > > > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -22,6 +23,8 @@ > > #define QCE_MAJOR_VERSION5 0x05 > > #define QCE_QUEUE_LENGTH 1 > > > > +#define QCE_DEFAULT_MEM_BANDWIDTH 393600 > > + > > static const struct qce_algo_ops *qce_ops[] = { > > #ifdef CONFIG_CRYPTO_DEV_QCE_SKCIPHER > > &skcipher_ops, > > @@ -206,21 +209,35 @@ static int qce_crypto_probe(struct platform_device *pdev) > > if (ret < 0) > > return ret; > > > > + qce->mem_path = of_icc_get(qce->dev, "memory"); > > Please consider to use devm_of_icc_get() here also. Thanks, I will fix this in the v5. Regards, Bhupesh > > + if (IS_ERR(qce->mem_path)) > > + return PTR_ERR(qce->mem_path); > > + > > qce->core = devm_clk_get(qce->dev, "core"); > > - if (IS_ERR(qce->core)) > > - return PTR_ERR(qce->core); > > + if (IS_ERR(qce->core)) { > > + ret = PTR_ERR(qce->core); > > + goto err_mem_path_put; > > + } > > > > qce->iface = devm_clk_get(qce->dev, "iface"); > > - if (IS_ERR(qce->iface)) > > - return PTR_ERR(qce->iface); > > + if (IS_ERR(qce->iface)) { > > + ret = PTR_ERR(qce->iface); > > + goto err_mem_path_put; > > + } > > > > qce->bus = devm_clk_get(qce->dev, "bus"); > > - if (IS_ERR(qce->bus)) > > - return PTR_ERR(qce->bus); > > + if (IS_ERR(qce->bus)) { > > + ret = PTR_ERR(qce->bus); > > + goto err_mem_path_put; > > + } > > + > > + ret = icc_set_bw(qce->mem_path, QCE_DEFAULT_MEM_BANDWIDTH, QCE_DEFAULT_MEM_BANDWIDTH); > > + if (ret) > > + goto err_mem_path_put; > > > > ret = clk_prepare_enable(qce->core); > > if (ret) > > - return ret; > > + goto err_mem_path_disable; > > > > ret = clk_prepare_enable(qce->iface); > > if (ret) > > @@ -260,6 +277,10 @@ static int qce_crypto_probe(struct platform_device *pdev) > > clk_disable_unprepare(qce->iface); > > err_clks_core: > > clk_disable_unprepare(qce->core); > > +err_mem_path_disable: > > + icc_set_bw(qce->mem_path, 0, 0); > > +err_mem_path_put: > > + icc_put(qce->mem_path); > > return ret; > > } > > > > diff --git a/drivers/crypto/qce/core.h b/drivers/crypto/qce/core.h > > index 085774cdf641..228fcd69ec51 100644 > > --- a/drivers/crypto/qce/core.h > > +++ b/drivers/crypto/qce/core.h > > @@ -35,6 +35,7 @@ struct qce_device { > > void __iomem *base; > > struct device *dev; > > struct clk *core, *iface, *bus; > > + struct icc_path *mem_path; > > struct qce_dma_data dma; > > int burst_size; > > unsigned int pipe_pair_id; > > > > -- > Best wishes, > Vladimir