[PATCH v4 0/2] regmap: Introduce validity info for flat cache

Sander Vanheule posted 2 patches 3 months, 2 weeks ago
There is a newer version of this series
drivers/base/regmap/internal.h      |  1 +
drivers/base/regmap/regcache-flat.c | 98 +++++++++++++++++++++++++----
drivers/base/regmap/regcache.c      |  1 +
drivers/base/regmap/regmap-kunit.c  | 14 +++++
include/linux/regmap.h              |  1 +
5 files changed, 104 insertions(+), 11 deletions(-)
[PATCH v4 0/2] regmap: Introduce validity info for flat cache
Posted by Sander Vanheule 3 months, 2 weeks ago
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/e461ca08-ad28-44fe-85f1-afe332c1d43d@topic.nl/
---
Changes since v3:
Link: https://lore.kernel.org/lkml/20250109180256.6269-1-sander@svanheule.net/
- Split changes into two patches to provide a migration path

Changes since v2:
Link: https://lore.kernel.org/all/20250109151106.38645-1-sander@svanheule.net/
- Complete renaming of index variables so regcache-flat.c compiles again

Changes since v1:
Link: https://lore.kernel.org/all/20241231100256.194753-1-sander@svanheule.net/
- 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 | 98 +++++++++++++++++++++++++----
 drivers/base/regmap/regcache.c      |  1 +
 drivers/base/regmap/regmap-kunit.c  | 14 +++++
 include/linux/regmap.h              |  1 +
 5 files changed, 104 insertions(+), 11 deletions(-)

-- 
2.51.0