linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Mark Brown <broonie@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] regmap: cache: downgrade log level for no cache defaults message
Date: Mon, 28 Nov 2022 15:58:40 +0100	[thread overview]
Message-ID: <3208991.44csPzL39Z@steina-w> (raw)
In-Reply-To: <Y4EX7DLt/Lvde/SJ@sirena.org.uk>

Hello Mark,

Am Freitag, 25. November 2022, 20:30:52 CET schrieb Mark Brown:
> * PGP Signed by an unknown key
> 
> On Wed, Sep 21, 2022 at 09:10:54AM +0200, Alexander Stein wrote:
> > Having no cache defaults is not a mistake, especially for devices
> > which do have some kind of strapping values which can't be provided
> > statically. For this case a warning is the wrong log level, the initial
> > cache values do need to be read form hardware. Reduce level to info.
> > 
> >  	if (!map->reg_defaults_raw) {
> >  	
> >  		bool cache_bypass = map->cache_bypass;
> > 
> > -		dev_warn(map->dev, "No cache defaults, reading back from 
HW\n");
> > +		dev_info(map->dev, "No cache defaults, reading back from 
HW\n");
> 
> This is a warning which is only generated in the case where we have a
> non-sparse cache where we won't read from the hardware in the csae of
> missing values and will instead just substitute zero as a default value.
> It's warning that we might end up changing values for the device
> unexpectedly in the case of a read/modify/write cycle that doesn't
> actually check what the device currently has set.
> 
> In this case if you can't use a rbtree cache I would recommend
> bootstrapping by initially reading without a cache first to get the
> default values, then replacing the regmap with one that uses the
> defaults you just read.  You'll need some care over suspend/resume
> though.

The driver I'm working on clk-renesas-pcie.c only has 8 registers, so there is 
no benefit to use a different cache than REGCACHE_FLAT.

But I currently fail to see why this is only for non-sparse caches. This is 
printed even before the cache_ops init() is called.

Before the call to regcache_hw_init() there is this comment:
> /* Some devices such as PMICs don't have cache defaults,
>  * we cope with this by reading back the HW registers and
>  * crafting the cache defaults by hand.
>  */

This is exactly what I want to do: Read back HW registers and create a cache.
Actually regcache_hw_init() is exactly doing what you are suggesting:
1. reading HW registers into map->reg_defaults_raw
2.
 a) copy them into map->reg_defaults
 b) read HW register individually if 1. failed

So thinking more about this, this warning should be removed altogether IMHO.

Best regards,
Alexander




  reply	other threads:[~2022-11-28 14:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21  7:10 [PATCH 1/1] regmap: cache: downgrade log level for no cache defaults message Alexander Stein
2022-11-25 19:30 ` Mark Brown
2022-11-28 14:58   ` Alexander Stein [this message]
2022-11-28 18:38     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3208991.44csPzL39Z@steina-w \
    --to=alexander.stein@ew.tq-group.com \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).