From: "David E. Garcia Porras" <david.garcia@aheadcomputing.com>
To: opensbi@lists.infradead.org
Cc: "David E. Garcia Porras" <david.garcia@aheadcomputing.com>
Subject: [PATCH] lib: utils/regmap: Fix reg_stride calculation in syscon regmap
Date: Fri, 3 Apr 2026 14:29:03 -0600 [thread overview]
Message-ID: <20260403202903.3407945-1-david.garcia@aheadcomputing.com> (raw)
The reg_stride field represents the address stride in bytes between
consecutive registers. The Linux kernel regmap framework validates
register accesses using IS_ALIGNED(reg, map->reg_stride) as an address
alignment check (drivers/base/regmap/regmap.c). The Linux kernel syscon
driver (drivers/mfd/syscon.c) sets reg_stride directly to reg_io_width:
syscon_config.reg_stride = reg_io_width;
The current OpenSBI code incorrectly multiplies reg_io_width by 8,
converting a byte value to bits. Fix this by using reg_io_width directly
as the stride value, consistent with the Linux kernel.
Signed-off-by: David E. Garcia Porras <david.garcia@aheadcomputing.com>
---
lib/utils/regmap/fdt_regmap_syscon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/utils/regmap/fdt_regmap_syscon.c b/lib/utils/regmap/fdt_regmap_syscon.c
index 1309a55c..59cd5ee5 100644
--- a/lib/utils/regmap/fdt_regmap_syscon.c
+++ b/lib/utils/regmap/fdt_regmap_syscon.c
@@ -190,7 +190,7 @@ static int regmap_syscon_init(const void *fdt, int nodeoff,
srm->rmap.id = nodeoff;
srm->rmap.reg_shift = 0;
- srm->rmap.reg_stride = srm->reg_io_width * 8;
+ srm->rmap.reg_stride = srm->reg_io_width;
srm->rmap.reg_base = 0;
srm->rmap.reg_max = size / srm->reg_io_width;
switch (srm->reg_io_width) {
--
2.43.0
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
reply other threads:[~2026-04-03 20:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260403202903.3407945-1-david.garcia@aheadcomputing.com \
--to=david.garcia@aheadcomputing.com \
--cc=opensbi@lists.infradead.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