Message ID | 20231214103600.2613988-3-quic_omprsing@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8447382dys; Thu, 14 Dec 2023 02:36:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IExUuJys7mpakmsT4Ild6pnAooLKY8Wwz0OugUfsTSyMzyUZOLe6e6XFUJvFYZawUZawCS3 X-Received: by 2002:a05:6808:10c3:b0:3b8:b4b0:e266 with SMTP id s3-20020a05680810c300b003b8b4b0e266mr10475297ois.2.1702550207897; Thu, 14 Dec 2023 02:36:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702550207; cv=none; d=google.com; s=arc-20160816; b=jL8toX33TZAGzCYp3oZiHosHA0swOcYDn1v4QRA93yh27xHN9VtTcwGZAICPnQqNQm NIyGjWsrsh28Ou9TM/3Rr7I62GlgqVOEtzseUyWMJwWK49auZJ0e6Wc3INsTMUwLK1D/ 7MNDFtolIoy/bXEw2qmF9UeziQuiKaxO/mTAShf4gleZyoNfbkdoBucxCYCeB5xI0LwM 589wiGhysC6WzY1oUZ/5tKtlToVaROMgQQkxaMucJBlEyfX+B301Q+lrkQFlgic2qv4Q cRXyWS+zDDqCTf0INOeprluuTYTaMn3jGE23EwAS40pE7BtrcIvY6sYTChz3C76jegwb GJZg== 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=Hy0ZCuxeshJ9OJqrWSouk5mKlu/Kf0gzIP9t1ih7CTA=; fh=l0nXbwzw13wb9rQ3+7Rggz6xc2xc8Ln+BsypDZGW3q4=; b=eN0LLhAjG+Sm8s7Nus/ldfuDwakavPdhD2Sz1E5buw03iJ1KbPIqnv0Yb6axF3hCs1 eRODnIxUWs8nsEHKeYTJ9WrN6qRtfcFlW2Sw64q26euyYcv3wrIoPMSyV1/fS2R+K+EH n1ccIcBisFgItVvY9QAAWEbAEM7RTO9L9BPZTjyNS1TyAQffKunEI0ZrKqhWfCitjYr1 kkFC0zcIA41oNY/rIlEf5vN9GssKWzvQkfzdoJuTHy4oU8+PruYuF0JY3mze3iPgexvx Rd48cyHh4EMsyJEe8VKb3jXkfoJLJvCh/w0dym9ZAeb4uUecwoXJ4IHscj1ErEyRYIPi dl0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=LNOkMoFK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id s16-20020a056a00195000b006ce96e33eb8si10949858pfk.112.2023.12.14.02.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 02:36:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=LNOkMoFK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A9E0F8028D71; Thu, 14 Dec 2023 02:36:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443694AbjLNKgg (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Thu, 14 Dec 2023 05:36:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443698AbjLNKge (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Dec 2023 05:36:34 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DDED10E; Thu, 14 Dec 2023 02:36:41 -0800 (PST) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BE9K6JT028706; Thu, 14 Dec 2023 10:36:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=Hy0ZCuxeshJ9OJqrWSouk5mKlu/Kf0gzIP9t1ih7CTA=; b=LN OkMoFKYjFQD+lYDukDIkcmZ09DimEPdpEaJazOMOf1SrEJRjAGtJrMmrPeXSekeM 1HIGT3IC8VRKmFv1rxy8oOXvX/VQ7+hnG50D8CF08Hyk6QdhNHj8ZS3WnXYuGZeL yoNsOSY6zSIH4TDO9QQUrL8hbID9OJq3loyPrgIZdCmYx952TBh5EGnugQD1Lwrd 4D+KIIy4Os56qkxlKF0laYQG2O2hKGkMk5z/bQnu4r89SmwgvOXv4QdMXwO2jsDp ZFES3Zq5+MrrjMDAjIELnCDTeoAioAOBlVEay1bkLjRb7zR+bLOLxILZKzi0zNyU 6jBhagoCEsRC5yOoBONQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uyqgt115s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 10:36:33 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BEAaW2O002868 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 10:36:32 GMT Received: from hu-omprsing-hyd.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 14 Dec 2023 02:36:27 -0800 From: Om Prakash Singh <quic_omprsing@quicinc.com> To: <quic_omprsing@quicinc.com> CC: <neil.armstrong@linaro.org>, <konrad.dybcio@linaro.org>, <agross@kernel.org>, <andersson@kernel.org>, <conor+dt@kernel.org>, <davem@davemloft.net>, <devicetree@vger.kernel.org>, <herbert@gondor.apana.org.au>, <krzysztof.kozlowski+dt@linaro.org>, <linux-arm-msm@vger.kernel.org>, <linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <marijn.suijten@somainline.org>, <robh+dt@kernel.org>, <vkoul@kernel.org>, <cros-qcom-dts-watchers@chromium.org> Subject: [PATCH V3 2/2] arm64: dts: qcom: sc7280: add QCrypto nodes Date: Thu, 14 Dec 2023 16:06:00 +0530 Message-ID: <20231214103600.2613988-3-quic_omprsing@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231214103600.2613988-1-quic_omprsing@quicinc.com> References: <20231214103600.2613988-1-quic_omprsing@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: eI1ZMDqxm7hjzoiataeKDsSfKo5OS_qG X-Proofpoint-ORIG-GUID: eI1ZMDqxm7hjzoiataeKDsSfKo5OS_qG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 mlxlogscore=810 mlxscore=0 clxscore=1015 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312140070 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Dec 2023 02:36:46 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785253286386545662 X-GMAIL-MSGID: 1785253286386545662 |
Series |
Add QCrypto support for SC7280
|
|
Commit Message
Om Prakash Singh
Dec. 14, 2023, 10:36 a.m. UTC
Add the QCE and Crypto BAM DMA nodes.
Signed-off-by: Om Prakash Singh <quic_omprsing@quicinc.com>
---
Changes in V3:
- V2 patch was sent without actual modification. Resending the patch with modified file.
Changes in V2:
- Update DT node sequence as per register ascending order.
- Fix DT node properties as per convention.
arch/arm64/boot/dts/qcom/sc7280.dtsi | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
Comments
On Thu Dec 14, 2023 at 11:36 AM CET, Om Prakash Singh wrote: > Add the QCE and Crypto BAM DMA nodes. > > Signed-off-by: Om Prakash Singh <quic_omprsing@quicinc.com> > --- > > Changes in V3: > - V2 patch was sent without actual modification. Resending the patch with modified file. > > Changes in V2: > - Update DT node sequence as per register ascending order. > - Fix DT node properties as per convention. > > arch/arm64/boot/dts/qcom/sc7280.dtsi | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi > index 66f1eb83cca7..b819724c1255 100644 > --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi > +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi > @@ -2233,6 +2233,28 @@ pcie1_phy: phy@1c0e000 { > status = "disabled"; > }; > > + cryptobam: dma-controller@1dc4000 { > + compatible = "qcom,bam-v1.7.4", "qcom,bam-v1.7.0"; > + reg = <0x0 0x01dc4000 0x0 0x28000>; > + interrupts = <GIC_SPI 272 IRQ_TYPE_LEVEL_HIGH>; > + #dma-cells = <1>; > + iommus = <&apps_smmu 0x4e4 0x0011>, > + <&apps_smmu 0x4e6 0x0011>; > + qcom,ee = <0>; > + qcom,controlled-remotely; > + }; Hi, Unfortunately I seem to have boot failure / device crash with cryptobam enabled on my qcm6490-fairphone-fp5. Are you aware of any firmware differences that could cause this with QCM6490 LA firmware? Looking at downstream msm-5.4 dmesg I do see this BAM being used so it should generally be accessible from Linux. [ 5.217214] qce 1de0000.qcedev: Adding to iommu group 18 [ 5.223741] QCE50: __qce_get_device_tree_data: CE operating frequency is not defined, setting to default 100MHZ [ 5.234986] qce 1de0000.qcedev: QTI Crypto 5.6.0 device found @0x1de0000 [ 5.242981] sps_register_bam_device: sps:BAM 0x0000000001dc4000 is registered [ 5.251124] sps_bam_enable: sps:BAM 0x0000000001dc4000 (va:0x000000001db63156) enabled: ver:0x27, number of pipes:16 [ 5.262783] QCE50: qce_sps_init: QTI MSM CE-BAM at 0x0000000001dc4000 irq 9 [ 5.271820] qce 1de0000.qcedev:qcom_cedev_ns_cb: Adding to iommu group 19 [ 5.281083] qce 1de0000.qcedev:qcom_cedev_s_cb: Adding to iommu group 20 [ 5.289376] qcrypto 1de0000.qcrypto: Adding to iommu group 21 [ 5.296326] QCE50: __qce_get_device_tree_data: CE operating frequency is not defined, setting to default 100MHZ [ 5.307675] qcrypto 1de0000.qcrypto: QTI Crypto 5.6.0 device found @0x1de0000 [ 5.315867] QCE50: qce_sps_init: QTI MSM CE-BAM at 0x0000000001dc4000 irq 9 Any idea? Regards Luca > + > + crypto: crypto@1dfa000 { > + compatible = "qcom,sc7280-qce", "qcom,sm8150-qce", "qcom,qce"; > + reg = <0x0 0x01dfa000 0x0 0x6000>; > + dmas = <&cryptobam 4>, <&cryptobam 5>; > + dma-names = "rx", "tx"; > + iommus = <&apps_smmu 0x4e4 0x0011>, > + <&apps_smmu 0x4e4 0x0011>; > + interconnects = <&aggre2_noc MASTER_CRYPTO 0 &mc_virt SLAVE_EBI1 0>; > + interconnect-names = "memory"; > + }; > + > ipa: ipa@1e40000 { > compatible = "qcom,sc7280-ipa"; >
On Thu Dec 28, 2023 at 3:29 PM CET, Luca Weiss wrote: > On Thu Dec 14, 2023 at 11:36 AM CET, Om Prakash Singh wrote: > > Add the QCE and Crypto BAM DMA nodes. > > > > Signed-off-by: Om Prakash Singh <quic_omprsing@quicinc.com> > > --- > > > > Changes in V3: > > - V2 patch was sent without actual modification. Resending the patch with modified file. > > > > Changes in V2: > > - Update DT node sequence as per register ascending order. > > - Fix DT node properties as per convention. > > > > arch/arm64/boot/dts/qcom/sc7280.dtsi | 22 ++++++++++++++++++++++ > > 1 file changed, 22 insertions(+) > > > > diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi > > index 66f1eb83cca7..b819724c1255 100644 > > --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi > > +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi > > @@ -2233,6 +2233,28 @@ pcie1_phy: phy@1c0e000 { > > status = "disabled"; > > }; > > > > + cryptobam: dma-controller@1dc4000 { > > + compatible = "qcom,bam-v1.7.4", "qcom,bam-v1.7.0"; > > + reg = <0x0 0x01dc4000 0x0 0x28000>; > > + interrupts = <GIC_SPI 272 IRQ_TYPE_LEVEL_HIGH>; > > + #dma-cells = <1>; > > + iommus = <&apps_smmu 0x4e4 0x0011>, > > + <&apps_smmu 0x4e6 0x0011>; > > + qcom,ee = <0>; > > + qcom,controlled-remotely; > > + }; > > Hi, > > Unfortunately I seem to have boot failure / device crash with cryptobam > enabled on my qcm6490-fairphone-fp5. Are you aware of any firmware > differences that could cause this with QCM6490 LA firmware? > > Looking at downstream msm-5.4 dmesg I do see this BAM being used so it > should generally be accessible from Linux. > > [ 5.217214] qce 1de0000.qcedev: Adding to iommu group 18 > [ 5.223741] QCE50: __qce_get_device_tree_data: CE operating frequency is not defined, setting to default 100MHZ > [ 5.234986] qce 1de0000.qcedev: QTI Crypto 5.6.0 device found @0x1de0000 > [ 5.242981] sps_register_bam_device: sps:BAM 0x0000000001dc4000 is registered > [ 5.251124] sps_bam_enable: sps:BAM 0x0000000001dc4000 (va:0x000000001db63156) enabled: ver:0x27, number of pipes:16 > [ 5.262783] QCE50: qce_sps_init: QTI MSM CE-BAM at 0x0000000001dc4000 irq 9 > [ 5.271820] qce 1de0000.qcedev:qcom_cedev_ns_cb: Adding to iommu group 19 > [ 5.281083] qce 1de0000.qcedev:qcom_cedev_s_cb: Adding to iommu group 20 > [ 5.289376] qcrypto 1de0000.qcrypto: Adding to iommu group 21 > [ 5.296326] QCE50: __qce_get_device_tree_data: CE operating frequency is not defined, setting to default 100MHZ > [ 5.307675] qcrypto 1de0000.qcrypto: QTI Crypto 5.6.0 device found @0x1de0000 > [ 5.315867] QCE50: qce_sps_init: QTI MSM CE-BAM at 0x0000000001dc4000 irq 9 After some hints from Stephan Gerhold, it looks like when the bam driver tries to read the registers for getting num-ees and num-channels we need to have the interconnect up, otherwise the register read fails and resets the device into EDL mode. After applying the patch I've attached below the registers can be read successfully. The patch I've actually sent now[0] adds the values read from these registers as static properties so that during cryptobam probe we don't need to have the interconnect up because we don't read any registers. Stephan Gerhold mentioned off-list that this is an adequate solution because all the other times the cryptobam is used by the &crypto node the interconnect will be up. [0] https://lore.kernel.org/linux-arm-msm/20231229-sc7280-cryptobam-fixup-v1-1-bd8f68589b80@fairphone.com/T/#u I imagine the cause why cryptobam & crypto are disabled in sm8350.dtsi is the same, so the solution there probably also is just hardcoding those properties and then using &crypto should work as expected. Regards Luca diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi index 83b5b76ba179..b2517631e884 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -2345,6 +2345,9 @@ cryptobam: dma-controller@1dc4000 { <&apps_smmu 0x4e6 0x0011>; qcom,ee = <0>; qcom,controlled-remotely; + interconnects = <&aggre2_noc MASTER_CRYPTO QCOM_ICC_TAG_ALWAYS + &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>; + interconnect-names = "memory"; }; crypto: crypto@1dfa000 { diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index 5e7d332731e0..b2f85c6bcbea 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -40,6 +40,7 @@ #include <linux/circ_buf.h> #include <linux/clk.h> #include <linux/dmaengine.h> +#include <linux/interconnect.h> #include <linux/pm_runtime.h> #include "../dmaengine.h" @@ -394,6 +395,7 @@ struct bam_device { const struct reg_offset_data *layout; struct clk *bamclk; + struct icc_path *mem_path; int irq; /* dma start transaction tasklet */ @@ -1298,6 +1300,14 @@ static int bam_dma_probe(struct platform_device *pdev) return ret; } + bdev->mem_path = devm_of_icc_get(bdev->dev, "memory"); + if (IS_ERR(bdev->mem_path)) + return PTR_ERR(bdev->mem_path); + + ret = icc_set_bw(bdev->mem_path, 1, 1); + if (ret) + return ret; + ret = bam_init(bdev); if (ret) goto err_disable_clk;
diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi index 66f1eb83cca7..b819724c1255 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -2233,6 +2233,28 @@ pcie1_phy: phy@1c0e000 { status = "disabled"; }; + cryptobam: dma-controller@1dc4000 { + compatible = "qcom,bam-v1.7.4", "qcom,bam-v1.7.0"; + reg = <0x0 0x01dc4000 0x0 0x28000>; + interrupts = <GIC_SPI 272 IRQ_TYPE_LEVEL_HIGH>; + #dma-cells = <1>; + iommus = <&apps_smmu 0x4e4 0x0011>, + <&apps_smmu 0x4e6 0x0011>; + qcom,ee = <0>; + qcom,controlled-remotely; + }; + + crypto: crypto@1dfa000 { + compatible = "qcom,sc7280-qce", "qcom,sm8150-qce", "qcom,qce"; + reg = <0x0 0x01dfa000 0x0 0x6000>; + dmas = <&cryptobam 4>, <&cryptobam 5>; + dma-names = "rx", "tx"; + iommus = <&apps_smmu 0x4e4 0x0011>, + <&apps_smmu 0x4e4 0x0011>; + interconnects = <&aggre2_noc MASTER_CRYPTO 0 &mc_virt SLAVE_EBI1 0>; + interconnect-names = "memory"; + }; + ipa: ipa@1e40000 { compatible = "qcom,sc7280-ipa";