Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3519433pxb; Mon, 4 Apr 2022 19:40:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKfVo0HlFIzFvFBrglMfLHHtZ0MNaXLNhyMVfc2KceIsFtSD9YoUEuUTxGdrtpgxV1YnVH X-Received: by 2002:a17:903:1204:b0:156:29c3:d9d with SMTP id l4-20020a170903120400b0015629c30d9dmr1182574plh.28.1649126435147; Mon, 04 Apr 2022 19:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649126435; cv=none; d=google.com; s=arc-20160816; b=kbrPCrvZJ1Jc5HoPyg8WLb5yVLU4cDSiPEO51Rpa92eOF8BW8atEqoxauWEIwTZR/F VMWr3oe8vxTZRAcxGNa+DUhJRCovsXOE1pnifkUQpidk0x/dBp84G/7q64QRpeh/iB0I bGncggTaDg1SVU9YdQ91iLWsIRHPMhLY2hr9Oxyv9MdJZLc6a7D3l3BuBgMnOrGvetoa fwpeEWKTB7jHb2AQ8wY1TYmP4feW+Y7M+idxSd7omFlNJVvxDt/Z0UAPMUf6inGDHHSs n4vT6vMAhpuczvXteU2GYdqHH+jhmELGRwGlYkOiA6fEkJ9bvn5AgA0WwcL5E83DF/C8 WHqg== 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=aWb1vneMNdO4I+dHX//w3MB83P6h9JFY1v7rmJyHdNI=; b=wTAmHMlqGkQoFSJ58fZyalIObKPo9PNByJ3+C1+awCUvpYKPGqIPqgf1fcxMuLZ/fC xfxJqoFmsFI/zfX4AxKfcFT7cP3KLa2Vuu8fu8uyY1O1ySE9k7XMZyIYIDs5ojiY5SHz zDLqNn0qhJCaB7Ozmm/9kFuqySt6P7Xtdj4WnesKLJKuDWCPEbfxuTp0hELe1DtzQc/3 8oc+Oq4mgojCjffZnvrvtaL5MPMj5zWD9IGTgkbXv/a6ys4avyfam8w+DCMpKZCPwsbX dpi6D0OelFAIRc1151+icUZupvJKRYK1z+Na19jzV8kQXE9V7TCDVOMcMT/cWy/5ElGT /6QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=V6V+nZiR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id hk15-20020a17090b224f00b001c72275b573si762314pjb.173.2022.04.04.19.40.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 19:40:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=V6V+nZiR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7ACE83E1A6F; Mon, 4 Apr 2022 18:04:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240530AbiDDXF7 (ORCPT + 99 others); Mon, 4 Apr 2022 19:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237119AbiDDXFA (ORCPT ); Mon, 4 Apr 2022 19:05:00 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46127517D2; Mon, 4 Apr 2022 15:27:06 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: nfraprado) with ESMTPSA id 1476F1F43EA0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1649111224; bh=3+nKW5iKfQmdcwOoDUp3zgRqQuK2Dx38gYYsYKrusng=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V6V+nZiR4O8ho6cRwitzFdlaJUXWzALDN6BldHWRYPi8x+GXwK5PvdbnSlm42eEUY vyu9hxWy9UUw+8ExaSUCknsF1UVWf+dkJUqwsC2JP/5FKka2Kp9jWv0vZ0HQ0njrMz 8VFbWm8+yzfkeVlDjl6CJ0cPP5Y6qhXKPMPs1Gb/PlduJ7EJJgjJ/dr2p5hxwUHAcj ew+Jm0MfC7z+O3CWVpM/tFtZ3n2iQKQZK8jp2brLRlW3OLZm+MJ9wqWAlcDjNZw1bz 9XAlbvT6OLsuDWFvKeFSCvqtt4BBk74hg9Xpp6Gl1ma34pw2taZOk1F7Aq0Ndufmrx WWBl7iBZq2HLw== Date: Mon, 4 Apr 2022 18:26:59 -0400 From: =?utf-8?B?TsOtY29sYXMgRi4gUi4gQS4=?= Prado To: AngeloGioacchino Del Regno Cc: Krzysztof Kozlowski , lee.jones@linaro.org, robh+dt@kernel.org, krzk+dt@kernel.org, arnd@arndb.de, matthias.bgg@gmail.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com Subject: Re: [PATCH 2/2] dt-bindings: mfd: syscon: Add support for regmap fast-io Message-ID: <20220404222659.yn2wrda5xtbmvul7@notapiano> References: <20220401135048.23245-1-angelogioacchino.delregno@collabora.com> <20220401135048.23245-3-angelogioacchino.delregno@collabora.com> <8588a941-6d3e-9e14-cb21-d7af29b4b2bd@linaro.org> <7775eb70-692f-3f1b-f226-f7e0fad47e37@collabora.com> <26af9701-267d-5a23-8688-24608617d3f6@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=no 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-kernel@vger.kernel.org On Mon, Apr 04, 2022 at 11:39:49AM +0200, AngeloGioacchino Del Regno wrote: > Il 04/04/22 10:55, Krzysztof Kozlowski ha scritto: > > On 04/04/2022 10:40, AngeloGioacchino Del Regno wrote: > > > Il 02/04/22 13:38, Krzysztof Kozlowski ha scritto: > > > > On 01/04/2022 15:50, AngeloGioacchino Del Regno wrote: > > > > > The syscon driver now enables the .fast_io regmap configuration when > > > > > the 'fast-io' property is found in a syscon node. > > > > > > > > > > Keeping in mind that, in regmap, fast_io is checked only if we are > > > > > not using hardware spinlocks, allow the fast-io property only if > > > > > there is no hwlocks reference (and vice-versa). > > > > > > > > I have doubts you need a property for this. "fast" is subjective in > > > > terms of hardware, so this looks more like a software property, not > > > > hardware. > > > > > > > > I think most of MMIOs inside a SoC are considered fast. Usually also the > > > > syscon/regmap consumer knows which regmap it gets, so knows that it is > > > > fast or not. > > > > > > > > > > Hello Krzysztof, > > > > > > well yes, this property is changing how software behaves - specifically, > > > as you've correctly understood, what regmap does. > > > > > > It's true that most of MMIOs inside a SoC are considered fast.. the word "most" is > > > the exact reason why I haven't proposed simply hardcoding '.fast_io = true' in > > > syscon, or in regmap-mmio... > > > There are too many different SoCs around, and I didn't want to end up breaking > > > anything (even if it should be unlikely, since MMIO is fast by principle). Hi Angelo, I think I can see what Krzysztof means by saying this looks more like a software property. This property isn't simply saying whether the hardware is fast or not by itself, since that's relative. Rather, it means that this hardware is fast relative to the time overhead of using a mutex for locking in regmap. Since this is a software construct, the property as a whole is software-dependent. If for some reason the locking in regmap were to be changed and was now a lot faster or slower, the same hardware could now be considered "fast" or "slow". This seems to me a good reason to avoid making "fastness" part of the ABI for each hardware. > > > > What I am proposing, is the regmap consumer knows whether access is fast > > or not, so it could call get_regmap() or > > syscon_regmap_lookup_by_phandle() with appropriate argument. > > > > Even if we stay with a DT property, I am not sure if this is an > > attribute of syscon but rather of a bus. > > > > Best regards, > > Krzysztof > > I'm sorry for sending a v2 so fast - apparently, I initially didn't fully > understand your comment, but now it's clear. > > Actually, since locking in regmap's configuration does not use DT at all > in any generic case, maybe bringing this change purely in code may be a > good one... and I have evaluated that before proposing this kind of change. > > My concerns about that kind of approach are: > - First of all, there are * a lot * of drivers, in various subsystems, that > are using syscon, so changing some function parameter in syscon.c would > result in a commit that would be touching hundreds of them... and some of > them would be incorrect, as the default would be no fast-io, while they > should indeed enable that. Of course this would have to be changed later > by the respective driver maintainer(s), potentially creating a lot of > commit noise with lots of Fixes tags, which I am trying to avoid; > - Not all drivers are using the same syscon exported function to get a > handle to regmap and we're looking at 6 of them; changing only one of > the six would be rather confusing, and most probably logically incorrect > as well... > > Of course you know, but for the sake of making this easily understandable > for any casual developers reading this, functions are: > - device_node_to_regmap() > - syscon_node_to_regmap() > - syscon_regmap_lookup_by_compatible() > - syscon_regmap_lookup_by_phandle() > - syscon_regmap_lookup_by_phandle_args() > - syscon_regmap_lookup_by_phandle_optional(). What if a separate function was added with the additional regmap configuration argument? That way setting the "fast_io" would be opt-in much like a DT property would. The other drivers wouldn't need to be changed. Thanks, N?colas