Re: [PATCH] regmap: prevent noinc writes from clobbering cache

From: Ben Wolsieffer
Date: Wed Nov 01 2023 - 16:20:24 EST


Hi Mark,

On Wed, Nov 01, 2023 at 05:05:39PM +0000, Mark Brown wrote:
> On Wed, Nov 01, 2023 at 10:29:27AM -0400, Ben Wolsieffer wrote:
> > Currently, noinc writes are cached as if they were standard incrementing
> > writes, overwriting unrelated register values in the cache. Instead, we
> > want to cache the last value written to the register, as is done in the
> > accelerated noinc handler (regmap_noinc_readwrite).
>
> Could you please add a kunit test for this?

I started to look into this, but it is not currently possible to test
noinc behavior with regmap_[raw_]ram. The same bulk write operation is
used by both incrementing and non-incrementing writes, and the difference
in behavior is due to how the hardware handles the bulk write to a
particular register.

To test this behavior, regmap_raw_ram (raw because it supports bulk
writes) would have to be told that certain of its registers should
implement noinc semantics.

Is this something I should implement?

Thanks, Ben