mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sander Vanheule <sander@svanheule.net>
To: Mark Brown <broonie@kernel.org>, linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Sander Vanheule <sander@svanheule.net>
Subject: [PATCH v6 0/2] regmap: Introduce validity info for flat cache
Date: Wed, 29 Oct 2025 09:12:46 +0100	[thread overview]
Message-ID: <20251029081248.52607-1-sander@svanheule.net> (raw)

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 v5:
Link: https://lore.kernel.org/lkml/20251023135032.229511-1-sander@svanheule.net/
- zero-initialize cache for compatibiliy
- Update regcache_type comment to document the difference between the
  flat caches

Changes since v4:
Link: https://lore.kernel.org/lkml/20251022200408.63027-1-sander@svanheule.net/
- 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:
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 | 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(-)

-- 
2.51.0


             reply	other threads:[~2025-10-29  8:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-29  8:12 Sander Vanheule [this message]
2025-10-29  8:12 ` [PATCH v6 1/2] regmap: add flat cache with sparse validity Sander Vanheule
2025-10-29  8:12 ` [PATCH v6 2/2] regmap: warn users about uninitialized flat cache Sander Vanheule
2025-10-30 11:31 ` [PATCH v6 0/2] regmap: Introduce validity info for " 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=20251029081248.52607-1-sander@svanheule.net \
    --to=sander@svanheule.net \
    --cc=broonie@kernel.org \
    --cc=dakr@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

all inboxes | Powered by JetHome®