Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3837603pxp; Wed, 23 Mar 2022 06:46:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaRSRzjK12oDb2zY6Fl1PRLzQWqFqtkX/pqtd9W+aGD3WxDigpG53XBJ92AQykrgk6VHul X-Received: by 2002:a17:906:c114:b0:6d8:cfd4:f746 with SMTP id do20-20020a170906c11400b006d8cfd4f746mr4546ejc.538.1648043166524; Wed, 23 Mar 2022 06:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648043166; cv=none; d=google.com; s=arc-20160816; b=SQoF2XeZ0wz2T8S+QqXqfsEIsxpbiyF5u5xWrjcWmwb0bVwqQp15se9V0Zxu2B/uqV QYVNQbPTE3LmICdCvlafuZh0xbneD/KlruxevtmkHJCXVUPUoiPPP7X1lgRk2YFMIMxo ffz0tvVpi9DTbrvxHwGCYYPCZflQzxi9zr9/tqwTjJ0toHpUTf0NBgrQxhPcfbLbXg1B vx7TzL5brAeNpNeG54Fu01BcoZ4j78CDuFx2hftyADjsFLm3fi2y2D8Pu3SzJHlJEAqm JOybg/XYHcBjWMIVvNZDpVCCwY9Fu0YXyyz1wqKEn3QrLPoxq0DvJtam8sznn2yvDT63 7o+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=nFhPQ/2TAffPjbDjiI/2I0v37r+CcQs5C7D/sWxAMI8=; b=OGO2wT12RjvjQchD4H2nZLD9lkl4HWNIWjLsZwXlBpdql5M4gSorB+v1qO7JGV7d15 LotBsTz0LPSSbwBLn3FTzBCkG/daJ6PbhLvCUNGx92QlCQ4WnhCnQpMPfHHcFDzxdJ4e S1M5GNxbq7i+6qtf2k+4fhwgOCxbVzRxBfQO2FtqnwuSqZJnBpX+2tZYkk6+0Olvlo00 SFjoA2nqjsIWFNqJy3ZN6XDzDbB+ejP23+6IomQGz2JZDDWE8+1XAlqqcyPztRxebYvX yFr1SBYEq4U1jUF38GlV02xADKHSBAgbQfQ5pYSabQrBtTrxS4DdMVDGzLwl3ADagpkt S6ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=quPIS4rl; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a170906530e00b006e021f4c205si7406598ejo.874.2022.03.23.06.45.32; Wed, 23 Mar 2022 06:46:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=quPIS4rl; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244264AbiCWNYR (ORCPT + 99 others); Wed, 23 Mar 2022 09:24:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244261AbiCWNYQ (ORCPT ); Wed, 23 Mar 2022 09:24:16 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6F0A7CDFE for ; Wed, 23 Mar 2022 06:22:45 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id h4so2081718wrc.13 for ; Wed, 23 Mar 2022 06:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=nFhPQ/2TAffPjbDjiI/2I0v37r+CcQs5C7D/sWxAMI8=; b=quPIS4rlbqNNwzlG7UsIcANuXUutqUX2+fS2vwwVrkSb8FadLyZ9PZuzt3n4FECs6b JD3NheA8m53Arv3IJp2+FRXgb8apclZMBwVLZzL1u949YS0k93kjWRoPRC7j6cfksk60 qxWnya1GQ0o6FnD0kdxsnW3YSZ6iUb00BQ9WyMilezQ5n3ltGCDn+C8jl6rMTHz5Oakz /607HtEh8xP6zzvxbUd5PSpNYWuV9/bc8PQYBMTN/o3/amywjFJkjwFPiEjWUSPZsUf+ UUicmWGMkDbN/NfGnIkjbJTQNk7WhHnpkDNNvhtM2OQ7+b+7vY0duYDYvrj3Vwl6M31g 2puA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=nFhPQ/2TAffPjbDjiI/2I0v37r+CcQs5C7D/sWxAMI8=; b=LY9m7hVuEfX0wRdWuBvv8oOCHwaJPeh4VawNpOhLIPgjNGU/7qBFSE+zZUPCkxBZOB tZZdXAbcF7pY7kym7Ze4ly97ewgK40SpD1MFHTIFwLAlpYDodRt5xErSkhue8SDzpj1h 04XsQSeWsPpuDNlalqgPtRNqiHpNSeDrvpf7p1r3UCg2VzpaY8q1ZqpdgFlncBxuCgJk GkWyL6SWJ54qTyxiIAfNtB/g2bX6AG0Q/XuJbWCZ09QKx3+JEiozZNu9EL6d2e6Lm87U HyJMfsWWTlrE2agQBzMbG3S4pBvHOeOfZgdOrqUmiuOJ5ITW+bJ1Eqg5YpZNvO1FRiW3 DJew== X-Gm-Message-State: AOAM532AOhqknb1+TB2N5mBWZYybEcdWhz8slwE6qjL3wIVCBxnOyTsK O5491h43DaYCyinPOy8skWM9jg== X-Received: by 2002:a05:6000:1b86:b0:1f0:d6f:1424 with SMTP id r6-20020a0560001b8600b001f00d6f1424mr26954876wru.174.1648041764214; Wed, 23 Mar 2022 06:22:44 -0700 (PDT) Received: from Red ([2a01:cb1d:3d5:a100:264b:feff:fe03:2806]) by smtp.googlemail.com with ESMTPSA id l15-20020a05600c4f0f00b0038cbdf5221dsm2806353wmq.41.2022.03.23.06.22.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 06:22:43 -0700 (PDT) Date: Wed, 23 Mar 2022 14:22:41 +0100 From: LABBE Corentin To: Robin Murphy Cc: heiko@sntech.de, herbert@gondor.apana.org.au, krzk+dt@kernel.org, mturquette@baylibre.com, robh+dt@kernel.org, sboyd@kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org Subject: Re: [PATCH v3 18/26] arm64: dts: rockchip: rk3399: add crypto node Message-ID: References: <20220321200739.3572792-1-clabbe@baylibre.com> <20220321200739.3572792-19-clabbe@baylibre.com> <70422777-a3f9-b2f1-5faa-94d24fe200ac@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <70422777-a3f9-b2f1-5faa-94d24fe200ac@arm.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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: X-Mailing-List: linux-crypto@vger.kernel.org Le Tue, Mar 22, 2022 at 12:00:06PM +0000, Robin Murphy a ?crit : > On 2022-03-21 20:07, Corentin Labbe wrote: > > The rk3399 has a crypto IP handled by the rk3288 crypto driver so adds a > > node for it. > > > > Signed-off-by: Corentin Labbe > > --- > > arch/arm64/boot/dts/rockchip/rk3399.dtsi | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > > diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi > > index 88f26d89eea1..ca2c658371a5 100644 > > --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi > > +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi > > @@ -573,6 +573,18 @@ saradc: saradc@ff100000 { > > status = "disabled"; > > }; > > > > + crypto0: crypto@ff8b0000 { > > + compatible = "rockchip,rk3399-crypto"; > > + reg = <0x0 0xff8b0000 0x0 0x4000>, > > + <0x0 0xff8b8000 0x0 0x4000>; > > + interrupts = , > > + ; > > + clocks = <&cru SCLK_CRYPTO0>, <&cru HCLK_M_CRYPTO0>, <&cru HCLK_S_CRYPTO0>, > > + <&cru SCLK_CRYPTO1>, <&cru HCLK_M_CRYPTO1>, <&cru HCLK_S_CRYPTO1>; > > + resets = <&cru SRST_CRYPTO0>, <&cru SRST_CRYPTO0_S>, <&cru SRST_CRYPTO0_M>, > > + <&cru SRST_CRYPTO1>, <&cru SRST_CRYPTO1_S>, <&cru SRST_CRYPTO1_M>; > > + }; > > What's going on here? If these are simply two instances of the same IP > block as the evidence suggests, why are they crammed into a single DT > node rather than simply being described as two separate instances? I was > rather wondering what all the confusing mess in patch #16 was about, > until I got here. > > If there's something in the crypto API that means the driver can't > simply naively register itself multiple times, there should be any > number of ways for the probe routine to keep track of whether it's > already registered something and associate any subsequent devices with > the first one internally if need be. Linux implementation details should > not leak out as non-standard DT weirdness. > > I know the Rockchip IOMMU driver does this, but in that case the two > IOMMU instances are closely coupled and sharing work such that they > effectively need to be programmed identically at all times, so it was a > bit more justifiable. I don't know the full story here, but it certainly > looks like rk_get_engine_number() is just a means to schedule work on > any available unit independently, so looks like it wouldn't take much to > select between distinct devices at that point, and actually end up a lot > simpler and cleaner overall. Yes rk3399 has 2 instances of the same IP (Exception: crypto1 does not have RSA). The problem is that only one drivername (like rk-md5) could exists. If crypto0 and crypto1 register with different drivername (rk-md5-0/rk-md5-1), only one will be used anyway. So I merged them into only one instance. I think this way will be easier, but you are right, this is not pretty. I found another way with 2 nodes: You could preview it at https://github.com/montjoie/linux/tree/cryptorockchipv4 Basicly the crypto0 is a normal instance, and crypto1 "registers" itself against crypto0. So if crypto0 know another instance exists it will load balance requests. Regards