Message ID | 20230405072836.1690248-8-bhupesh.sharma@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp122318vqo; Wed, 5 Apr 2023 00:46:34 -0700 (PDT) X-Google-Smtp-Source: AKy350aHi7zcHxqpGuUklxc9pFub1SCuAzuz6sjPlVjPnVr2e/00x5vdqbwxxm3bxlkojEz2P5I9 X-Received: by 2002:a17:903:294e:b0:1a2:2091:ee8b with SMTP id li14-20020a170903294e00b001a22091ee8bmr4876760plb.10.1680680794694; Wed, 05 Apr 2023 00:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680680794; cv=none; d=google.com; s=arc-20160816; b=iMBFW3tOX61uP++lP/lI/+vP63sL0Q+MvpbpM9kImLMbDNp50DeYSNiiKahtEESd56 IS/PwMw5Dh9Gcu+fIPhRbBFTyTRmxAnb18XYzA+oe3qPYD7Dk5+uYfCoZ7e6zucl1BuC urpAuAevaWS3vDXNZuDSR0W0NRp89agRwdeOiQjtBNrAIeU8ZlnJM9RZhxkKxCnktjT/ fWVMPAzv6EG8DuG4dTDZ0FbdZyoOdHNi8QUmijrcbVdI8AY2lagygg4v5S2Oqw9CZozC QEt011QhcLZ8wNj4aCdI3WmIv5RkTp/YKUsW1j+tP1nZFEjhSsz6i5P3k7NICYY6irwQ o/7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PuEDYxPh1iqRLp/0Giai1ZnY3ruEMo64qCfhktsCtAU=; b=AZPzc4inPALCLbe4wxX+KMCCTGarfCPAofpAS6FqVqg6vWCf6LcNDQltYunBN4QkdC 3qT+X2sejkFiEtgUADyhNcTnpqlYvrB9jvD5DSnY/zucgbHuiKZ4/PPaRyQzgi5JLt/C XlshstDco3aKRuOBIHfN2uYLPiBq7jsJJa61fuGSdOeIKYME1VRAvj2IQGUj4ZK10X7f oAKZcDaW7mvqblqdjopsCIbxFjzjwO21bIDLmB0SIjWxMYdevakdocTY+HvjIqlCO1Nu cOuumhNoqBZq76N/kKXTxx64tJ2GzCXSmau3z6tTfJoPqGJRmzUfvQTd5EjYJHq2l31g gPCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ElPO4X4V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p17-20020a1709028a9100b001a1abc91980si11670932plo.211.2023.04.05.00.46.20; Wed, 05 Apr 2023 00:46:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ElPO4X4V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S237166AbjDEHcO (ORCPT <rfc822;lkml4gm@gmail.com> + 99 others); Wed, 5 Apr 2023 03:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237150AbjDEHbq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 5 Apr 2023 03:31:46 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC98859D1 for <linux-kernel@vger.kernel.org>; Wed, 5 Apr 2023 00:31:24 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id n14so17787520plc.8 for <linux-kernel@vger.kernel.org>; Wed, 05 Apr 2023 00:31:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680679884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PuEDYxPh1iqRLp/0Giai1ZnY3ruEMo64qCfhktsCtAU=; b=ElPO4X4VI6hM3TLE2EKMn0hQnqxOq5LnXCJzh/eljphQ7I0O659V/gE47hUOQih6xG /0Q7tWMa2VEyuOd+Qa6NyDazjs/jrasx5a9bFXnR7BLFGayV2zn4Cwx43WxCSeQp9o9I VncHVpVDvSrXpnOHCdqlWm/dEN7lJL9bncJUBzjZ4jTwJKnTy898QFafyHM+P2U4O6FP fU+5yhJkv33XEAjfw+WgDugLQ4KbUj0aMxyH5BZG+8NetNuJmrrB+23e4ZUVoBUwPZEy MYiDOimhwl6Xawau8UjLZP0o1bojBJdSLH8CF9ycDs3DEV8NFVdjFotNENwbUYL+1U0/ 8Rpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680679884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PuEDYxPh1iqRLp/0Giai1ZnY3ruEMo64qCfhktsCtAU=; b=s24qYFAajFdNNqOipaeFTuEPqbd3eFm7ur93fyAcjAZB/GMqX8LK80gznM/mS9+j1h pT5jSJJ79xv8WVSpmnAdWCAN7gjma8Zasau47lTfETqDOhfiqZxr49pW1SXMo+pU549g O9zkq7DU5wEok7hj3QcRhh5C1ch0fVLE1i+uvgJwplp2KhJB+OJ+rxskveE7kw8DRO31 uxiIsn/5ekF6LsxOpNRJB8BC5ex4Sv7A32kOEGGrlS7S46earQRS6vppAwM6A1ZKFFh8 2pGNDeAIKf+jHh25kHizMwOHygWfhaK1+MuIhhaLEvPSxm8O0SglcyTT9s9zhtj2WATs 6JnA== X-Gm-Message-State: AAQBX9djsfVGQ4pq+ve4E/PDJL+Qo+hIRIoT3qOHAJm+YFVTpdVBcao1 p306sQl5TUUnZ2RAVUVAt3k9mA== X-Received: by 2002:a05:6a20:811a:b0:d6:8c70:85ce with SMTP id g26-20020a056a20811a00b000d68c7085cemr4102017pza.54.1680679883953; Wed, 05 Apr 2023 00:31:23 -0700 (PDT) Received: from localhost.localdomain ([223.233.67.41]) by smtp.gmail.com with ESMTPSA id l7-20020a635b47000000b004facdf070d6sm8781507pgm.39.2023.04.05.00.31.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 00:31:23 -0700 (PDT) From: Bhupesh Sharma <bhupesh.sharma@linaro.org> To: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: agross@kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, andersson@kernel.org, bhupesh.sharma@linaro.org, bhupesh.linux@gmail.com, krzysztof.kozlowski@linaro.org, robh+dt@kernel.org, konrad.dybcio@linaro.org, vladimir.zapolskiy@linaro.org, rfoss@kernel.org, neil.armstrong@linaro.org, djakov@kernel.org Subject: [PATCH v6 07/11] arm64: dts: qcom: sm6115: Add Crypto Engine support Date: Wed, 5 Apr 2023 12:58:32 +0530 Message-Id: <20230405072836.1690248-8-bhupesh.sharma@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405072836.1690248-1-bhupesh.sharma@linaro.org> References: <20230405072836.1690248-1-bhupesh.sharma@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762321545186889295?= X-GMAIL-MSGID: =?utf-8?q?1762321545186889295?= |
Series |
arm64: qcom: Enable Crypto Engine for a few Qualcomm SoCs
|
|
Commit Message
Bhupesh Sharma
April 5, 2023, 7:28 a.m. UTC
Add crypto engine (CE) and CE BAM related nodes and definitions to
'sm6115.dtsi'.
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
---
arch/arm64/boot/dts/qcom/sm6115.dtsi | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
Comments
On 5.04.2023 09:28, Bhupesh Sharma wrote: > Add crypto engine (CE) and CE BAM related nodes and definitions to > 'sm6115.dtsi'. > > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> > --- Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Tested-by: Konrad Dybcio <konrad.dybcio@linaro.org> Konrad > arch/arm64/boot/dts/qcom/sm6115.dtsi | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi > index 2a51c938bbcb..ebac026b4cc7 100644 > --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi > +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi > @@ -650,6 +650,28 @@ usb_hsphy: phy@1613000 { > status = "disabled"; > }; > > + cryptobam: dma-controller@1b04000 { > + compatible = "qcom,bam-v1.7.4", "qcom,bam-v1.7.0"; > + reg = <0x0 0x01b04000 0x0 0x24000>; > + interrupts = <GIC_SPI 247 IRQ_TYPE_LEVEL_HIGH>; > + #dma-cells = <1>; > + qcom,ee = <0>; > + qcom,controlled-remotely; > + num-channels = <8>; > + qcom,num-ees = <2>; > + iommus = <&apps_smmu 0x94 0x11>, > + <&apps_smmu 0x96 0x11>; > + }; > + > + crypto: crypto@1b3a000 { > + compatible = "qcom,sm6115-qce", "qcom,sm8150-qce", "qcom,qce"; > + reg = <0x0 0x01b3a000 0x0 0x6000>; > + dmas = <&cryptobam 6>, <&cryptobam 7>; > + dma-names = "rx", "tx"; > + iommus = <&apps_smmu 0x94 0x11>, > + <&apps_smmu 0x96 0x11>; > + }; > + > qfprom@1b40000 { > compatible = "qcom,sm6115-qfprom", "qcom,qfprom"; > reg = <0x0 0x01b40000 0x0 0x7000>;
Hi Bhupesh, Not sure if this is the latest version of this series since it's pretty old but I didn't find a new one. Just came here because you mentioned RB1/RB2 [1] in my bam_dma patch and they don't have any BAM defined upstream yet. [1]: https://lore.kernel.org/linux-arm-msm/CAH=2Ntw0BZH=RGp14mYLhX7D6jV5O5eDKRQbby=uCy85xMDU_g@mail.gmail.com/ On Wed, Apr 05, 2023 at 12:58:32PM +0530, Bhupesh Sharma wrote: > Add crypto engine (CE) and CE BAM related nodes and definitions to > 'sm6115.dtsi'. > > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> > --- > arch/arm64/boot/dts/qcom/sm6115.dtsi | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi > index 2a51c938bbcb..ebac026b4cc7 100644 > --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi > +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi > @@ -650,6 +650,28 @@ usb_hsphy: phy@1613000 { > status = "disabled"; > }; > > + cryptobam: dma-controller@1b04000 { > + compatible = "qcom,bam-v1.7.4", "qcom,bam-v1.7.0"; > + reg = <0x0 0x01b04000 0x0 0x24000>; > + interrupts = <GIC_SPI 247 IRQ_TYPE_LEVEL_HIGH>; > + #dma-cells = <1>; > + qcom,ee = <0>; > + qcom,controlled-remotely; > + num-channels = <8>; > + qcom,num-ees = <2>; > + iommus = <&apps_smmu 0x94 0x11>, > + <&apps_smmu 0x96 0x11>; > + }; > + > + crypto: crypto@1b3a000 { > + compatible = "qcom,sm6115-qce", "qcom,sm8150-qce", "qcom,qce"; > + reg = <0x0 0x01b3a000 0x0 0x6000>; > + dmas = <&cryptobam 6>, <&cryptobam 7>; > + dma-names = "rx", "tx"; > + iommus = <&apps_smmu 0x94 0x11>, > + <&apps_smmu 0x96 0x11>; Shouldn't you have clocks = <&rpmcc RPM_SMD_CE1_CLK> here to make sure the clock for the crypto engine is on? Your binding patch (PATCH 06/11) says "Crypto Engine block on Qualcomm SoCs SM6115 and QCM2290 do not require clocks strictly" but doesn't say why. Make sure you don't rely on having rpmcc keep unused clocks on permanently. This is the case at the moment, but we would like to change this [2]. Adding new users that rely on this broken behavior would just make this effort even more complicated. If you also add the clock to the cryptobam then you should be able to see the advantage of my bam_dma patch [3]. It allows you to drop "num-channels" and "qcom,num-ees" from the cryptobam in your changes above because it can then be read directly from the BAM registers. Thanks, Stephan [2]: https://lore.kernel.org/linux-arm-msm/20230303-topic-rpmcc_sleep-v2-0-ae80a325fe94@linaro.org/ [3]: https://lore.kernel.org/linux-arm-msm/20230518-bamclk-dt-v1-1-82f738c897d9@gerhold.net/
Hi Stephan, On Fri, 19 May 2023 at 15:40, Stephan Gerhold <stephan@gerhold.net> wrote: > > Hi Bhupesh, > > Not sure if this is the latest version of this series since it's pretty > old but I didn't find a new one. Just came here because you mentioned > RB1/RB2 [1] in my bam_dma patch and they don't have any BAM defined > upstream yet. > > [1]: https://lore.kernel.org/linux-arm-msm/CAH=2Ntw0BZH=RGp14mYLhX7D6jV5O5eDKRQbby=uCy85xMDU_g@mail.gmail.com/ > > On Wed, Apr 05, 2023 at 12:58:32PM +0530, Bhupesh Sharma wrote: > > Add crypto engine (CE) and CE BAM related nodes and definitions to > > 'sm6115.dtsi'. > > > > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> > > --- > > arch/arm64/boot/dts/qcom/sm6115.dtsi | 22 ++++++++++++++++++++++ > > 1 file changed, 22 insertions(+) > > > > diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi > > index 2a51c938bbcb..ebac026b4cc7 100644 > > --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi > > +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi > > @@ -650,6 +650,28 @@ usb_hsphy: phy@1613000 { > > status = "disabled"; > > }; > > > > + cryptobam: dma-controller@1b04000 { > > + compatible = "qcom,bam-v1.7.4", "qcom,bam-v1.7.0"; > > + reg = <0x0 0x01b04000 0x0 0x24000>; > > + interrupts = <GIC_SPI 247 IRQ_TYPE_LEVEL_HIGH>; > > + #dma-cells = <1>; > > + qcom,ee = <0>; > > + qcom,controlled-remotely; > > + num-channels = <8>; > > + qcom,num-ees = <2>; > > + iommus = <&apps_smmu 0x94 0x11>, > > + <&apps_smmu 0x96 0x11>; > > + }; > > + > > + crypto: crypto@1b3a000 { > > + compatible = "qcom,sm6115-qce", "qcom,sm8150-qce", "qcom,qce"; > > + reg = <0x0 0x01b3a000 0x0 0x6000>; > > + dmas = <&cryptobam 6>, <&cryptobam 7>; > > + dma-names = "rx", "tx"; > > + iommus = <&apps_smmu 0x94 0x11>, > > + <&apps_smmu 0x96 0x11>; > > Shouldn't you have clocks = <&rpmcc RPM_SMD_CE1_CLK> here to make sure > the clock for the crypto engine is on? Your binding patch (PATCH 06/11) > says "Crypto Engine block on Qualcomm SoCs SM6115 and QCM2290 do not > require clocks strictly" but doesn't say why. > > Make sure you don't rely on having rpmcc keep unused clocks on > permanently. This is the case at the moment, but we would like to change > this [2]. Adding new users that rely on this broken behavior would just > make this effort even more complicated. > > If you also add the clock to the cryptobam then you should be able to > see the advantage of my bam_dma patch [3]. It allows you to drop > "num-channels" and "qcom,num-ees" from the cryptobam in your changes > above because it can then be read directly from the BAM registers. Thanks for pointing this out. Actually that's why I was using your patch while testing with RB1/RB2 :) Yes, so the background is that I am preparing a new version of this crypto enablement patchset. Also your assumption about the clocks being turned on by the firmware is true for RB1/RB2 devices, so enabling them via Linux is optional as per Qualcomm enggs. So, I am testing the new patchset right now with 'clock' entries provided in the .dtsi and see if that causes any issue / improvement (etc.) Will come back with updates (and a new version of this patchset) soon. Regards, Bhupesh > Thanks, > Stephan > > [2]: https://lore.kernel.org/linux-arm-msm/20230303-topic-rpmcc_sleep-v2-0-ae80a325fe94@linaro.org/ > [3]: https://lore.kernel.org/linux-arm-msm/20230518-bamclk-dt-v1-1-82f738c897d9@gerhold.net/
On 19.05.2023 12:22, Bhupesh Sharma wrote: > Hi Stephan, > > On Fri, 19 May 2023 at 15:40, Stephan Gerhold <stephan@gerhold.net> wrote: >> >> Hi Bhupesh, >> >> Not sure if this is the latest version of this series since it's pretty >> old but I didn't find a new one. Just came here because you mentioned >> RB1/RB2 [1] in my bam_dma patch and they don't have any BAM defined >> upstream yet. >> >> [1]: https://lore.kernel.org/linux-arm-msm/CAH=2Ntw0BZH=RGp14mYLhX7D6jV5O5eDKRQbby=uCy85xMDU_g@mail.gmail.com/ >> >> On Wed, Apr 05, 2023 at 12:58:32PM +0530, Bhupesh Sharma wrote: >>> Add crypto engine (CE) and CE BAM related nodes and definitions to >>> 'sm6115.dtsi'. >>> >>> Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> >>> --- >>> arch/arm64/boot/dts/qcom/sm6115.dtsi | 22 ++++++++++++++++++++++ >>> 1 file changed, 22 insertions(+) >>> >>> diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi >>> index 2a51c938bbcb..ebac026b4cc7 100644 >>> --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi >>> +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi >>> @@ -650,6 +650,28 @@ usb_hsphy: phy@1613000 { >>> status = "disabled"; >>> }; >>> >>> + cryptobam: dma-controller@1b04000 { >>> + compatible = "qcom,bam-v1.7.4", "qcom,bam-v1.7.0"; >>> + reg = <0x0 0x01b04000 0x0 0x24000>; >>> + interrupts = <GIC_SPI 247 IRQ_TYPE_LEVEL_HIGH>; >>> + #dma-cells = <1>; >>> + qcom,ee = <0>; >>> + qcom,controlled-remotely; >>> + num-channels = <8>; >>> + qcom,num-ees = <2>; >>> + iommus = <&apps_smmu 0x94 0x11>, >>> + <&apps_smmu 0x96 0x11>; >>> + }; >>> + >>> + crypto: crypto@1b3a000 { >>> + compatible = "qcom,sm6115-qce", "qcom,sm8150-qce", "qcom,qce"; >>> + reg = <0x0 0x01b3a000 0x0 0x6000>; >>> + dmas = <&cryptobam 6>, <&cryptobam 7>; >>> + dma-names = "rx", "tx"; >>> + iommus = <&apps_smmu 0x94 0x11>, >>> + <&apps_smmu 0x96 0x11>; >> >> Shouldn't you have clocks = <&rpmcc RPM_SMD_CE1_CLK> here to make sure >> the clock for the crypto engine is on? Your binding patch (PATCH 06/11) >> says "Crypto Engine block on Qualcomm SoCs SM6115 and QCM2290 do not >> require clocks strictly" but doesn't say why. >> >> Make sure you don't rely on having rpmcc keep unused clocks on >> permanently. This is the case at the moment, but we would like to change >> this [2]. Adding new users that rely on this broken behavior would just >> make this effort even more complicated. >> >> If you also add the clock to the cryptobam then you should be able to >> see the advantage of my bam_dma patch [3]. It allows you to drop >> "num-channels" and "qcom,num-ees" from the cryptobam in your changes >> above because it can then be read directly from the BAM registers. > > Thanks for pointing this out. Actually that's why I was using your > patch while testing with RB1/RB2 :) > > Yes, so the background is that I am preparing a new version of this > crypto enablement patchset. > Also your assumption about the clocks being turned on by the firmware > is true for RB1/RB2 devices, so enabling them via Linux is optional as > per Qualcomm enggs. This is not necessarily true. Currently it's kept always-on on by clk_smd_rpm_handoff, but that's a hack from 10 years ago when smd was still new. > > So, I am testing the new patchset right now with 'clock' entries > provided in the .dtsi and see if that causes any issue / improvement > (etc.) It won't change since it's on anyway, but that won't be a given for long. Konrad > > Will come back with updates (and a new version of this patchset) soon. > > Regards, > Bhupesh > >> Thanks, >> Stephan >> >> [2]: https://lore.kernel.org/linux-arm-msm/20230303-topic-rpmcc_sleep-v2-0-ae80a325fe94@linaro.org/ >> [3]: https://lore.kernel.org/linux-arm-msm/20230518-bamclk-dt-v1-1-82f738c897d9@gerhold.net/
On Fri, 19 May 2023 at 16:12, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > > On 19.05.2023 12:22, Bhupesh Sharma wrote: > > Hi Stephan, > > > > On Fri, 19 May 2023 at 15:40, Stephan Gerhold <stephan@gerhold.net> wrote: > >> > >> Hi Bhupesh, > >> > >> Not sure if this is the latest version of this series since it's pretty > >> old but I didn't find a new one. Just came here because you mentioned > >> RB1/RB2 [1] in my bam_dma patch and they don't have any BAM defined > >> upstream yet. > >> > >> [1]: https://lore.kernel.org/linux-arm-msm/CAH=2Ntw0BZH=RGp14mYLhX7D6jV5O5eDKRQbby=uCy85xMDU_g@mail.gmail.com/ > >> > >> On Wed, Apr 05, 2023 at 12:58:32PM +0530, Bhupesh Sharma wrote: > >>> Add crypto engine (CE) and CE BAM related nodes and definitions to > >>> 'sm6115.dtsi'. > >>> > >>> Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> > >>> --- > >>> arch/arm64/boot/dts/qcom/sm6115.dtsi | 22 ++++++++++++++++++++++ > >>> 1 file changed, 22 insertions(+) > >>> > >>> diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi > >>> index 2a51c938bbcb..ebac026b4cc7 100644 > >>> --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi > >>> +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi > >>> @@ -650,6 +650,28 @@ usb_hsphy: phy@1613000 { > >>> status = "disabled"; > >>> }; > >>> > >>> + cryptobam: dma-controller@1b04000 { > >>> + compatible = "qcom,bam-v1.7.4", "qcom,bam-v1.7.0"; > >>> + reg = <0x0 0x01b04000 0x0 0x24000>; > >>> + interrupts = <GIC_SPI 247 IRQ_TYPE_LEVEL_HIGH>; > >>> + #dma-cells = <1>; > >>> + qcom,ee = <0>; > >>> + qcom,controlled-remotely; > >>> + num-channels = <8>; > >>> + qcom,num-ees = <2>; > >>> + iommus = <&apps_smmu 0x94 0x11>, > >>> + <&apps_smmu 0x96 0x11>; > >>> + }; > >>> + > >>> + crypto: crypto@1b3a000 { > >>> + compatible = "qcom,sm6115-qce", "qcom,sm8150-qce", "qcom,qce"; > >>> + reg = <0x0 0x01b3a000 0x0 0x6000>; > >>> + dmas = <&cryptobam 6>, <&cryptobam 7>; > >>> + dma-names = "rx", "tx"; > >>> + iommus = <&apps_smmu 0x94 0x11>, > >>> + <&apps_smmu 0x96 0x11>; > >> > >> Shouldn't you have clocks = <&rpmcc RPM_SMD_CE1_CLK> here to make sure > >> the clock for the crypto engine is on? Your binding patch (PATCH 06/11) > >> says "Crypto Engine block on Qualcomm SoCs SM6115 and QCM2290 do not > >> require clocks strictly" but doesn't say why. > >> > >> Make sure you don't rely on having rpmcc keep unused clocks on > >> permanently. This is the case at the moment, but we would like to change > >> this [2]. Adding new users that rely on this broken behavior would just > >> make this effort even more complicated. > >> > >> If you also add the clock to the cryptobam then you should be able to > >> see the advantage of my bam_dma patch [3]. It allows you to drop > >> "num-channels" and "qcom,num-ees" from the cryptobam in your changes > >> above because it can then be read directly from the BAM registers. > > > > Thanks for pointing this out. Actually that's why I was using your > > patch while testing with RB1/RB2 :) > > > > Yes, so the background is that I am preparing a new version of this > > crypto enablement patchset. > > Also your assumption about the clocks being turned on by the firmware > > is true for RB1/RB2 devices, so enabling them via Linux is optional as > > per Qualcomm enggs. > This is not necessarily true. Currently it's kept always-on on > by clk_smd_rpm_handoff, but that's a hack from 10 years ago when smd > was still new. > > > > > So, I am testing the new patchset right now with 'clock' entries > > provided in the .dtsi and see if that causes any issue / improvement > > (etc.) > It won't change since it's on anyway, but that won't be a given for long. Right, so that's what I observe: RPM_SMD_CE1_CLK is always on by the time crypto _probe gets called. So, IMO let's not mix this patchset with the other fix which probably will fix the 10-year old clk_smd_rpm handoff keeping these clocks on. Probably that should be a separate changeset - requiring very thorough checks to make sure that we don't break working platforms. Thanks.
On 19.05.2023 12:49, Bhupesh Sharma wrote: > On Fri, 19 May 2023 at 16:12, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >> >> On 19.05.2023 12:22, Bhupesh Sharma wrote: >>> Hi Stephan, >>> >>> On Fri, 19 May 2023 at 15:40, Stephan Gerhold <stephan@gerhold.net> wrote: >>>> >>>> Hi Bhupesh, >>>> >>>> Not sure if this is the latest version of this series since it's pretty >>>> old but I didn't find a new one. Just came here because you mentioned >>>> RB1/RB2 [1] in my bam_dma patch and they don't have any BAM defined >>>> upstream yet. >>>> >>>> [1]: https://lore.kernel.org/linux-arm-msm/CAH=2Ntw0BZH=RGp14mYLhX7D6jV5O5eDKRQbby=uCy85xMDU_g@mail.gmail.com/ >>>> >>>> On Wed, Apr 05, 2023 at 12:58:32PM +0530, Bhupesh Sharma wrote: >>>>> Add crypto engine (CE) and CE BAM related nodes and definitions to >>>>> 'sm6115.dtsi'. >>>>> >>>>> Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> >>>>> --- >>>>> arch/arm64/boot/dts/qcom/sm6115.dtsi | 22 ++++++++++++++++++++++ >>>>> 1 file changed, 22 insertions(+) >>>>> >>>>> diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi >>>>> index 2a51c938bbcb..ebac026b4cc7 100644 >>>>> --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi >>>>> +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi >>>>> @@ -650,6 +650,28 @@ usb_hsphy: phy@1613000 { >>>>> status = "disabled"; >>>>> }; >>>>> >>>>> + cryptobam: dma-controller@1b04000 { >>>>> + compatible = "qcom,bam-v1.7.4", "qcom,bam-v1.7.0"; >>>>> + reg = <0x0 0x01b04000 0x0 0x24000>; >>>>> + interrupts = <GIC_SPI 247 IRQ_TYPE_LEVEL_HIGH>; >>>>> + #dma-cells = <1>; >>>>> + qcom,ee = <0>; >>>>> + qcom,controlled-remotely; >>>>> + num-channels = <8>; >>>>> + qcom,num-ees = <2>; >>>>> + iommus = <&apps_smmu 0x94 0x11>, >>>>> + <&apps_smmu 0x96 0x11>; >>>>> + }; >>>>> + >>>>> + crypto: crypto@1b3a000 { >>>>> + compatible = "qcom,sm6115-qce", "qcom,sm8150-qce", "qcom,qce"; >>>>> + reg = <0x0 0x01b3a000 0x0 0x6000>; >>>>> + dmas = <&cryptobam 6>, <&cryptobam 7>; >>>>> + dma-names = "rx", "tx"; >>>>> + iommus = <&apps_smmu 0x94 0x11>, >>>>> + <&apps_smmu 0x96 0x11>; >>>> >>>> Shouldn't you have clocks = <&rpmcc RPM_SMD_CE1_CLK> here to make sure >>>> the clock for the crypto engine is on? Your binding patch (PATCH 06/11) >>>> says "Crypto Engine block on Qualcomm SoCs SM6115 and QCM2290 do not >>>> require clocks strictly" but doesn't say why. >>>> >>>> Make sure you don't rely on having rpmcc keep unused clocks on >>>> permanently. This is the case at the moment, but we would like to change >>>> this [2]. Adding new users that rely on this broken behavior would just >>>> make this effort even more complicated. >>>> >>>> If you also add the clock to the cryptobam then you should be able to >>>> see the advantage of my bam_dma patch [3]. It allows you to drop >>>> "num-channels" and "qcom,num-ees" from the cryptobam in your changes >>>> above because it can then be read directly from the BAM registers. >>> >>> Thanks for pointing this out. Actually that's why I was using your >>> patch while testing with RB1/RB2 :) >>> >>> Yes, so the background is that I am preparing a new version of this >>> crypto enablement patchset. >>> Also your assumption about the clocks being turned on by the firmware >>> is true for RB1/RB2 devices, so enabling them via Linux is optional as >>> per Qualcomm enggs. >> This is not necessarily true. Currently it's kept always-on on >> by clk_smd_rpm_handoff, but that's a hack from 10 years ago when smd >> was still new. >> >>> >>> So, I am testing the new patchset right now with 'clock' entries >>> provided in the .dtsi and see if that causes any issue / improvement >>> (etc.) >> It won't change since it's on anyway, but that won't be a given for long. > > Right, so that's what I observe: RPM_SMD_CE1_CLK is always on by the > time crypto _probe gets called. > So, IMO let's not mix this patchset with the other fix which probably > will fix the 10-year old clk_smd_rpm handoff keeping > these clocks on. > > Probably that should be a separate changeset - requiring very thorough > checks to make sure that we don't break > working platforms. It's not about mixing patchsets, the nodes should reflect all the clock/ power-domain/regulator/pinctrl/etc. dependencies from their introduction. Remember, dt describes the hardware, not the software or firmware. That - among other things - ensures backwards compatibility can be preserved. > > Thanks.
diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi index 2a51c938bbcb..ebac026b4cc7 100644 --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi @@ -650,6 +650,28 @@ usb_hsphy: phy@1613000 { status = "disabled"; }; + cryptobam: dma-controller@1b04000 { + compatible = "qcom,bam-v1.7.4", "qcom,bam-v1.7.0"; + reg = <0x0 0x01b04000 0x0 0x24000>; + interrupts = <GIC_SPI 247 IRQ_TYPE_LEVEL_HIGH>; + #dma-cells = <1>; + qcom,ee = <0>; + qcom,controlled-remotely; + num-channels = <8>; + qcom,num-ees = <2>; + iommus = <&apps_smmu 0x94 0x11>, + <&apps_smmu 0x96 0x11>; + }; + + crypto: crypto@1b3a000 { + compatible = "qcom,sm6115-qce", "qcom,sm8150-qce", "qcom,qce"; + reg = <0x0 0x01b3a000 0x0 0x6000>; + dmas = <&cryptobam 6>, <&cryptobam 7>; + dma-names = "rx", "tx"; + iommus = <&apps_smmu 0x94 0x11>, + <&apps_smmu 0x96 0x11>; + }; + qfprom@1b40000 { compatible = "qcom,sm6115-qfprom", "qcom,qfprom"; reg = <0x0 0x01b40000 0x0 0x7000>;