mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 v33 net-next 4/8] net/nebula-matrix: add chip-wide hardware init/deinit implementation
Date: Tue, 10 Nov 2026 14:51:45 +0000	[thread overview]
Message-ID: <179432230546.994134.4294945675510273127@kernel.org> (raw)
In-Reply-To: <20261106045631.2224-5-illusion.wang@nebula-matrix.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

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] nbl_dvn_init() and nbl_uvn_init() in nbl_hw_leonis.c turn the
  relaxed-ordering (RO) enables in two chip-wide registers on or off:…

--

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. They
program the DP datapath registers (DPED, UPED, SHAPING, DSCH, USTORE,
DSTORE, DVN, UVN, UQM, PADPT) and drive the driver_status handshake
with firmware.

> 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..2b55f2c2518b4 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,719 @@ static void nbl_hw_get_fw_eth_map(struct nbl_hw_mgt *hw_mgt, u32 *eth_map)

[ ... ]

> +static void nbl_dvn_init(struct nbl_hw_mgt *hw_mgt, u8 speed)
> +{
> +	u32 timeout = 0;
> +	u32 ro_flag = 0;
> +

[ ... ]

> +	spin_lock(&hw_mgt->reg_lock);
> +	nbl_hw_rd_regs(hw_mgt, NBL_DVN_DIF_REQ_RD_RO_FLAG, &ro_flag,
> +		       sizeof(ro_flag));
> +	if (pcie_relaxed_ordering_enabled(hw_mgt->common->pdev)) {
> +		ro_flag |=
> +			FIELD_PREP(NBL_DVN_DIF_REQ_RD_RO_FLAG_DESC_RO_EN_MASK,
> +				   1) |
> +			FIELD_PREP(NBL_DVN_DIF_REQ_RD_RO_FLAG_DATA_RO_EN_MASK,
> +				   1) |
> +			FIELD_PREP(NBL_DVN_DIF_REQ_RD_RO_FLAG_AVRING_RO_EN_MASK,
> +				   1);
> +	} else {

[ ... ]

> +	}
> +	nbl_hw_wr_regs(hw_mgt, NBL_DVN_DIF_REQ_RD_RO_FLAG, &ro_flag,
> +		       sizeof(ro_flag));
> +	spin_unlock(&hw_mgt->reg_lock);

[ ... ]

> +static void nbl_uvn_init(struct nbl_hw_mgt *hw_mgt)
> +{

[ ... ]

> +	ro_enabled = pcie_relaxed_ordering_enabled(hw_mgt->common->pdev);
> +
> +	nbl_hw_rd_regs(hw_mgt, NBL_UVN_DIF_REQ_RO_FLAG, &flag, sizeof(flag));
> +	if (ro_enabled) {
> +		flag |= FIELD_PREP(NBL_UVN_DIF_REQ_RO_FLAG_AVAIL_RD_MASK, 1) |
> +		FIELD_PREP(NBL_UVN_DIF_REQ_RO_FLAG_DESC_RD_MASK, 1) |
> +		FIELD_PREP(NBL_UVN_DIF_REQ_RO_FLAG_PKT_WR_MASK, 1);
> +		flag &= ~FIELD_PREP(NBL_UVN_DIF_REQ_RO_FLAG_DESC_WR_MASK, 1);
> +	} else {

[ ... ]

> +	}
> +	nbl_hw_wr_regs(hw_mgt, NBL_UVN_DIF_REQ_RO_FLAG, &flag, sizeof(flag));

[Severity: Medium]
Both of these RO flag registers seem to be single chip-wide registers
in the DP block, not per-function ones:

#define NBL_DVN_DIF_REQ_RD_RO_FLAG		(NBL_DP_DVN_BASE + 0x0000045C)
#define NBL_UVN_DIF_REQ_RO_FLAG			(NBL_DP_UVN_BASE + 0x00000250)

nbl_res_chip_init_module() in nbl_chip.c runs this only on the
control PF:

	if (!common->has_ctrl)
		return -EINVAL;

That means nbl_dvn_init() and nbl_uvn_init() check
PCI_EXP_DEVCTL_RELAX_EN only on the control PF's pdev, and that one bit
sets relaxed ordering for every function's queues on the chip.

In PCIe, Enable Relaxed Ordering is a per-function permission. Suppose
a sibling PF has RO cleared in its own DEVCTL, for example by a guest
that owns it through vfio-pci, by setpci, or by a driver applying an
erratum. If the control PF has RO enabled, would the DVN/UVN engines
still issue RO-tagged descriptor and avail-ring reads, and RO packet
writes, for that sibling's queues?

The value is also read only once, here. deinit_module() leaves it
programmed, so later DEVCTL changes on any function are never picked
up.

Does the hardware also gate the RO attribute on each requester
function's own DEVCTL? If not, could this use the AND of RO enable
across all functions on the chip, or program RO per function if the
hardware supports that? If the hardware does gate it per function,
could a comment here say so?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261106045631.2224-1-illusion.wang%40nebula-matrix.com

  reply	other threads:[~2026-11-10 14:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  4:56 [PATCH v33 net-next 0/8] nbl driver for Nebulamatrix NICs illusion.wang
2026-11-06  4:56 ` [PATCH v33 net-next 1/8] net/nebula-matrix: add channel layer illusion.wang
2026-11-10 14:51   ` netdev-bot+sashiko
2026-11-06  4:56 ` [PATCH v33 net-next 2/8] net/nebula-matrix: add common resource implementation illusion.wang
2026-11-10 14:51   ` netdev-bot+sashiko
2026-11-06  4:56 ` [PATCH v33 net-next 3/8] net/nebula-matrix: add intr " illusion.wang
2026-11-10 14:51   ` netdev-bot+sashiko
2026-11-06  4:56 ` [PATCH v33 net-next 4/8] net/nebula-matrix: add chip-wide hardware init/deinit implementation illusion.wang
2026-11-10 14:51   ` netdev-bot+sashiko [this message]
2026-11-06  4:56 ` [PATCH v33 net-next 5/8] net/nebula-matrix: dispatch: add control-level routing core infrastructure illusion.wang
2026-11-06  4:56 ` [PATCH v33 net-next 6/8] net/nebula-matrix: dispatch: implement channel RPC framework and serialize hardware ops illusion.wang
2026-11-10 14:51   ` netdev-bot+sashiko
2026-11-06  4:56 ` [PATCH v33 net-next 7/8] net/nebula-matrix: add common/ctrl dev init/remove operation illusion.wang
2026-11-10 14:51   ` netdev-bot+sashiko
2026-11-06  4:56 ` [PATCH v33 net-next 8/8] net/nebula-matrix: add common dev start/stop operation illusion.wang
2026-11-10 14:51   ` netdev-bot+sashiko
  -- strict thread matches above, loose matches on Subject: below --
2026-11-02  7:54 [PATCH v33 net-next 0/8] nbl driver for Nebulamatrix NICs illusion.wang
2026-11-02  7:54 ` [PATCH v33 net-next 4/8] net/nebula-matrix: add chip-wide hardware init/deinit implementation illusion.wang

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=179432230546.994134.4294945675510273127@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

all inboxes | Powered by JetHome®