From: Jakub Kicinski <kuba@kernel.org>
To: jitendra.vegiraju@broadcom.com
Cc: Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, alexandre.torgue@foss.st.com,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
mcoquelin.stm32@gmail.com, bcm-kernel-feedback-list@broadcom.com,
richardcochran@gmail.com, ast@kernel.org, daniel@iogearbox.net,
hawk@kernel.org, john.fastabend@gmail.com,
rmk+kernel@armlinux.org.uk, rohan.g.thomas@altera.com,
linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org, bpf@vger.kernel.org,
andrew+netdev@lunn.ch, horms@kernel.org, sdf@fomichev.me,
me@ziyao.cc, siyanteng@cqsoftware.com.cn,
prabhakar.mahadev-lad.rj@bp.renesas.com,
weishangjuan@eswincomputing.com, wens@kernel.org,
vladimir.oltean@nxp.com, lizhi2@eswincomputing.com,
boon.khai.ng@altera.com, maxime.chevallier@bootlin.com,
chenchuangyu@xiaomi.com, yangtiezhu@loongson.cn,
ovidiu.panait.rb@renesas.com, chenhuacai@kernel.org,
florian.fainelli@broadcom.com, quic_abchauha@quicinc.com
Subject: Re: [PATCH net-next v9 3/4] net: stmmac: Add PCI glue driver for BCM8958x
Date: Mon, 6 Apr 2026 19:10:01 -0700 [thread overview]
Message-ID: <20260407021001.3674617-1-kuba@kernel.org> (raw)
In-Reply-To: <20260402213629.1996133-4-jitendra.vegiraju@broadcom.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
Date: Thu Apr 2 21:36:28 2026 +0000
net: stmmac: Add PCI glue driver for BCM8958x
Add pci ethernet driver support for Broadcom BCM8958x soc devices used
in automotive applications. This device features a pcie ethernet mac
directly attached to an integrated ethernet switch using an xgmii interface.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-brcm.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-brcm.c
> new file mode 100644
> index 0000000000000..e8c6b4b618acb
> --- /dev/null
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-brcm.c
[ ... ]
> +static const struct software_node *brcm_swnodes[] = {
> + &parent_swnode,
> + &fixed_link_swnode,
> + NULL
> +};
Will this statically allocated global software node array cause issues if
multiple devices are present?
If a second device is probed, software_node_register_node_group might fail
with an error. Additionally, if one device is unbound, unregistering the
group could destroy the global nodes, causing a use-after-free for any other
active instances.
Could these software nodes be dynamically allocated per-device?
[ ... ]
> +static int brcm_drv_init(struct device *dev, void *bsp_priv)
> +{
> + struct brcm_priv_data *brcm_priv = (struct brcm_priv_data *)bsp_priv;
> + struct pci_dev *pdev = to_pci_dev(dev);
> + int vector;
> + int ret;
> +
> + /* This device is directly attached to the switch chip internal to the
> + * SoC using XGMII interface. Since no MDIO is present, register
> + * fixed-link software_node to create phylink.
> + */
> + ret = software_node_register_node_group(brcm_swnodes);
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret,
> + "failed to register software_node\n");
> + device_set_node(dev, software_node_fwnode(&parent_swnode));
Does device_set_node overwrite the device's primary firmware node here?
Using device_set_node can destroy existing acpi or device tree companion
nodes. Would it be safer to use device_add_software_node instead to attach
the node without overwriting the primary firmware node?
> +
> + pci_write_config_dword(pdev, XGMAC_PCIE_CFG_MSIX_ADDR_MATCH_LOW,
> + XGMAC_PCIE_CFG_MSIX_ADDR_MATCH_LO_VALUE);
> + pci_write_config_dword(pdev, XGMAC_PCIE_CFG_MSIX_ADDR_MATCH_HIGH,
> + XGMAC_PCIE_CFG_MSIX_ADDR_MATCH_HI_VALUE);
> +
> + misc_iowrite(brcm_priv, XGMAC_PCIE_MISC_MSIX_ADDR_MATCH_LO_OFFSET,
> + XGMAC_PCIE_MISC_MSIX_ADDR_MATCH_LO_VALUE);
> + misc_iowrite(brcm_priv, XGMAC_PCIE_MISC_MSIX_ADDR_MATCH_HI_OFFSET,
> + XGMAC_PCIE_MISC_MSIX_ADDR_MATCH_HI_VALUE);
[ ... ]
> +static void brcm_drv_exit_cleanup(struct device *dev, void *bsp_priv)
> +{
> + struct pci_dev *pdev = to_pci_dev(dev);
> +
> + device_set_node(&pdev->dev, NULL);
> + software_node_unregister_node_group(brcm_swnodes);
> +}
If device_set_node is called with NULL, will it leave the device permanently
mangled without its original firmware node upon unbind?
[ ... ]
> +static int brcm_pci_resume(struct device *dev, void *bsp_priv)
> +{
> + /* Enable Switch Link */
> + misc_iowrite(bsp_priv, XGMAC_PCIE_MISC_MII_CTRL_OFFSET,
> + XGMAC_PCIE_MISC_MII_CTRL_PAUSE_RX |
> + XGMAC_PCIE_MISC_MII_CTRL_PAUSE_TX |
> + XGMAC_PCIE_MISC_MII_CTRL_LINK_UP);
> +
> + return stmmac_pci_plat_resume(dev, bsp_priv);
> +}
Will the hardware state configured in brcm_drv_init be fully restored after
a suspend and resume cycle?
When a pci device resumes from suspend, its internal state is typically reset
to defaults. Since the pci core's pci_save_state does not save arbitrary mmio
registers or custom extended configuration registers, it appears the msi-x
routing and address match configurations programmed during probe might be
lost.
Could this cause the msi-x interrupts to stop working after resume?
next prev parent reply other threads:[~2026-04-07 2:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 21:36 [PATCH net-next v9 0/4] net: stmmac: Add PCI driver support for BCM8958x Jitendra Vegiraju
2026-04-02 21:36 ` [PATCH net-next v9 1/4] net: stmmac: Add DW25GMAC support in stmmac core driver Jitendra Vegiraju
2026-04-07 2:09 ` Jakub Kicinski
2026-04-02 21:36 ` [PATCH net-next v9 2/4] net: stmmac: Integrate dw25gmac into hwif handling Jitendra Vegiraju
2026-04-07 2:09 ` Jakub Kicinski
2026-04-02 21:36 ` [PATCH net-next v9 3/4] net: stmmac: Add PCI glue driver for BCM8958x Jitendra Vegiraju
2026-04-07 2:10 ` Jakub Kicinski [this message]
2026-04-02 21:36 ` [PATCH net-next v9 4/4] net: stmmac: Add BCM8958x driver to build system Jitendra Vegiraju
2026-04-07 2:08 ` Jakub Kicinski
2026-04-07 2:10 ` Jakub Kicinski
2026-04-07 7:24 ` [PATCH net-next v9 0/4] net: stmmac: Add PCI driver support for BCM8958x Russell King (Oracle)
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=20260407021001.3674617-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=boon.khai.ng@altera.com \
--cc=bpf@vger.kernel.org \
--cc=chenchuangyu@xiaomi.com \
--cc=chenhuacai@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=jitendra.vegiraju@broadcom.com \
--cc=john.fastabend@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=lizhi2@eswincomputing.com \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=me@ziyao.cc \
--cc=netdev@vger.kernel.org \
--cc=ovidiu.panait.rb@renesas.com \
--cc=pabeni@redhat.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=quic_abchauha@quicinc.com \
--cc=richardcochran@gmail.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=rohan.g.thomas@altera.com \
--cc=sdf@fomichev.me \
--cc=siyanteng@cqsoftware.com.cn \
--cc=vladimir.oltean@nxp.com \
--cc=weishangjuan@eswincomputing.com \
--cc=wens@kernel.org \
--cc=yangtiezhu@loongson.cn \
/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