From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v14 2/3] perf: Add Raspberry Pi BCM2835 AXI PMU driver
Date: Sat, 03 Oct 2026 01:33:27 +0000 [thread overview]
Message-ID: <20261003013327.5849F1F00899@smtp.kernel.org> (raw)
In-Reply-To: <20261002175738.3242646-3-irogers@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] perf/rpi_axi_pmu: Endianness bug in VPU mailbox IPC payloads
--
commit 5a995c8809331bd8433a8a216b6077dd563f9f07
Author: Ian Rogers <irogers@google.com>
perf: Add Raspberry Pi BCM2835 AXI PMU driver
Adds a PMU driver for the Raspberry Pi AXI performance monitors, providing
access to the System and VideoCore performance counters natively through
the perf subsystem on Broadcom BCM2835 and BCM2711 platforms.
> diff --git a/drivers/perf/rpi_axi_pmu.c b/drivers/perf/rpi_axi_pmu.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/perf/rpi_axi_pmu.c
[ ... ]
> +static void set_monitor_control(struct rpi_axi_pmu *pmu, enum monitor mon, u32 set)
> +{
> + if (pmu->monitor[mon].use_mailbox_interface) {
> + u32 tmp[3] = {pmu->monitor[mon].mailbox + GEN_CTRL, 1, set};
[Severity: Medium]
Will this payload work correctly on big-endian architectures?
The VPU mailbox communication appears to use native u32 arrays for its
payloads here without explicit cpu_to_le32() conversions. Does this cause
the little-endian VideoCore VPU to read swapped bytes when the driver is
compiled for big-endian systems?
> + int err;
[ ... ]
> +static void set_bus_watcher_control(struct rpi_axi_pmu *pmu, enum monitor mon, int idx, u32 set)
> +{
> + int watcher = watcher_offset(idx);
> +
> + if (pmu->monitor[mon].use_mailbox_interface) {
> + u32 tmp[3] = {pmu->monitor[mon].mailbox + watcher, 1, set};
[Severity: Medium]
Similarly, does this watcher configuration payload require endianness
conversions to prevent hardware communication failures on big-endian
systems?
> + int err;
[ ... ]
> +static u32 rpi_axi_pmu_read_counter(struct rpi_axi_pmu *pmu, enum monitor mon, int idx,
> + enum counter counter)
> +{
> + int watcher = watcher_offset(idx);
> + int offset = counter_offset(counter);
> + u32 ret;
> + /* Use READ_ONCE to prevent KCSAN data race warnings during lockless IPC reads */
> + if (!READ_ONCE(pmu->monitor[mon].hw_events.enabled[idx]))
> + return 0;
> + if (pmu->monitor[mon].use_mailbox_interface) {
> + u32 tmp[3] = {
> + pmu->monitor[mon].mailbox + watcher + offset,
> + 1, -1
> + };
> + int err;
> +
> + might_sleep();
> + lockdep_assert_held(&pmu->vpu_mutex);
> + if (WARN_ON_ONCE(in_interrupt() || irqs_disabled()))
> + return -1;
> + err = rpi_firmware_property(pmu->firmware,
> + RPI_FIRMWARE_GET_PERIPH_REG,
> + tmp, sizeof(tmp));
> + if (err < 0 || tmp[1] != 1) {
> + dev_err_ratelimited(&pmu->pdev->dev, "Failed to read bus watcher\n");
> + /* Return U32_MAX on IPC failure. */
> + return U32_MAX;
> + }
> + ret = tmp[2];
[Severity: Medium]
When the read response is received, is a le32_to_cpu() conversion needed on
tmp[2] before it is consumed?
Using proper endianness conversions would align with other Broadcom
firmware drivers like clk-raspberrypi to correctly interface with the
hardware.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261002175738.3242646-1-irogers@google.com?part=2
next prev parent reply other threads:[~2026-10-03 1:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 17:57 [PATCH v14 0/3] perf: Add Raspberry Pi AXI PMU driver Ian Rogers
2026-10-02 17:57 ` [PATCH v14 1/3] dt-bindings: perf: Add Broadcom Raspberry Pi AXI PMU definition Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-04 7:31 ` Krzysztof Kozlowski
2026-10-02 17:57 ` [PATCH v14 2/3] perf: Add Raspberry Pi BCM2835 AXI PMU driver Ian Rogers
2026-10-03 1:33 ` sashiko-bot [this message]
2026-10-02 17:57 ` [PATCH v14 3/3] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-10-03 1:33 ` sashiko-bot
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=20261003013327.5849F1F00899@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=irogers@google.com \
--cc=linux-perf-users@vger.kernel.org \
--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