Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3885191pxb; Tue, 17 Nov 2020 06:11:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPMoZu2M2l0/0VNTeU4MZzVTViXV9GOWCl0O/U5bmafF6eghqKoFGtBbZTHwAsifcdUBRK X-Received: by 2002:a50:ab06:: with SMTP id s6mr12983205edc.288.1605622286540; Tue, 17 Nov 2020 06:11:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605622286; cv=none; d=google.com; s=arc-20160816; b=VpmemXcnAkr8kAGl9DMzsl1xeT/HQes3UzqLFRAJmvzGJTPGybELaL68PKkI5uQodZ 3/vj+6ZXAYqQ/N/Gpza33woxGyz4aUuiAZrQv1VfgRBEb+il3uNGs8vqP3I/jxtvdAH/ r72xtn5aOfFnX7+sXI9e+WLyluvuxT6MLw7ypPFjL/W/tXFw4CrBEhz7bHHD7T6oKOvX 0dG1Mapa+h+QE66zkpuDbzKRAs+iZl+Y1DPvQtWJjw3ooHCf0mrKFUtNxv7WhcL2L5mZ WuNV4/CcOEJbk7YhWDwgyVd+uaRdxCmiPIKoyPsIyMcUgGbd0dqM8wX+XLTUCP/nH0Wx CIWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=UvOM2/4A2OhWzAPGtRd1eZy5wj7BP6/1Aw7EmGF9eac=; b=RxWbDqKiUSsk4noLI2QTh85eShSH6bQTVtWHXODZkrsGl4f3HayzEHppGYztfYVL3r kQ2Qm9zdZqr5tRtL4D+UYrgrLjUK3Zg7ixwTOxZCLJoxl2JIuGWFjwoVlFAFiq0mEOf6 F9YQk2biEkaOFErhw5/JA7EDSkx8QfgZMXbx90wvMYlMT+pFheeL4r52mtzu3dPRutL+ xxHzaxoD7FdyFWcTQBl11q2NLTYiISFrQPrYdIXMkqu38keadcb5JqGs8vf1j9zwPZcx YtYr7tQMekpqflmRlGENwiYQ8qngA++tdBoP87rMLsRlbouuYcAExK7N/RB0dOYst5+k Y2Ng== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si15466062edf.2.2020.11.17.06.11.00; Tue, 17 Nov 2020 06:11:26 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728411AbgKQOI7 (ORCPT + 99 others); Tue, 17 Nov 2020 09:08:59 -0500 Received: from foss.arm.com ([217.140.110.172]:58580 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729498AbgKQOH4 (ORCPT ); Tue, 17 Nov 2020 09:07:56 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C0635101E; Tue, 17 Nov 2020 06:07:55 -0800 (PST) Received: from [10.57.60.109] (unknown [10.57.60.109]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 572773F718; Tue, 17 Nov 2020 06:07:54 -0800 (PST) Subject: Re: [PATCH 1/2] dt-bindings: crypto: update ccree optional params To: Rob Herring , Gilad Ben-Yossef Cc: Herbert Xu , "David S. Miller" , Ofir Drang , Linux Crypto Mailing List , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux kernel mailing list , Steven Price References: <20200916071950.1493-1-gilad@benyossef.com> <20200916071950.1493-2-gilad@benyossef.com> <20200923015702.GA3676455@bogus> From: Robin Murphy Message-ID: <1450044c-5150-1da2-11e0-2ae48d8b4d0c@arm.com> Date: Tue, 17 Nov 2020 14:07:19 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 2020-11-16 18:54, Rob Herring wrote: > On Thu, Oct 22, 2020 at 1:18 AM Gilad Ben-Yossef wrote: >> >> >> Hi again, >> >> Any opinion on the suggested below? > > Sorry, lost in the pile... > >> Thanks! >> Gilad >> >> >> On Tue, Sep 29, 2020 at 9:08 PM Gilad Ben-Yossef wrote: >>> >>> >>> On Wed, Sep 23, 2020 at 4:57 AM Rob Herring wrote: >>>> >>>> On Wed, Sep 16, 2020 at 10:19:49AM +0300, Gilad Ben-Yossef wrote: >>>>> Document ccree driver supporting new optional parameters allowing to >>>>> customize the DMA transactions cache parameters and ACE bus sharability >>>>> properties. >>>>> >>>>> Signed-off-by: Gilad Ben-Yossef >>>>> --- >>>>> Documentation/devicetree/bindings/crypto/arm-cryptocell.txt | 4 ++++ >>>>> 1 file changed, 4 insertions(+) >>>>> >>>>> diff --git a/Documentation/devicetree/bindings/crypto/arm-cryptocell.txt b/Documentation/devicetree/bindings/crypto/arm-cryptocell.txt >>>>> index 6130e6eb4af8..1a1603e457a8 100644 >>>>> --- a/Documentation/devicetree/bindings/crypto/arm-cryptocell.txt >>>>> +++ b/Documentation/devicetree/bindings/crypto/arm-cryptocell.txt >>>>> @@ -13,6 +13,10 @@ Required properties: >>>>> Optional properties: >>>>> - clocks: Reference to the crypto engine clock. >>>>> - dma-coherent: Present if dma operations are coherent. >>>>> +- awcache: Set write transactions cache attributes >>>>> +- arcache: Set read transactions cache attributes >>>> >>>> dma-coherent already implies these are 011x, 101x or 111x. In my limited >>>> experience configuring these (Calxeda SATA and ethernet), writeback, >>>> write-allocate was pretty much always optimal. >>> >>> Indeed and these are the default. But not all SoC are born equal and >>> we got a request to allow setting these. >>> >>> Maybe instead of numerical values have three possible verbal setting >>> would be better? >>> >>> >>>>> +- awdomain: Set write transactions ACE sharability domain (712, 703, 713 only) >>>>> +- ardomain: Set read transactions ACE sharability domain (712, 703, 713 only) >>>> >>>> This probably needs something common. We may need something for Mali, >>>> too. I don't think different settings for read and write makes much >>>> sense nor does anything beyond IS or OS. >>> >>> I agree. Maybe >>> >>> sharability_domain: either "IS" or "OS"? > > It's still an Arm thing, so it would need at least an 'arm,' prefix. > But ideally it wouldn't be Arm specific though I'm not sure if any > such thing is needed for other arches. If common either for Arm or > across arches, then it needs to be documented in a common doc with > some wider agreement than what a device specific property needs. "dma-coherent" already encapsulates the shareability. To claim coherency you need to be able to access memory with inner shareable inner-outer write back attributes, because that's how regular kernel memory is mapped. If you don't claim coherency, then you should be using non-cacheable (and thus implicitly outer shareable) attributes, because there may still be cacheable aliases hanging around and if you inadvertently snoop those instead of going direct to DRAM as everything else expects, you're going to have a bad time. Essentially, Linux only uses two sets of memory attributes for DMA memory, so any perceived need for more than that is already something sufficiently esoteric that it probably doesn't need a generic binding. I'm aware that it's against type for me to be arguing Linux details in a DT binding, but I checked the TRMs for some of these devices and they essentially say "you don't program the hardware directly, you use the Linux driver we give you", so it seems like this binding is specifically intended never to be consumed by anything else. >>>> These could also just be implied by the compatible string (and requiring >>>> an SoC specific one). >>> >>> hm... we could do it but this will require us to know (and publicly >>> acknowledge) of every SoC making use of this piece of hardware design. > > That's already a requirement in general. Sometimes we can avoid it, > but that's cases of getting lucky. > >>> There is currently no other part of the driver that needs this. > > If your DT is part of firmware, then waiting until adding some driver > feature or quirk based on a new DT property is too late. Whereas with > a SoC specific compatible, you can handle any new feature or quirk > without a DT change (e.g. just a stable kernel update). Some platforms > may not care about that model, but in general that's the policy we > follow. Not doing that, we end up with the DWC3 binding. > > A fallback compatible is how we avoid updating drivers for every > single SoC unless needed. IMO if this is like PL330 where you just stick some raw AXI attributes in a register and that's what goes out on transactions then it's not really part of the platform description anyway, it's just driver policy. If folks want to tweak the driver's behaviour for secret SoC-specific performance optimisation, then give them some module parameters or a sysfs interface. I'm assuming this has to be purely a performance thing, because I can't see how two different integrations could reasonably depend on different baseline attributes for correctness, and even if they did then you'd be able to determine that from the compatible strings, because they would be different, because those integrations would be fundamentally *not* compatible with each other. Robin.