Article View: linux.kernel.netdev
Article #18675Re: [PATCH net-next v3 2/3] i2c: xiic: add KUnit coverage for register access modes
From: netdev-bot+sashiko
Date: Wed, 18 Nov 2026 18:22
Date: Wed, 18 Nov 2026 18:22
96 lines
11696 bytes
11696 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The new KUnit suite cannot catch a regression in the forced
32-bit read path of xiic_getreg8().
--
i2c: xiic: add KUnit coverage for register access modes
This adds a KUnit suite that is compiled into i2c-xiic.c and tests the
driver's private register accessors against RAM-backed registers. It
covers native and forced 32-bit accesses in both byte orders across 22
register offsets. It only builds on direct x86-64 MMIO.
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index 275aaa7f35833..0a7a2aeb78909 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -1322,6 +1322,21 @@ config I2C_XILINX
[ ... ]
> +config I2C_XILINX_KUNIT_TEST
> + bool "KUnit tests for Xilinx I2C register accesses" if !KUNIT_ALL_TESTS
> + depends on I2C_XILINX && KUNIT=y
> + depends on X86_64 && !UML && !INDIRECT_IOMEM
> + default KUNIT_ALL_TESTS
> + help
> + Test the Xilinx I2C driver's register accessors with both byte orders
> + and with native-width or forced 32-bit accesses. The tests use
> + allocated RAM in place of registers. This relies on the direct
> + x86-64 MMIO accessor implementation; no controller is required.
[ ... ]
> diff --git a/drivers/i2c/busses/tests/i2c_xiic_kunit.c b/drivers/i2c/busses/tests/i2c_xiic_kunit.c
> new file mode 100644
> index 0000000000000..1b691de7e9250
> --- /dev/null
> +++ b/drivers/i2c/busses/tests/i2c_xiic_kunit.c
> @@ -0,0 +1,91 @@
[ ... ]
> + for (i = 0; i < ARRAY_SIZE(offsets); i++) {
> + reg = offsets[i];
> + memset(mem, 0xa5, 0x200);
> +
> + xiic_setreg8(i2c, reg, 0xc0);
> + expected = param->force_32bit_access ? 0xc0 : 0xa5a5a5c0;
> + KUNIT_EXPECT_EQ(test, (u32)xiic_getreg32(i2c, reg), expected);
> + KUNIT_EXPECT_EQ(test, xiic_getreg8(i2c, reg), (u8)0xc0);
[Severity: Low]
Would this check, or any of the other xiic_getreg8() checks in
xiic_register_access(), catch a regression in the forced 32-bit read path?
In xiic_getreg8(), the forced path is:
if (i2c->force_32bit_access)
return xiic_getreg32(i2c, reg);
Without it, the function does ioread8(base + reg) for LITTLE and
ioread8(base + reg + 3) for BIG.
In the word_little_endian and word_big_endian cases, every value is first
stored as a zero-extended 32-bit word. With RAM-backed registers, the byte
at reg + 0 (LE) or reg + 3 (BE) is always the low byte of that word. The
native 8-bit read and the truncated 32-bit read therefore return the same
value (0xc0, 0xff, 0x78, 0xef).
So it looks like the force_32bit_access branch could be removed from
xiic_getreg8() and all four parameterized cases would still pass.
The write side is covered, because the upper bytes (0xc0 vs 0xa5a5a5c0)
would catch a subword store. The read side is the one behind the machine
check from ioread8() in xiic_clear_rx_fifo(). That machine check is what
motivated "i2c: xiic: allow platforms to require 32-bit register
accesses".
The changelog says "These tests do not validate physical bus transaction
widths". The Kconfig help text above, however, says the accessors are
tested "with native-width or forced 32-bit accesses", and does not mention
that read width can't be observed.
Could that limit be documented in the Kconfig help or in a test comment?
Alternatively, the accessor could be instrumented so the read width can be
checked.
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116-wiwi-v3-87afa10a8-0-ahmadexp%40gmail.com
Technical Details
Message-ID:
<179502617695.3136.6995182814188526026@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366330-linux-kernel-netdev=dewy.ruReferences:
<20261116-wiwi-v3-87afa10a8-2-ahmadexp@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366330-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v3 2/3] i2c: xiic: add KUnit coverage for register access modes Date: Wed, 18 Nov 2026 18:22:56 +0000 Organization: Usenet Network Message-ID: <179502617695.3136.6995182814188526026@kernel.org> References: <20261116-wiwi-v3-87afa10a8-2-ahmadexp@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2663167"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:hTeNJ87enlb7/dtnMvScpBQ6ADw= sha256:7BVsgefvEL5H+DDo8vWQfn5QF1Y785fEcOQemK6pjts= sha1:2hQtW/AEmOEDB9I1sjUEEL4tnlE= sha256:+syZRGo0ZZhQDgRnd61IXqnX5kyWuHMQTmbp1T/PNXw= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id B62F6115362; Wed, 18 Nov 2026 21:24:15 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BkFBvXuYHmji; Wed, 18 Nov 2026 21:24:11 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366330-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 84620115359; Wed, 18 Nov 2026 21:24:03 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id C55F6C87EA; Wed, 18 Nov 2026 18:23:26 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795026184; b=a0Dpc7jD90C+n4B5Y8jOB6LBGrqGl30SWJ0CvIqLJs02RXt/PjZUwd2YK3miDs8SEObY corMkhkToU75xhvM4dvFsUYEURierYuNJWfqlWIwKQ6iESJwxqLTx0eUwavEW5P6OZpcQ laS+UwsVZoebMCqNaZULqeEt8dYw/5Hr6ar3L8VlPemkrB7ffObVYRUDPKlHCyfh/nZCE F8Va/IZsgUqa5gyfNdE6bnNdO4ry+9j4dLVkOxIwdDUQraAtJr+QJyONXg9PfWBy4T3Yh sEwhJVuS7EtyYXQsl7apE9gYkvp0V3ai3pKK9dHs5JVSxXYoXXRW/EyVHFJsM31pEvw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795026184; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=83nStTpRlBCM/kV50VhrxEdv2aiG0+hQRKw/q7fknCY=; b=bWjokaZYEONx9vB3J60Iuobsy6bfpa2w/akaT88RdvF89BKhPlb+On0LLthSyWaxUG5i 8nwK7vJkrTqcF99j11gSQPm+8HoWN7YcLhrjtwFK7FdZxAHUc9HL+KWNQ36V9IugVf0rk XgNDzaRkiEzxOKDHikZsYmZ5knVDPhS0O9/4SKNhRAWjCfv7oO2/1hncIq6PrnUZTP2Bx DohvDfascB2QI4en2yUGBR5dIu3skgrFCEPvrgHB6voxpOSQ4Nv64UeUZpwwZ5pAxDt03 KkEw2IfyoBnnKKuhz/R2s6n0RyGxE2l4Z+6wuyHv2D1aInYZ49QA0GKLB4wbCX5deuw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eII3R7u7; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3DD4F606A33E; Wed, 18 Nov 2026 18:23:04 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eII3R7u7 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795026178; b=oJ+LKH5dSpZLyAlyCPlHKw6YvmAF/nSp1H2mxPBx7WWNBV3gn4ZChgtZCLLd5rIIK3gJ Goj9nJUjiwEWgYNbFfGb4INet7SX5EyqIotBrIka2maIk54/B4WPcTGeaghlcNJ0IMw8n Gt9Bg2gDzxnXjMZbf7a5Z1nZUfgyUl3Gc14PW15gU0PfxCRGVMbpzA1taCvUPIGTJryh9 Nv34v1tfKJniiw+89IIUEM0eWczMlFvyeEwkYZ8HNKxxW3mWIeBf3J1TSTbtY7fgAJMBD v9u7ldmHjcDQ1/uj/lbqeUn0lPnPcNShjtShZjlLOHAgrt4x6BemWRsQO2YvF9oy8hg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795026178; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=83nStTpRlBCM/kV50VhrxEdv2aiG0+hQRKw/q7fknCY=; b=URuyACSULoXRK0FTp8zSFSAhNeoieo2KHrK/X1hISJNywIKK8/QJKLK2cl2uCBW88eHu KRDWsJxB0kyDX/pUBCQEzt11l1ORq72yousCYgZGcWpkL2gCPWV3QLspa9fm2YklfmO6W PFZ0UnzIzWbBI82DX5dxkr/bJSLQEuQ5z+pBD9qct5JDlOXFwkC+DJPGQuJqHsHgJpPZT qBijFNu/EyhYwVwAOR0Uc1txO297hkcqPsP9h18mLbI2wLexIZ0sYfjXqldjGD/kfQmkP hAoaHpM1FQBtbNmWB4VvJv9tao+oHqmS7CoINCAaTVIYG+kr/HcbCN+DrPVhJop7Ksg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eII3R7u7; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DE4460A261E; Wed, 18 Nov 2026 18:22:58 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A7DF1F000C8; Wed, 18 Nov 2026 18:22:57 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795026178; bh=83nStTpRlBCM/kV50VhrxEdv2aiG0+hQRKw/q7fknCY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=eII3R7u7v+X2x1cFXYrljudcwtferg62bDURLm2cIFnu3j5CNP2STMqyzoGsWjLhD CTenu2E6o1AeSniswhlkMZ47mbHlieoKultgsbf2CzFFqdeXnpft66Pj8fybn0Ccox fAHyHVBu4ZAr6eDacCmoEH51jTb5N/uxQrvfA2zkZKldHZ10s1elkrjfhuL6gXsYeE tR5YVe7Dn3DOdNEtL8eAh+mVp19AIZSzgEiZOmdfUgsWSUX4+4UjNZWZ3tol3MWHJ1 OktnGuoWQgsQwzmQzw2xwfwDjKmdWN3mY0MElmnwYO69H+z8GbtoV4eqRrBlxUn4u9 rZPekT8TuIzdA== X-Cc: netdev@vger.kernel.org, vadim.fedorenko@linux.dev, andi.shyti@kernel.org, andrew+netdev@lunn.ch, corbet@lwn.net, davem@davemloft.net, edumazet@kernel.org, horms@kernel.org, jiri@resnulli.us, kuba@kernel.org, linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, pabeni@redhat.com, rdunlap@infradead.org, richardcochran@gmail.com, skhan@linuxfoundation.org X-In-Reply-To: <20261116-wiwi-v3-87afa10a8-2-ahmadexp@gmail.com> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list