[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <187bc058ff944dbde0e876efa6e72046bcc2a124.camel@svanheule.net>
Date: Thu, 16 Oct 2025 14:08:41 +0200
From: Sander Vanheule <sander@...nheule.net>
To: Mark Brown <broonie@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki"
<rafael@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] regmap: add cache validity to REGCACHE_FLAT
On Thu, 2025-10-16 at 12:53 +0100, Mark Brown wrote:
> On Thu, Oct 16, 2025 at 10:46:33AM +0200, Sander Vanheule wrote:
>
> > Would you be open to providing a new type of flat cache with sparse
> > initalisation (e.g. REGCACHE_FLAT_SPARSE) to provide the behavior provided
> > by
> > this patches? Most of the code could be shared with REGCACHE_FLAT.
>
> Taking a step back for a minute, what's the actual problem you're trying
> to solve here? Why use a flat cache rather than a maple tree cache for
> your application?
The device I want to use this for has a small contiguous register space, so a
flat cache should be sufficient. The driver can also works with maple (or RB-
tree) cache.
The problem with the current flat cache, is that it provides different caching
behavior than the other cache types. I want to keep the register values written
by the bootloader, so I can't provide defaults. That means a flat cache will
seed these registers with 0x00 values, which don't reflect the hardware state.
Any RMW operation can then cause the part of the register to be cleared, as the
read comes from the (invalid) cache.
This difference in caching behavior isn't (wasn't) immediately clear to me from
the documentation. Don't the different cache types exist to optimize speed or
memory for different use-cases? Because then I would only expect differences in
memory/speed, not in way the cache is initialized.
Best,
Sander
Powered by blists - more mailing lists