Article View: linux.kernel.netdev
Article #17213Re: [PATCH v34 net-next 4/8] net/nebula-matrix: add chip-wide hardware init/deinit implementation
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 13:54
Date: Mon, 16 Nov 2026 13:54
194 lines
14907 bytes
14907 bytes
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
Technical Details
Message-ID:
<179483728389.3136.12160393764038697386@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364383-linux-kernel-netdev=dewy.ruReferences:
<20261112094925.6098-5-illusion.wang@nebula-matrix.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364383-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179483728389.3136.12160393764038697386@kernel.org> References: <20261112094925.6098-5-illusion.wang@nebula-matrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2078495"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:hHive8axkUM0va/EXO33P4EhMUk= sha256:kSvK4smnXf7tdhTqeVGJG6eBjSP+Z+R1kWC/cvSBGhU= sha1:A4brdeQhkDSJKZl+p5hNg8zp6JE= sha256:xgZfq2iK5C7ImhHm1xyDYMwiempNRXST2n83t3FjNrw= 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 5AD4C114C4A; Mon, 16 Nov 2026 16:55:48 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 kj-XOkRSGCCC; Mon, 16 Nov 2026 16:55:43 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-364383-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id A111A114C4E; Mon, 16 Nov 2026 16:55:35 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id A3CA92FD90; Mon, 16 Nov 2026 13:55:15 +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=1794837286; b=mMrOGrIIQbWbYbd8o7g0GbNCD2hP/QlLR61Q1+F+3MolD1umEQXZ57D+duMlbpRfVTss a+MBp0AJaRgjWiDoA768IlYHJRewh2nQf7J3N3F1xjXgz1932n8N8rkdFELQFRuDQHqiv 9qq1BvHvzKuoxAdh+0zTYy0f/O3Pmy/dW3+LKOKmutcAcReSyw8bTVDRx5ofDmvViE8Sc YsoVEBcxN81IWuUWiErrpRxZIkV+nY1cdV9dufBWILOoHqvGk4wriw3OiGXXwJ6ru9nEU EeIKTntxpVwXyAyOH5zWbegm7Zkw10WsWlVrAEdUUCeeinhBiavGZO15kvi2zp20HYg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794837286; 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=QEC5bH3mf6ppNxnqhZUIX9nYzf+HXa3xcTJXq8rdH+s=; b=JiX9uHMtPloX8d11I1mrVfKK4G7L2TMCq4b+Xy/3aibHDqSdGTbjSDCyiYQsKVCIL0Kq XlFvdVj7kICL+Jt2u4gw0iiMFXBbtVZcBzw4O48lBciZQCc9znT4PHRFN5gbAws7u1civ LHesSMuuD6MMfAoTlueFYAX5D5pnMZELnfu/oh5mlZyQJo5hbSLjv+7uQh9NEb+2kXwVp j7dqFVmWYqSHC27sJvC7ahRa1bBoGX2xz9PF7wfI743ZDNPKXzILESIn51qQZYHkvg/KP zGA73eG099eFX0S9QuUbzAmqNB5q4qLf2fVUTSWXsdJSynjaR3MLQyw4zV/kajv03fA== 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=H0u0iGlj; 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 3CD63606A8A2; Mon, 16 Nov 2026 13:54:46 +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=H0u0iGlj 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=1794837285; b=a9f450THlCAyEA25vJb2gW+Uyzmb/dgPChC4KtNQhsz3Llv3ul6COgsKGx/5RzZuIhB2 DqOuM72P8W7lRq8JoPc1ana+mHHQs9an6LEMrWb4CXYI3MAdQqfyLj4/Bx+fd36gWqGHP ifAsicdbDP50C7M/vpd3FUSsiD6coHC211ecxUo5Et73WO2zMqyrPRqo/EJdMwCefIU41 77QppXh9JJtZdal61QQJnYL7aZLN3pXL6GqBxDT9393EI/8xRpYDTb/92LfdnKJyWo3+u GSL5IKkIlZvA/9Pa+JHRmEKm7sKyCLOc15XMMaOmKzxn1XKElz8v1p9zTjOqvDr453Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794837285; 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=QEC5bH3mf6ppNxnqhZUIX9nYzf+HXa3xcTJXq8rdH+s=; b=PdsFeoMxMKpC3jJNjGHxrwdCYtXO/l8LsoZmj4BN2n8Ncpn1FUfRuQnApzkPF8b0A0Mv xLv9E+QDcHSfxyfCOMpnYZBi8s+ZPmoL/7f9565/zFpfdckpPitiuxc73SsE5Y8JJGeWw 1BRFlevM09IJJj40KaOniFkJ+MN4MgAsfVRNvlJD3437jzWjhUTvchNCTB6Rjj8I9mV7K 6uHiOuu3y1W+V9Dvh1vsQmhA4/KM3gNtMx287Celvba9cJTfIyLKtXpRN2ryKsojvRcDC Ed4+bJ0jvncqpv0nqzeZFUER7X4CJB97PKfVwjTvCywDWLgkDKNAOrbVYANt9eOvG2g== 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=H0u0iGlj; 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 5C1FF606A89B; Mon, 16 Nov 2026 13:54:45 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A8D81F000CC; Mon, 16 Nov 2026 13:54:44 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794837285; bh=QEC5bH3mf6ppNxnqhZUIX9nYzf+HXa3xcTJXq8rdH+s=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=H0u0iGlj4EHuczofS5R02f1Rdk34Yf2EFRQtNGSS5GZ+jARa4hGVXydby/6CnEvgA ImopRT5uJkGjz6Z1oeibJP1PHh2umGu2Ekay8u0QyNkhWoItGd/CY9Z0sVTG7IQUm5 p79JlrINdC20IWreuvZOK8auV5xCFqBZK7EBuploxG1yyVcVfylqXX0+ivg4nEs8SL DT4Zi+cylT4FmT+DVgcUoa8DlFYqpsxe3h0d69Uh/ac0j89xoFKg1pCEGDWYfJxGVg Gj4NxT2c7BFUYF59YwOfFR/juI0pzZUpA17j2yyQkdrKfNcYu4rktLnR2UYdVnDEPG zUXU3PNO6rsBQ== X-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 X-In-Reply-To: <20261112094925.6098-5-illusion.wang@nebula-matrix.com> X-sashiko-severity: Medium 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