From: netdev-bot+sashiko@kernel.org
To: illusion.wang@nebula-matrix.com
Cc: dimon.zhao@nebula-matrix.com, alvin.wang@nebula-matrix.com,
sam.chen@nebula-matrix.com, netdev@vger.kernel.org,
kuba@kernel.org, andrew+netdev@lunn.ch, pabeni@redhat.com,
edumazet@google.com, horms@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v34 net-next 4/8] net/nebula-matrix: add chip-wide hardware init/deinit implementation
Date: Mon, 16 Nov 2026 13:54:43 +0000 [thread overview]
Message-ID: <179483728389.3136.12160393764038697386@kernel.org> (raw)
In-Reply-To: <20261112094925.6098-5-illusion.wang@nebula-matrix.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The control-PF probe has no real handshake with the
asynchronous firmware cleanup pass; it relies only on a fixed 2-3 ms…
- [Medium] nbl_hw_set_driver_status() changes bit16 of
NBL_DRIVER_STATUS_REG (0x1300444) with a read-modify-write:…
- [Low] The patch adds a firmware ABI dependency with no version or
capability gate.
--
net/nebula-matrix: add chip-wide hardware init/deinit implementation
This adds the Leonis chip-wide init_module() and deinit_module() hooks in
the hw and resource layers. They run only on the control PF.
init_module() programs the chip-wide datapath registers and sets the
driver_status bit. deinit_module() clears the bit and sleeps 2-3 ms for
the asynchronous firmware cleanup. A stale driver_status bit is also
cleared at probe time in nbl_hw_init_leonis().
> diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c b/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c
> index 75d6982ae1e83..371c317daaedd 100644
> --- a/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c
> +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c
[ ... ]
> @@ -150,6 +175,742 @@ static void nbl_hw_get_fw_eth_map(struct nbl_hw_mgt *hw_mgt, u32 *eth_map)
> *eth_map = FIELD_GET(NBL_FW_BOARD_DW6_ETH_BITMAP_MASK, data);
> }
>
> +static u32 nbl_hw_get_quirks(struct nbl_hw_mgt *hw_mgt)
> +{
> + u32 quirks = 0;
> +
> + /*
> + * Read quirk bits from mailbox register.
> + * All supported firmware implement the quirk ABI,
> + * firmware always populates NBL_LEONIS_QUIRKS_OFFSET.
> + * Value ~0U indicates no active quirks.
> + */
> + nbl_hw_read_mbx_regs(hw_mgt, NBL_LEONIS_QUIRKS_OFFSET, &quirks,
> + sizeof(u32));
> +
> + if (quirks == ~0u)
> + return 0;
> +
> + return quirks;
> +}
[Severity: Low]
The comment says all supported firmware fills in NBL_LEONIS_QUIRKS_OFFSET.
However, neither the code nor the commit message names a minimum firmware
version. Nothing gates this read on a firmware version or capability
either.
nbl_uvn_init() then uses BIT(1) of this word to choose the UVN descriptor
prefetch mode:
FIELD_PREP(NBL_UVN_DESC_PREFETCH_INIT_SEL_MASK,
(quirks & NBL_QUIRK_UVN_PREFETCH_ALIGN) ? 0 : 1);
On firmware that does not fill in offset 0x140, any value with BIT(1) set
other than ~0U would switch the RX prefetch mode to sel=0. No message is
printed when that happens.
Could the minimum firmware version be documented? Alternatively, could
this read be gated on a firmware version or capability check?
[ ... ]
> +static void nbl_hw_set_driver_status(struct nbl_hw_mgt *hw_mgt, bool active)
> +{
> + u32 status;
> +
> + spin_lock(&hw_mgt->reg_lock);
> + status = nbl_hw_rd32(hw_mgt, NBL_DRIVER_STATUS_REG);
> +
> + status &= ~BIT(NBL_DRIVER_STATUS_BIT);
> + status |= FIELD_PREP(BIT(NBL_DRIVER_STATUS_BIT), active);
> +
> + nbl_hw_wr32(hw_mgt, NBL_DRIVER_STATUS_REG, status);
> + spin_unlock(&hw_mgt->reg_lock);
> +}
[Severity: Medium]
NBL_DRIVER_STATUS_REG is documented as shared with firmware, and every
bit except bit 16 belongs to firmware. reg_lock only serializes host
CPUs.
If firmware updates one of its bits between the nbl_hw_rd32() and the
nbl_hw_wr32() here, won't that update be overwritten with the stale
value?
All three callers go through this read-modify-write:
nbl_hw_clear_stale_status() at probe, nbl_hw_init_module() and
nbl_hw_deinit_module().
The header comment says no such firmware write is known. It also says
that this is an observation about this hardware revision, not something
the driver enforces. What happens to firmware if one of its bits is
written back stale is not documented.
Would a driver-owned register or a firmware-acknowledged mailbox command
be a safer way to signal that the driver is present?
[ ... ]
> +static void nbl_hw_deinit_module(struct nbl_hw_mgt *hw_mgt)
> +{
> + nbl_hw_set_driver_status(hw_mgt, false);
> + /* ensure driver_status reaches the chip */
> + nbl_flush_writes(hw_mgt);
> + /*
> + * Give the asynchronous firmware cleanup pass time to settle
> + * before returning; best-effort, see NBL_FW_CLEANUP_SYNC_MIN_US.
> + */
> + usleep_range(NBL_FW_CLEANUP_SYNC_MIN_US, NBL_FW_CLEANUP_SYNC_MAX_US);
> +}
[ ... ]
> +static void nbl_hw_clear_stale_status(struct nbl_hw_mgt *hw_mgt)
> +{
> + u32 status;
> +
> + if (!hw_mgt->common->has_ctrl)
> + return;
> +
[ ... ]
> + status = nbl_hw_rd32(hw_mgt, NBL_DRIVER_STATUS_REG);
> + if (!(status & BIT(NBL_DRIVER_STATUS_BIT)))
> + return;
> +
> + dev_warn(hw_mgt->common->dev,
> + "driver_status already set, stale cleanup forced\n");
> + nbl_hw_set_driver_status(hw_mgt, false);
> + nbl_flush_writes(hw_mgt);
> + usleep_range(NBL_FW_CLEANUP_SYNC_MIN_US, NBL_FW_CLEANUP_SYNC_MAX_US);
> +}
[Severity: Medium]
Is the 2-3 ms sleep enough to order this probe after the firmware
cleanup pass?
Later in the series ("net/nebula-matrix: add common/ctrl dev init/remove
operation"), nbl_dev_init() runs after this function. It programs exactly
the state that the firmware pass reclaims:
if (common->has_ctrl)
nbl_dev_setup_chan_qinfo(dev_mgt, NBL_CHAN_TYPE_MAILBOX);
...
ret = nbl_dev_setup_common_dev(adapter);
The pass can run longer than the window. The commit message gives an
ECPU still busy right after kexec as one example. Firmware would then
wipe the mailbox QINFO routing and qinfo registers that probe has just
programmed.
No error is reported. Sibling PFs' RPCs in nbl_dev_start() then time
out, and their probes fail.
The unbind/rebind path looks similar. nbl_hw_deinit_module() sleeps
2-3 ms and returns. The next probe of the control PF reads bit 16 as 0.
It then returns early from nbl_hw_clear_stale_status() without waiting
and starts programming the routing right away.
The device link orders the siblings against the control PF. Does
anything order the control PF's next probe against its own previous
cleanup pass?
The nbl_hw_deinit_module() comment says "Both steps are far slower than
the firmware pass". There doesn't seem to be a documented firmware
latency behind that.
Is there a firmware acknowledgement that could be waited on instead,
such as a mailbox command or another register that firmware writes? If
not, could a much larger margin be used on the stale-clear and teardown
paths?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112094925.6098-1-illusion.wang%40nebula-matrix.com
next prev parent reply other threads:[~2026-11-16 13:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 9:49 [PATCH v34 net-next 0/8] nbl driver for Nebulamatrix NICs illusion.wang
2026-11-12 9:49 ` [PATCH v34 net-next 1/8] net/nebula-matrix: add channel layer illusion.wang
2026-11-12 12:01 ` Breno Leitao
2026-11-16 13:54 ` netdev-bot+sashiko
2026-11-12 9:49 ` [PATCH v34 net-next 2/8] net/nebula-matrix: add common resource implementation illusion.wang
2026-11-16 13:54 ` netdev-bot+sashiko
2026-11-12 9:49 ` [PATCH v34 net-next 3/8] net/nebula-matrix: add intr " illusion.wang
2026-11-16 13:54 ` netdev-bot+sashiko
2026-11-12 9:49 ` [PATCH v34 net-next 4/8] net/nebula-matrix: add chip-wide hardware init/deinit implementation illusion.wang
2026-11-16 13:54 ` netdev-bot+sashiko [this message]
2026-11-12 9:49 ` [PATCH v34 net-next 5/8] net/nebula-matrix: dispatch: add control-level routing core infrastructure illusion.wang
2026-11-16 13:54 ` netdev-bot+sashiko
2026-11-12 9:49 ` [PATCH v34 net-next 6/8] net/nebula-matrix: dispatch: add mailbox RPCs for msix map, mailbox irq and vsi/eth id illusion.wang
2026-11-16 13:54 ` netdev-bot+sashiko
2026-11-12 9:49 ` [PATCH v34 net-next 7/8] net/nebula-matrix: add common/ctrl dev init/remove operation illusion.wang
2026-11-16 13:54 ` netdev-bot+sashiko
2026-11-12 9:49 ` [PATCH v34 net-next 8/8] net/nebula-matrix: add common dev start/stop operation illusion.wang
2026-11-16 13:54 ` netdev-bot+sashiko
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=179483728389.3136.12160393764038697386@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alvin.wang@nebula-matrix.com \
--cc=andrew+netdev@lunn.ch \
--cc=dimon.zhao@nebula-matrix.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=illusion.wang@nebula-matrix.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sam.chen@nebula-matrix.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