Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1910500rdb; Mon, 8 Jan 2024 14:46:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLH0XNock80GtQHRJ8d1MFcy/voomX8UpuMaINoTM6LCH3uyhD7lw2yzSrx/0E7jDWF+51 X-Received: by 2002:a25:f454:0:b0:db7:dacf:ed96 with SMTP id p20-20020a25f454000000b00db7dacfed96mr1515205ybe.119.1704753970804; Mon, 08 Jan 2024 14:46:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704753970; cv=none; d=google.com; s=arc-20160816; b=PlmV8SdxUm+xRsqpgNPWHmNRGmdA9tIOX4CBTDDELBhxSaIb/FjYx0cWZfXjADo74h Ga0jUZMZ0oFTBUNS9IJkc+XaUzWBfXhQaSpB095OrTU8yPONJxcOnq3t9dy9FR1ZiC7s N8aOoS6ILVG2a2oSDy2QxKOJNqbuUk6B54sOQuFuMWakDdh2M/vMibOdpnHlxAsBm7Fa io4MDXLnUUjOE3WcvONn4FjScRwjUP1QrlEibjJnkoroGaWXTzZQK+IwUVF/fYVkQzXj jGdi0SBK/DX/wlyPESKLwf62iTc/RPu/m2ctGAg4ok5j51mAii+noZpJXEyW6p6q8fda 5YaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=61vUXi0tgd4fMed9J9uoxBpNCsey8YSSXrnUW+ulNLI=; fh=So0Ww9EbXowAK0NTKQxcOSmLN5yxkboKnKrcyNnSIXA=; b=JXY/376fQUs0ia8OVtVBgUprFzRrIbg1s+SS6g049XC5JB6lJW/Uko1MIdEskANpD4 MSf/ZlWabS/DGQl09033OxDGYYpfCUrop+zPPwQVwR7N/EioTOOekGG9HnLMMF51sZ5s obvjLcCU2KzrgnZ+tcOo0FuLzytXSMGcVK1c0eVrp5Q4F02b0h/os/HTOwre3NCLlVk0 /DusW29kOvs62CxeTiIbciVAqDiJUTNinYyEZCAimhM5ij2W6Yo5BlvuBXViLxFRWLSm Khg9H7abM4IVdIW/2h0EJhu8P2YeUQ/6XIA8xWOmdP3Qy13krPsPHKff2SSkRQv77LP7 5tlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="PNWqQl/F"; spf=pass (google.com: domain of linux-kernel+bounces-20157-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20157-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q16-20020a05622a04d000b004280de35ab5si726430qtx.729.2024.01.08.14.46.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 14:46:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20157-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="PNWqQl/F"; spf=pass (google.com: domain of linux-kernel+bounces-20157-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20157-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 796D11C22BF8 for ; Mon, 8 Jan 2024 22:46:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E84753E1F; Mon, 8 Jan 2024 22:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PNWqQl/F" Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCF461E529 for ; Mon, 8 Jan 2024 22:45:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-dbd721384c0so1515158276.1 for ; Mon, 08 Jan 2024 14:45:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704753957; x=1705358757; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=61vUXi0tgd4fMed9J9uoxBpNCsey8YSSXrnUW+ulNLI=; b=PNWqQl/FdRpVM9bj0dlCNnvlPBNmoraXuMJeoobUvFRXA9udGmmyK7IpHit3gUEhIo QJ2RxcHbdnVpNxR/9baDf2RehFed898pqwI7jZ0Ui7yfD1tBZXwpgfH7cBP/aGRx3SZ3 e3KAf05cVU0e5ZO/old7O5pPhhAqXJExU1KFjnsxOJc5Ft+4pLYl2I697jUtxchkGaZY ID6lKj8uGU0oGbbbreVf5EMtZgYglxpa6ozD+6NrEoovU6sCpJ3KFG1GcmRMmdncavG1 +oAhuUO7kfYwulBgb+awis4v2u9/kp1X5PIjwtkGrcjsTm37X3olbNtUDl+yxuaQpkti 2wOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704753957; x=1705358757; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=61vUXi0tgd4fMed9J9uoxBpNCsey8YSSXrnUW+ulNLI=; b=Ks8UpW28gZ87JnU6Zv6KAtqfP/PWILAmmaX6VVifoCjWC8bjknIEFf6DPxpLzoBa0G 6uO/ZNgu7zsRFLV6pOipW4ecsQMBxSmAL5Dx19b/OlW5eaxwNIsAuoltAUtGxRg7qpI2 5ch0qx+Zn9FN8q90bRRxllerbPUieW5vINCVhjdrRkQ/9QMw1AWYT6QYTl7uFwD7PLbU GXypZfE/Yp9uOYGrIzGQS799TDXw8F5MHi2AtZFxBQ6ykbwnHh8ZRHZ0Ef8cNZtzMtb3 tpmqT2nugLF7vz9CN8dxcrHtvWqyOTrwqQmcpcOdaPQnQuB35QUAmzHA84az20gyq+E8 wKJA== X-Gm-Message-State: AOJu0YzLwraHXaoGFivRvD2ZN+ycrHKTGBOjUCq3gjifgZeVQvatmrEX IqkQRNqf+dvNJLAO9o0hHlW68ngM0rU6Y6K1sN0ec/adaGRXBA== X-Received: by 2002:a25:ab47:0:b0:dbd:497a:f546 with SMTP id u65-20020a25ab47000000b00dbd497af546mr2316231ybi.0.1704753956710; Mon, 08 Jan 2024 14:45:56 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240108-sm8350-qce-v1-1-b7d586ff38af@fairphone.com> In-Reply-To: From: Dmitry Baryshkov Date: Tue, 9 Jan 2024 00:45:45 +0200 Message-ID: Subject: Re: [PATCH RFT] arm64: dts: qcom: sm8350: Reenable crypto & cryptobam To: Luca Weiss Cc: Konrad Dybcio , Andy Gross , Bjorn Andersson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bhupesh Sharma , David Heidelberg , Stephan Gerhold , ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Mon, 8 Jan 2024 at 16:23, Luca Weiss wrote: > > On Mon Jan 8, 2024 at 3:18 PM CET, Konrad Dybcio wrote: > > On 8.01.2024 14:49, Luca Weiss wrote: > > > When num-channels and qcom,num-ees is not provided in devicetree, the > > > driver will try to read these values from the registers during probe but > > > this fails if the interconnect is not on and then crashes the system. > > > > > > So we can provide these properties in devicetree (queried after patching > > > BAM driver to enable the necessary interconnect) so we can probe > > > cryptobam without reading registers and then also use the QCE as > > > expected. > > > > This really feels a bit backwards.. Enable the resource to query the > > hardware for numbers, so that said resource can be enabled, but > > slightly later :/ > > If you think adding interconnect support to driver and dtsi is better, > let me know. I'd say, adding the proper interconnect is a better option. Otherwise we just depend on the QCE itself to set up the vote for us. > > Stephan (+CC) mentioned it should be okay like this *shrug* > > For the record, this is the same way I got the values for sc7280[0] and > sm6350[1]. > > [0] https://lore.kernel.org/linux-arm-msm/20231229-sc7280-cryptobam-fixup-v1-1-bd8f68589b80@fairphone.com/ > [1] https://lore.kernel.org/linux-arm-msm/20240105-sm6350-qce-v1-0-416e5c7319ac@fairphone.com/ > > diff --git a/arch/arm64/boot/dts/qcom/sm8350.dtsi b/arch/arm64/boot/dts/qcom/sm8350.dtsi > index b46236235b7f..cd4dd9852d9e 100644 > --- a/arch/arm64/boot/dts/qcom/sm8350.dtsi > +++ b/arch/arm64/boot/dts/qcom/sm8350.dtsi > @@ -1756,8 +1756,8 @@ cryptobam: dma-controller@1dc4000 { > qcom,controlled-remotely; > iommus = <&apps_smmu 0x594 0x0011>, > <&apps_smmu 0x596 0x0011>; > - /* FIXME: Probing BAM DMA causes some abort and system hang */ > - status = "fail"; > + interconnects = <&aggre2_noc MASTER_CRYPTO 0 &mc_virt SLAVE_EBI1 0>; > + interconnect-names = "memory"; > }; > > crypto: crypto@1dfa000 { > diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c > index 5e7d332731e0..9de28f615639 100644 > --- a/drivers/dma/qcom/bam_dma.c > +++ b/drivers/dma/qcom/bam_dma.c > @@ -40,6 +40,7 @@ > #include > #include > #include > +#include > #include > > #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 */ > @@ -1206,6 +1208,7 @@ static int bam_init(struct bam_device *bdev) > bdev->num_channels = val & BAM_NUM_PIPES_MASK; > } > > + printk(KERN_ERR "%s:%d DBG num_ees=%u num_channels=%u\n", __func__, __LINE__, bdev->num_ees, bdev->num_channels); > /* Reset BAM now if fully controlled locally */ > if (!bdev->controlled_remotely && !bdev->powered_remotely) > bam_reset(bdev); > @@ -1298,6 +1301,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); Probably this needs some more sensible value. > + if (ret) > + return ret; > + > ret = bam_init(bdev); > if (ret) > goto err_disable_clk; > -- With best wishes Dmitry