Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] tg3: Add support for boards integrated with security SoCs
@ 2026-11-18 15:02 Pavan Chebbi
  2026-11-22 15:11 ` netdev-bot+sashiko
  0 siblings, 1 reply; 2+ messages in thread
From: Pavan Chebbi @ 2026-11-18 15:02 UTC (permalink / raw)
  To: michael.chan, kuba
  Cc: andrew+netdev, andrew.gospodarek, davem, edumazet, netdev, pabeni,
	Pavan Chebbi

Add support for Broadcom NetXtreme NX1 network interface controllers
integrated with security SoCs. This enables proper driver recognition
and initialization for these hardware Root of Trust enabled network
adapters.

The boards are identified by their PCI subsystem IDs. Add the new
subsystem device IDs and a helper that matches them.

These boards need the following deviations from the default behavior:

- Never drive GPIO1. These boards use GPIO1 for mailbox communication
  between SoC and the NIC, internal to the board, so it must not
  be driven externally and is always kept cleared. Skip it when
  switching to Vaux or Vmain power, and do not set it in
  tp->grc_local_ctrl.

- Do not enable EEPROM write protection, even if the NIC config in
  SRAM requests it.

- Do not enable Wake-on-LAN. These boards reuse the GPIO that
  Wake-on-LAN depends on for other purposes, so Wake-on-LAN cannot
  work on these devices. Clear WOL_CAP so that it is not advertised.

Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
---
 drivers/net/ethernet/broadcom/tg3.c | 52 ++++++++++++++++++++++++++++-
 drivers/net/ethernet/broadcom/tg3.h | 13 ++++++++
 2 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 95827df4cf6a..9c431f76d4a5 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -2840,6 +2840,9 @@ static void tg3_pwrsrc_die_with_vmain(struct tg3 *tp)
 	    tg3_asic_rev(tp) == ASIC_REV_5701)
 		return;
 
+	if (tg3_flag(tp, CITADEL))
+		return;
+
 	grc_local_ctrl = tp->grc_local_ctrl | GRC_LCLCTRL_GPIO_OE1;
 
 	tw32_wait_f(GRC_LOCAL_CTRL,
@@ -2913,6 +2916,9 @@ static void tg3_pwrsrc_switch_to_vaux(struct tg3 *tp)
 			grc_local_ctrl &= ~(GRC_LCLCTRL_GPIO_OE2 |
 					    GRC_LCLCTRL_GPIO_OUTPUT2);
 		}
+		if (tg3_flag(tp, CITADEL))
+			grc_local_ctrl &= ~(GRC_LCLCTRL_GPIO_OE1 |
+					    GRC_LCLCTRL_GPIO_OUTPUT1);
 		tw32_wait_f(GRC_LOCAL_CTRL,
 			    tp->grc_local_ctrl | grc_local_ctrl,
 			    TG3_GRC_LCLCTL_PWRSW_DELAY);
@@ -10537,7 +10543,10 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy)
 		tp->grc_local_ctrl |= tr32(GRC_LOCAL_CTRL) & gpio_mask;
 
 		/* GPIO1 must be driven high for eeprom write protect */
-		if (tg3_flag(tp, EEPROM_WRITE_PROT))
+		if (tg3_flag(tp, CITADEL))
+			tp->grc_local_ctrl &= ~(GRC_LCLCTRL_GPIO_OE1 |
+						GRC_LCLCTRL_GPIO_OUTPUT1);
+		else if (tg3_flag(tp, EEPROM_WRITE_PROT))
 			tp->grc_local_ctrl |= (GRC_LCLCTRL_GPIO_OE1 |
 					       GRC_LCLCTRL_GPIO_OUTPUT1);
 	}
@@ -15220,6 +15229,38 @@ static struct subsys_tbl_ent *tg3_lookup_by_subsys(struct tg3 *tp)
 	return NULL;
 }
 
+static bool tg3_is_citadel(struct tg3 *tp)
+{
+	if (tp->pdev->subsystem_vendor == TG3PCI_SUBVENDOR_ID_BROADCOM) {
+		switch (tp->pdev->subsystem_device) {
+		case TG3PCI_SUBDEVICE_ID_CITADEL_BEVERLYWOOD:
+		case TG3PCI_SUBDEVICE_ID_CITADEL_BEL_AIR:
+		case TG3PCI_SUBDEVICE_ID_CHANNEL_2908:
+		case TG3PCI_SUBDEVICE_ID_CHANNEL_2909:
+		case TG3PCI_SUBDEVICE_ID_CHANNEL_2906:
+		case TG3PCI_SUBDEVICE_ID_CHANNEL_E14A:
+		case TG3PCI_SUBDEVICE_ID_CHANNEL_E34A:
+		case TG3PCI_SUBDEVICE_ID_CHANNEL_2904:
+		case TG3PCI_SUBDEVICE_ID_CHANNEL_2905:
+			return true;
+		default:
+			return false;
+		}
+	}
+
+	if (tp->pdev->subsystem_vendor == TG3PCI_SUBVENDOR_ID_DELL) {
+		switch (tp->pdev->subsystem_device) {
+		case TG3PCI_SUBDEVICE_ID_DELL_5720_L21T00:
+		case TG3PCI_SUBDEVICE_ID_DELL_5720_XE9880L:
+			return true;
+		default:
+			return false;
+		}
+	}
+
+	return false;
+}
+
 static void tg3_get_eeprom_hw_cfg(struct tg3 *tp)
 {
 	u32 val;
@@ -15231,6 +15272,9 @@ static void tg3_get_eeprom_hw_cfg(struct tg3 *tp)
 	tg3_flag_set(tp, EEPROM_WRITE_PROT);
 	tg3_flag_set(tp, WOL_CAP);
 
+	if (tg3_is_citadel(tp))
+		tg3_flag_set(tp, CITADEL);
+
 	if (tg3_asic_rev(tp) == ASIC_REV_5906) {
 		if (!(tr32(PCIE_TRANSACTION_CFG) & PCIE_TRANS_CFG_LOM)) {
 			tg3_flag_clear(tp, EEPROM_WRITE_PROT);
@@ -15430,6 +15474,12 @@ static void tg3_get_eeprom_hw_cfg(struct tg3 *tp)
 			tp->phy_flags |= TG3_PHYFLG_DISABLE_1G_HD_ADV;
 	}
 done:
+	if (tg3_flag(tp, CITADEL)) {
+		tg3_flag_clear(tp, EEPROM_WRITE_PROT);
+		tg3_flag_clear(tp, WOL_CAP);
+		tg3_flag_clear(tp, WOL_ENABLE);
+	}
+
 	if (tg3_flag(tp, WOL_CAP))
 		device_set_wakeup_enable(&tp->pdev->dev,
 					 tg3_flag(tp, WOL_ENABLE));
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
index a9e7f88fa26d..713fe9c821e2 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -100,6 +100,8 @@
 #define TG3PCI_SUBDEVICE_ID_DELL_MERLOT		0x0109
 #define TG3PCI_SUBDEVICE_ID_DELL_SLIM_MERLOT	0x010a
 #define TG3PCI_SUBDEVICE_ID_DELL_5762		0x07f0
+#define TG3PCI_SUBDEVICE_ID_DELL_5720_L21T00	0x0e19
+#define TG3PCI_SUBDEVICE_ID_DELL_5720_XE9880L	0x0ea1
 #define TG3PCI_SUBVENDOR_ID_COMPAQ		PCI_VENDOR_ID_COMPAQ
 #define TG3PCI_SUBDEVICE_ID_COMPAQ_BANSHEE	0x007c
 #define TG3PCI_SUBDEVICE_ID_COMPAQ_BANSHEE_2	0x009a
@@ -111,6 +113,16 @@
 #define TG3PCI_SUBDEVICE_ID_ACER_57780_A	0x0601
 #define TG3PCI_SUBDEVICE_ID_ACER_57780_B	0x0612
 #define TG3PCI_SUBDEVICE_ID_LENOVO_5787M	0x3056
+/* NetXtreme NX1 boards integrated with Citadel security SoCs */
+#define TG3PCI_SUBDEVICE_ID_CITADEL_BEVERLYWOOD	0xd346
+#define TG3PCI_SUBDEVICE_ID_CITADEL_BEL_AIR	0xd146
+#define TG3PCI_SUBDEVICE_ID_CHANNEL_2908	0x2908
+#define TG3PCI_SUBDEVICE_ID_CHANNEL_2909	0x2909
+#define TG3PCI_SUBDEVICE_ID_CHANNEL_2906	0x2906
+#define TG3PCI_SUBDEVICE_ID_CHANNEL_E14A	0xe14a
+#define TG3PCI_SUBDEVICE_ID_CHANNEL_E34A	0xe34a
+#define TG3PCI_SUBDEVICE_ID_CHANNEL_2904	0x2904
+#define TG3PCI_SUBDEVICE_ID_CHANNEL_2905	0x2905
 
 /* 0x30 --> 0x64 unused */
 #define TG3PCI_MSI_DATA			0x00000064
@@ -3122,6 +3134,7 @@ enum TG3_FLAGS {
 	TG3_FLAG_ROBOSWITCH,
 	TG3_FLAG_ONE_DMA_AT_ONCE,
 	TG3_FLAG_RGMII_MODE,
+	TG3_FLAG_CITADEL,
 
 	/* Add new flags before this comment and TG3_FLAG_NUMBER_OF_FLAGS */
 	TG3_FLAG_NUMBER_OF_FLAGS,	/* Last entry in enum TG3_FLAGS */
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] tg3: Add support for boards integrated with security SoCs
  2026-11-18 15:02 [PATCH net-next] tg3: Add support for boards integrated with security SoCs Pavan Chebbi
@ 2026-11-22 15:11 ` netdev-bot+sashiko
  0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sashiko @ 2026-11-22 15:11 UTC (permalink / raw)
  To: pavan.chebbi
  Cc: michael.chan, kuba, andrew+netdev, andrew.gospodarek, davem,
	edumazet, netdev, pabeni

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

Critical: 0 · High: 0 · Medium: 1 · 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] On Citadel boards, tg3_get_eeprom_hw_cfg()
  (drivers/net/ethernet/broadcom/tg3.c) can leak a registered…
- [Low] The existing comment '/* GPIO1 must be driven high for eeprom
  write protect */' in tg3_reset_hw()…

--

tg3: Add support for boards integrated with security SoCs

This patch adds support for Broadcom NetXtreme NX1 boards that are
integrated with security SoCs. The boards are identified by their PCI
subsystem IDs. On these boards the driver never drives GPIO1, does not
enable EEPROM write protection, and clears WOL_CAP so that Wake-on-LAN is
not advertised.

> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 95827df4cf6a1..9c431f76d4a52 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c

[ ... ]

> @@ -10537,7 +10543,10 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy)
>  		tp->grc_local_ctrl |= tr32(GRC_LOCAL_CTRL) & gpio_mask;
>  
>  		/* GPIO1 must be driven high for eeprom write protect */
> -		if (tg3_flag(tp, EEPROM_WRITE_PROT))
> +		if (tg3_flag(tp, CITADEL))
> +			tp->grc_local_ctrl &= ~(GRC_LCLCTRL_GPIO_OE1 |
> +						GRC_LCLCTRL_GPIO_OUTPUT1);
> +		else if (tg3_flag(tp, EEPROM_WRITE_PROT))
>  			tp->grc_local_ctrl |= (GRC_LCLCTRL_GPIO_OE1 |
>  					       GRC_LCLCTRL_GPIO_OUTPUT1);
>  	}

[Severity: Low]
This isn't a bug, but the existing comment says GPIO1 must be driven high,
and it now sits directly above the new CITADEL branch. That branch does the
opposite and leaves GPIO1 undriven.

Could the comment be moved down to the EEPROM_WRITE_PROT branch? Another
option is a short comment explaining that Citadel boards must not drive
GPIO1 because the security SoC uses it as a mailbox.

[ ... ]

> @@ -15231,6 +15272,9 @@ static void tg3_get_eeprom_hw_cfg(struct tg3 *tp)
>  	tg3_flag_set(tp, EEPROM_WRITE_PROT);
>  	tg3_flag_set(tp, WOL_CAP);
>  
> +	if (tg3_is_citadel(tp))
> +		tg3_flag_set(tp, CITADEL);
> +
>  	if (tg3_asic_rev(tp) == ASIC_REV_5906) {
>  		if (!(tr32(PCIE_TRANSACTION_CFG) & PCIE_TRANS_CFG_LOM)) {
>  			tg3_flag_clear(tp, EEPROM_WRITE_PROT);
> @@ -15430,6 +15474,12 @@ static void tg3_get_eeprom_hw_cfg(struct tg3 *tp)
>  			tp->phy_flags |= TG3_PHYFLG_DISABLE_1G_HD_ADV;
>  	}
>  done:
> +	if (tg3_flag(tp, CITADEL)) {
> +		tg3_flag_clear(tp, EEPROM_WRITE_PROT);
> +		tg3_flag_clear(tp, WOL_CAP);
> +		tg3_flag_clear(tp, WOL_ENABLE);
> +	}
> +
>  	if (tg3_flag(tp, WOL_CAP))
>  		device_set_wakeup_enable(&tp->pdev->dev,
>  					 tg3_flag(tp, WOL_ENABLE));

[Severity: Medium]
Can this leak a registered wakeup_source on Citadel boards?

CITADEL is set early, but WOL_CAP is not cleared until the done: label. Two
earlier branches in tg3_get_eeprom_hw_cfg() can therefore still enable
wakeup on a Citadel board.

The first is the NIC SRAM path:

    if (tg3_flag(tp, WOL_CAP) &&
        (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE)) {
        tg3_flag_set(tp, WOL_ENABLE);
        device_set_wakeup_enable(&tp->pdev->dev, true);
    }

The second is the ASIC_REV_5906 path before goto done:

    if ((val & VCPU_CFGSHDW_WOL_ENABLE) &&
        (val & VCPU_CFGSHDW_WOL_MAGPKT)) {
        tg3_flag_set(tp, WOL_ENABLE);
        device_set_wakeup_enable(&tp->pdev->dev, true);
    }

pci_pm_init() has already marked PME-capable devices can_wakeup, so
device_wakeup_enable() goes ahead. It calls wakeup_source_register(), which
creates a wakeupN device with pdev->dev as its parent. It then attaches the
source to dev->power.wakeup.

After the new block clears WOL_CAP, the else branch that follows runs:

    else
        device_set_wakeup_capable(&tp->pdev->dev, false);

device_set_wakeup_capable() only clears can_wakeup and removes the sysfs
attributes. dev->power.wakeup is left in place. After that,
device_wakeup_disable() returns early:

drivers/base/power/wakeup.c:device_wakeup_disable() {
	if (!dev || !dev->power.can_wakeup)
		return;

	ws = device_wakeup_detach(dev);
	wakeup_source_unregister(ws);
}

So the call from device_pm_remove() never frees the wakeup_source. Its
child device also keeps a reference on pdev->dev, so the pci_dev is never
released after removal.

Before this patch, nothing cleared WOL_CAP after a possible
device_set_wakeup_enable(true) call, so this ordering is new.

Would it work to clear WOL_CAP where CITADEL is set, before either branch
can enable wakeup?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118150247.1145764-1-pavan.chebbi%40broadcom.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-22 15:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 15:02 [PATCH net-next] tg3: Add support for boards integrated with security SoCs Pavan Chebbi
2026-11-22 15:11 ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox