Skip to content

regmap: Introduce validity info for flat cache

Sander Vanheule lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest2 patches 1 replyIn review
  2. v52 patches 3 repliesSuperseded
  3. v42 patches 3 repliesSuperseded

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2regmap: add flat cache with sparse validitydrivers/base/regmap/internal.h drivers/base/regmap/regcache-flat.c drivers/base/regmap/regcache.c +2 more+126 -170 replies
2/2regmap: warn users about uninitialized flat cachedrivers/base/regmap/regcache-flat.c+6 -120 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH v6 0/2] regmap: Introduce validity info for flat cache

The flat cache behaves differently from the other caches, in that it has no way of knowing if a cache entry is valid. Initialization has to happen either by providing defaults, by loading defaults from hardware (via num_reg_defaults_raw), or by performing the required register writes. This difference in behavior may be unexpected to the user [1].

To provide feature parity between the different cache types, a new variant of the flat cache is proposed. This allows user to migrate to the sparse flat cache (or a different cache type) when possible.

In order to encourage migration, the second patch adds a new warning to inform the user of their suspicious cache.

[1] https://lore.kernel.org/linux-gpio/[email protected]/
---
Changes since v5:

- zero-initialize cache for compatibiliy
- Update regcache_type comment to document the difference between the flat caches

Changes since v4:

- Improve formatting of log message
- Reduce logging to not confuse KUnit test result parser
- Add sparse flat cache to all KUnit config lists

Changes since v3:

- Split changes into two patches to provide a migration path

Changes since v2:

- Complete renaming of index variables so regcache-flat.c compiles again

Changes since v1:

- Fix off-by-one in length for bitmap_clear()
- Add REGCACHE_FLAT to the list of sparse cache tests

Sander Vanheule (2):
regmap: add flat cache with sparse validity
regmap: warn users about uninitialized flat cache

 drivers/base/regmap/internal.h      |  1 +
 drivers/base/regmap/regcache-flat.c | 96 +++++++++++++++++++++++++----
 drivers/base/regmap/regcache.c      |  1 +
 drivers/base/regmap/regmap-kunit.c  | 22 +++++++
 include/linux/regmap.h              | 17 +++--
 5 files changed, 120 insertions(+), 17 deletions(-)
Signature · 1 line
2.51.0