Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3930723iog; Tue, 21 Jun 2022 08:38:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tE6ztY6O3UcccQVszskb6GH8gLji3iZj1e9zobWt1qa6LV+MOwuGynHkYUAHKDm+S3QzsP X-Received: by 2002:a17:90b:17cb:b0:1ec:9d52:46f7 with SMTP id me11-20020a17090b17cb00b001ec9d5246f7mr14989154pjb.221.1655825923632; Tue, 21 Jun 2022 08:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655825923; cv=none; d=google.com; s=arc-20160816; b=ePtb9meacDFnPyK5L7e1Ur4KIRCnO1NEYjic5MrLhriD3wobU5uM8eDwZfmU4a2OnI +YcHHn/0751aYpvvOYOTPzb7s6qPuwGlyu1gCfQOo74GbPkDNTZRmZfOalHHCblPxPSv iD6QQfFdzxbpgiCw2SUaUQmfdBYrKDmFpwQZtVMv6iA+ZHLP9TxP5fDYep7pe1kT2yYY UnbXyB1rilOHhAfYSWjI6PlMLkV7RftOf/+vx2gNYK4rGZgtcbSUplthVvhAFIC+Leg9 rWhwjhEF//jXQJgJPAqPvOXqJRbb91Fnm+iXDGiQK9FiZGosgWoxrPjGwsWfJrV8HgAw BF4A== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qkLkkEKATJb5pkfQ5oEQJ9EstKfkkqOHIkwqubEEDs8=; b=nL983hQHCWEiMhaJk9X3GscmKPeisMsfFMDveU8x1NoVxn8FiNu+a7etj61wB2uZSL ygxEpyKAGfYtcwaWAjfv4U2DRXb5gvWwzEHxhVzg4k8dPV+iQ3PYeV73NA/5+nbLhBXB 58gmDWVXeEJzTL4z5u5pcrcO8rOE9hqQw41yxujPIsHgWGTiM911qZCzxU6l0phSli7Z ben7TA1AZzOqWiNfjBr3A/7Wn4FwEepWGvpAJwtOCwhaBfT4V2122iA9xToBUxinNDHo cHPMNkQpuj51b7HqTWpVlHRNuOTfnOvDgZakQAPNp3AlV/SsotDh2d860F4CbofSik89 mLjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J+wNc6FA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z14-20020a056a00240e00b0050ad2c9d507si22533377pfh.170.2022.06.21.08.38.31; Tue, 21 Jun 2022 08:38:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=k20201202 header.b=J+wNc6FA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233534AbiFUPbu (ORCPT + 99 others); Tue, 21 Jun 2022 11:31:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230298AbiFUPbs (ORCPT ); Tue, 21 Jun 2022 11:31:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D2C52A731 for ; Tue, 21 Jun 2022 08:31:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 21720B81A66 for ; Tue, 21 Jun 2022 15:31:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6833DC3411C; Tue, 21 Jun 2022 15:31:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655825504; bh=QH3IfRsSkOBT2QoawtIpMgrweswcjVapae4Wk3ONlV8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=J+wNc6FA3rkYWrp8fwJUfky57rP86Uxjyvbcd7iQYPgaH2FerjUFC8K8EUc/WgjU0 frAsYm1jnhlzLexwmdYgS3YehxbOpcMxCnzsW3BE9UMHQquRT1efwLTsQrA08MvXMM xIFQfEIEuBMsvjq5ujgerCbZVZK9aoR1hsoHnZpGBQs+Gm4a2xrB9qGRDHN6M7SlKL Uke9ZpHBhwL5R7vkZac0eeITMTvo9shL/cgBBHTvu64zgZzIEG5jhjsuEPzLrwa40k S3EksluD+0T6ZGGx9Mxy8taDn8bnIkcfY9j2FMYuV/rDore+ylSlI+5I+z9slj9dsZ J6TX2rkquI2Pw== Date: Tue, 21 Jun 2022 16:31:40 +0100 From: Mark Brown To: Aisheng Dong Cc: "linux-kernel@vger.kernel.org" , "dongas86@gmail.com" , "l.stach@pengutronix.de" , Peng Fan , "shawnguo@kernel.org" Subject: Re: [PATCH RFC 1/2] regmap: add option to disable debugfs Message-ID: References: <20220620134758.1286480-1-aisheng.dong@nxp.com> <20220620134758.1286480-2-aisheng.dong@nxp.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="j+2qesJ+vOzgaqpI" Content-Disposition: inline In-Reply-To: X-Cookie: Edited for television. X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-kernel@vger.kernel.org --j+2qesJ+vOzgaqpI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 21, 2022 at 02:56:58PM +0000, Aisheng Dong wrote: > > so if we can't satisfy the read from the cache then we'll hit the cache_only > > check and return -EBUSY before we start trying to do any physical I/O. The > > debugfs code will handle that gracefully, indicating that it couldn't get a value > > for the volatile register by showing all Xs for the value. If none of the registers > > are cached then the file won't be terribly useful but it at least shouldn't cause > > any errors with accessing the device when it's powered down. > That means we have to use cache_only mode to workaround the issue, right? > I saw that cache_only mode has to be explicated enable/disable by driver, > commonly used in device rpm in kernel right now. Yes. > However, things are a little bit complicated on i.MX that 1) imx blkctl > needs follow strict registers r/w flow interleaved with handshakes with upstream gpc > power operations and delay may be needed between registers writing > 2) blkctl itself does not enable runtime pm, it simply call rpm to resume upstream power > domains devices and necessary clocks before r/w registers. I'm not sure I fully understand the issue here? If the driver can safely manage the hardware surely it can safely manage cache only mode too? If there are duplicate resumes then cache only enable/disable is a boolean flag rather than refcounted so that shouldn't be a problem. > Furthermore, current imx blkctl is a common driver used by many devices [1]. > Introducing volatile registers and cache may bloat the driver a lot unnecessarily. You don't actually need to have a cache to use cache only mode, if there are no cached registers then you'll just get -EBUSY on any access to the registers but that's hopefully fine since at the minute things will just fall over anyway. You shouldn't even need to flag registers as volatile if there's no cache since it's not really relevant without a cache. > The simplest way for i.MX case may be just disabling debugfs as it can't reflect the actually > HW state without power. So we would wish the regmap core could provide an option to users. The goal here is to describe the regmap itself so that there's less fragility as things change and we don't needlessly disable anything else that happens to be added to debugfs in the future due to having an overly generic flag, and we get the ability to directly catch access to the hardware that misses doing power management properly while we're at it. We already have a way to describe it being unsafe to access the hardware, we may as well use it. > And I noticed that syscon [2] seems have the same issue since the following commit: > commit 9b947a13e7f6017f18470f665992dbae267852b3 > Author: David Lechner > Date: Mon Feb 19 15:43:02 2018 -0600 > regmap: use debugfs even when no device > This registers regmaps with debugfs even when they do not have an > associated device. For example, this is common for syscon regmaps. That's a different thing, that's due to us naming the directory after the struct device but syscons being created before we have that struct device available. --j+2qesJ+vOzgaqpI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmKx5FsACgkQJNaLcl1U h9D+1Af/YqAqXUsZeXJsnvaUzq+RcR0sZ+pLAVSE+gKYxIGycNrmBpV7XAIbpLxt ctXCX3Lk799GaVZjmS9CY2n11Ep1niPK9IrVxuLTgAEwZwz8psGZ4OJPHT3Ip9QF 13MYSXL4o40Na78gegF2UZzO/jrJKymxPnWZqrS+VHDdZ+ibq/2Q0bBH+MTkBDKI WPYu3lRYprVSqCRNY0G/4X/oLmN/2Yw/b5LWFIu98GcYYJe10vd90W+/VQM2IzJ5 N5hX+5ignDx5RVzCP1zCjnbTXk0NVigN9yqzM+JlB76JnxyC519V+LGqJLoaICVH 10MT2ZIFbFDyANt9dA8SzqaLcZACMQ== =CERs -----END PGP SIGNATURE----- --j+2qesJ+vOzgaqpI--