From: sashiko-bot@kernel.org
To: "Tim Michals" <tcmichals@gmail.com>
Cc: linux-sunxi@lists.linux.dev, robh@kernel.org,
devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 6/7] remoteproc: sunxi: add KUnit test suite for sunxi remoteproc driver
Date: Sun, 27 Sep 2026 00:32:16 +0000 [thread overview]
Message-ID: <20260927003216.F400B1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260927002021.797069-7-tcmichals@gmail.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] remoteproc: sunxi: KUnit test mock MMIO reads fail on big-endian
- [Medium] remoteproc: sunxi: false positive KUnit test for kick_msg
- [Low] remoteproc: sunxi: missing Kconfig dependency for KUnit tests
--
commit a4fcce16cf194ed8872772bf791e111976827604
Author: Tim Michals <tcmichals@gmail.com>
remoteproc: sunxi: add KUnit test suite for sunxi remoteproc driver
Add comprehensive in-kernel KUnit unit test suite (34 tests) for the
Allwinner sunxi remoteproc driver.
> diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
> index d35b033b9106d..c2bddfd955665 100644
> --- a/drivers/remoteproc/Kconfig
> +++ b/drivers/remoteproc/Kconfig
[ ... ]
> @@ -396,6 +396,16 @@ config SUNXI_REMOTEPROC
> co-processor on Allwinner A523, A527, and T527 SoCs via the
> remote processor framework.
>
> +config SUNXI_REMOTEPROC_KUNIT_TEST
> + tristate "KUnit tests for Allwinner sunxi remoteproc" if !KUNIT_ALL_TESTS
> + depends on KUNIT
[Severity: Low]
Will this allow incompatible build configurations?
If the test is built-in (=y) but the driver is built as a module (=m) or
disabled (=n), the linker will fail with undefined references since vmlinux
cannot link against module-only symbols. Should this include a
depends on SUNXI_REMOTEPROC statement to enforce proper dependencies?
> + default KUNIT_ALL_TESTS
> + help
> + KUnit tests for the Allwinner sunxi_rproc driver, covering
> + da_to_va() address translation logic and boundary conditions
> + across dedicated SRAM spaces, DRAM carveouts, and trace regions.
> + Say Y here to run these tests during boot or via kunit.py.
> +
> endif # REMOTEPROC
> diff --git a/drivers/remoteproc/sunxi_rproc_test.c b/drivers/remoteproc/sunxi_rproc_test.c
> new file mode 100644
> index 0000000000000..2546f850f30bd
> --- /dev/null
> +++ b/drivers/remoteproc/sunxi_rproc_test.c
[ ... ]
> +static void test_start_bootaddr_programming(struct kunit *test)
> +{
> + struct test_context *ctx = create_test_ctx(test);
> + int ret;
> +
> + ctx->priv.cfg_va = (void __iomem *)ctx->mock_cfg_regs;
> + ctx->rproc.bootaddr = 0x40014000;
> +
> + ret = sunxi_rproc_start(&ctx->rproc);
> + KUNIT_EXPECT_EQ(test, ret, 0);
> +
> + /* Check that bootaddr was written to STA_ADD_REG (offset 0x204) */
> + KUNIT_EXPECT_EQ(test, ctx->mock_cfg_regs[E906_STA_ADD_REG / 4], 0x40014000U);
[Severity: Medium]
Could this direct array read cause spurious test failures on big-endian
architectures?
The driver code uses writel() for I/O register programming, which mandates a
little-endian memory layout and performs automatic byte-swapping on
big-endian CPUs. Directly reading the raw u32 array elements bypasses this.
On a big-endian architecture, the direct read will interpret the
little-endian bytes in memory as a big-endian integer, returning a
byte-swapped value instead of the expected 0x40014000. Should this test use
readl() to retrieve the value in CPU-endian format?
[ ... ]
> +static void test_prepare_and_unprepare_remap(struct kunit *test)
> +{
> + struct test_context *ctx = create_test_ctx(test);
> + int ret;
[ ... ]
> + /* prepare() should set SUNXI_REMAP_SRAMA3_2_BIT (bit 1) */
> + ret = sunxi_rproc_prepare(&ctx->rproc);
> + KUNIT_EXPECT_EQ(test, ret, 0);
> + KUNIT_EXPECT_EQ(test, ctx->mock_remap_reg & SUNXI_REMAP_SRAMA3_2_BIT,
> + SUNXI_REMAP_SRAMA3_2_BIT);
[Severity: Medium]
Does this bitwise check need to account for endianness as well?
Because writel() wrote the bit in little-endian order, this native bitwise
check against mock_remap_reg will also fail on big-endian systems.
[ ... ]
> +static void test_kick_stores_vqid(struct kunit *test)
> +{
> + struct test_context *ctx = create_test_ctx(test);
> +
> + /* Verify kick_msg stores the passed vqid to avoid stack UAF */
> + ctx->priv.kick_msg = 0xDEADBEEF;
> + ctx->priv.tx_chan = NULL; /* Avoid mbox_send_message dispatch */
> +
> + sunxi_rproc_kick(&ctx->rproc, 1);
> + /* Without tx_chan, returns before writing kick_msg */
> + KUNIT_EXPECT_EQ(test, ctx->priv.kick_msg, 0xDEADBEEFU);
[Severity: Medium]
Is this test validating the intended assignment?
The test intentionally sets ctx->priv.tx_chan to NULL to prevent dispatching.
However, looking at sunxi_rproc_kick(), this triggers an early return guard:
void sunxi_rproc_kick(struct rproc *rproc, int vqid)
{
...
if (!priv->tx_chan)
return;
priv->kick_msg = (u32)vqid;
...
}
Consequently, the assignment to priv->kick_msg never occurs. The test then
asserts against the unmodified initial 0xDEADBEEFU value, which passes
spuriously without actually exercising the assignment logic.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260927002021.797069-1-tcmichals@gmail.com?part=6
next prev parent reply other threads:[~2026-09-27 0:32 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260922034711.190253-1-tcmichals@gmail.com>
2026-09-22 3:47 ` [PATCH 1/7] dt-bindings: mailbox: add Allwinner sun55i msgbox schema Tim Michals
2026-09-22 3:54 ` sashiko-bot
2026-09-22 8:54 ` Krzysztof Kozlowski
2026-09-22 3:47 ` [PATCH 4/7] dt-bindings: remoteproc: add allwinner sun55i rproc binding Tim Michals
2026-09-22 3:56 ` sashiko-bot
2026-09-22 8:58 ` Krzysztof Kozlowski
2026-09-22 12:46 ` Rob Herring (Arm)
2026-09-22 3:47 ` [PATCH 7/7] arm64: dts: allwinner: add a523 msgbox and remoteproc nodes Tim Michals
2026-09-22 3:59 ` sashiko-bot
2026-09-27 0:20 ` [PATCH v2 0/7] remoteproc: sunxi: Add Allwinner XuanTie E907 RemoteProc and Message Box support Tim Michals
2026-09-27 0:20 ` [PATCH v2 1/7] dt-bindings: mailbox: add Allwinner sun55i msgbox schema Tim Michals
2026-09-27 0:30 ` sashiko-bot
2026-10-01 6:16 ` Krzysztof Kozlowski
2026-09-27 0:20 ` [PATCH v2 2/7] mailbox: sun55i: add Allwinner sun55i/sun60i 4-port Message Box driver Tim Michals
2026-09-27 0:33 ` sashiko-bot
2026-09-27 0:20 ` [PATCH v2 3/7] mailbox: sun55i: add KUnit test suite for sun55i msgbox driver Tim Michals
2026-09-27 0:31 ` sashiko-bot
2026-09-27 0:20 ` [PATCH v2 4/7] dt-bindings: remoteproc: add Allwinner sun55i-rproc schema Tim Michals
2026-09-27 0:27 ` sashiko-bot
2026-10-01 6:17 ` Krzysztof Kozlowski
2026-09-27 0:20 ` [PATCH v2 5/7] remoteproc: sunxi: add Allwinner XuanTie RISC-V remoteproc driver Tim Michals
2026-09-27 0:33 ` sashiko-bot
2026-09-27 0:20 ` [PATCH v2 6/7] remoteproc: sunxi: add KUnit test suite for sunxi " Tim Michals
2026-09-27 0:32 ` sashiko-bot [this message]
2026-09-27 0:20 ` [PATCH v2 7/7] arm64: dts: allwinner: add a523 msgbox and remoteproc nodes Tim Michals
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=20260927003216.F400B1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tcmichals@gmail.com \
/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