Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Linus Walleij" <linusw@kernel.org>
Cc: mfd@lists.linux.dev, devicetree@vger.kernel.org,
	linux-clk@vger.kernel.org, linux-hwmon@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org, lee@kernel.org
Subject: Re: [PATCH v3 3/7] mfd: bcmbca-pmb: Add a shared BCMBCA PMC3 PMB transport
Date: Fri, 06 Nov 2026 08:39:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-201080@kernel.org> (raw)
In-Reply-To: <20261106-xg6846b-bcmbca-xrdp-reset-v3-3-d6adeb71afc9@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mfd: bcmbca_pmc3_pmb: debugfs stall, WARN_ON, and HW read in
  regmap init
--

commit df29cb4d33202540fcf38b25c63a3a8cd862dcfb
Author: Linus Walleij <linusw@kernel.org>

mfd: bcmbca-pmb: Add a shared BCMBCA PMC3 PMB transport

This commit adds an MFD driver for the Broadcom BCMBCA PMC3 Processor
Monitor Bus (PMB) that exposes a shared uncached regmap to child devices.

> diff --git a/drivers/mfd/bcmbca_pmc3_pmb.c b/drivers/mfd/bcmbca_pmc3_pmb.c
> new file mode 100644
> index 0000000000000..8ebcbc26a502d
> --- /dev/null
> +++ b/drivers/mfd/bcmbca_pmc3_pmb.c

[ ... ]

> +static bool bcmbca_pmb_precious_reg(struct device *dev, unsigned int reg)
> +{
> +	/* Do not let debugfs probe unimplemented or firmware-owned registers. */
> +	return true;
> +}
> +
> +static struct regmap *bcmbca_pmb_regmap_init(struct bcmbca_pmb *pmb)
> +{
> +	const struct regmap_config config = {
> +		.reg_bits = 32,
> +		.val_bits = 32,
> +		.reg_stride = 1,
> +		.max_register = BCMBCA_PMB_REG(3, 255, 65535),
> +		.cache_type = REGCACHE_NONE,
> +		.precious_reg = bcmbca_pmb_precious_reg,

[Severity: Medium]
Does marking every register precious in bcmbca_pmb_precious_reg() while
setting max_register to BCMBCA_PMB_REG(3, 255, 65535) (0x03ffffff) with
reg_stride = 1 cause a 67M-iteration stall, a WARN_ON(), and an unintended
hardware read when the regmap debugfs files are read?

When the debugfs "registers" or "range" file is read,
regmap_debugfs_get_dump_start() scans all 67,108,864 addresses from 0 to
map->max_register under map->cache_lock.  Because regmap_printable() is
false for every address, map->debugfs_off_cache stays empty,
WARN_ON(list_empty(&map->debugfs_off_cache)) fires on every read, and
regmap_debugfs_get_dump_start() returns base (0).  regmap_read_debugfs()
then starts its loop at start_reg (0) without checking regmap_printable()
on the first iteration and calls regmap_read(map, 0, &val), issuing a
hardware PMB read to BCMBCA_PMB_REG(0, 0, 0).

In addition, because neither readable_reg nor writeable_reg is set, reading
the debugfs "access" file causes regmap_access_show() to format all
67,108,864 addresses into a single_open() seq_file buffer until a >1 GiB
allocation fails with -ENOMEM.

Omitting max_register and precious_reg from config (leaving max_register
at 0 without max_register_is_0) avoids creating the debugfs "registers",
"range", and "access" files while bcmbca_pmb_op() continues to validate
the bus and offset bounds.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106-xg6846b-bcmbca-xrdp-reset-v3-0-d6adeb71afc9@kernel.org?part=3

  reply	other threads:[~2026-11-06  8:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  8:26 [PATCH v3 0/7] BCMBCA PMB power, clock, reset and hardware monitoring support Linus Walleij
2026-11-06  8:26 ` [PATCH v3 1/7] dt-bindings: mfd: Describe the BCM6846 PMC complex Linus Walleij
2026-11-06  8:36   ` sashiko-bot
2026-11-06 12:57   ` Rob Herring (Arm)
2026-11-06  8:26 ` [PATCH v3 2/7] dt-bindings: soc: Describe the BCM6846 Processor Monitor Bus Linus Walleij
2026-11-06  8:43   ` sashiko-bot
2026-11-06 17:03   ` William Zhang
2026-11-06  8:26 ` [PATCH v3 3/7] mfd: bcmbca-pmb: Add a shared BCMBCA PMC3 PMB transport Linus Walleij
2026-11-06  8:39   ` sashiko-bot [this message]
2026-11-06  8:26 ` [PATCH v3 4/7] pmdomain: bcm: Add BCMBCA PMB power domains Linus Walleij
2026-11-06  8:26 ` [PATCH v3 5/7] reset: Add BCMBCA block resets through the PMB Linus Walleij
2026-11-06  8:35   ` sashiko-bot
2026-11-06 11:59   ` Philipp Zabel
2026-11-06  8:26 ` [PATCH v3 6/7] clk: bcm: Add BCMBCA PMB clocks Linus Walleij
2026-11-06  8:26 ` [PATCH v3 7/7] hwmon: Add Broadcom PMB PVTMON monitoring Linus Walleij

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=sashiko-outbox-201080@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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