From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F829606A32C for ; Fri, 4 Dec 2026 06:14:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=RS+ZBHsN; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=O+ty2k5R Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 43A62404C0; Fri, 4 Dec 2026 06:14:12 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id SzbzLVTB7CXo; Fri, 4 Dec 2026 06:14:11 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp4.osuosl.org 3315B404F8 Authentication-Results: smtp4.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796364851; b=LLkfpEqV0bppsYsbPqYpA6Md8k2cNIq9kU96ghywb68JtJuBJ2NBm8+g9cNF+oai6OS9 tCH20R2LJT8iqjrIYqtynn4VwksCEBRbEjliKS7LzIUE4fO/U+W2l26FrBf9xuJ22dgrA 7FliLeVGr5npuJOaVKj8xJ6uF3PPX3dUWU/kExLM7zppASFtXhnfBABtbOVPHEOKcQCsL oP8A2J8PMulhGROb8faSJQHfNCFa4IxvXTUGQmqogPMsOuvcSSF2C20s80KjI8vvDc0Ns T2E2Qkay6LKnbqdYn2fMHj8Su3eiF7c49yYUP8IzSx7uxUB2IDfK5UWu2KKgXoJLddA== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796364851; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: Received:DKIM-Signature:Message-ID:From:Subject:To:Cc:In-Reply-To: References:Content-Type:Content-Transfer-Encoding:Date:X-BeenThere: X-Mailman-Version:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Reply-To:Errors-To; bh=XlTheWwd65Z2JjU0WoJcEiZ5uMqKoubPXmJhT7N68u4=; b=MKk9qUQs7isDEGPGupf4T5cBBz0+cicvAukS0/7fGi8deMIjsmOOv8/x1pjeTVme4a9H vLHIV4UHiunq6R/p+5NFfQXQ96zNRHn6gAwzCDBPmi2RaZ+Qwq1rYB+iXWM+TxKYIVn5e pFJDKBibebqW82QHeHh9+5wNXnkgeIWD9ptMTBWOxnW/bGGSsWOOLdm4XkT+bXMwV6RGI Z98wmFMEa3Mfa3ZmqTFlUcQXkMrpoxIR1syu0cn+nFmqM+DQFg/oB+Fyv5Nk8gW6Apqpy pFcbH5NeRpZlXwkTdBIX2dap9V+h1gEnNtuixZH9afrs3So9nqqjqTGGHmwDVflLOxQ== ARC-Authentication-Results: i=1; smtp4.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1796364851; bh=XlTheWwd65Z2JjU0WoJcEiZ5uMqKoubPXmJhT7N68u4=; h=From:Subject:To:Cc:In-Reply-To:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:From; b=RS+ZBHsNwZlx7W1XfFkQz4U6ry5hUmQW3ov4KyqGl1owFNvNfVJRkVnnJ5SvjN6gr H/5D0+0hsG/7jg3ff4DnD2ZhUpq7svMVH+6XXvMBI5bS6fASAcpPf0bPR0aij0b3ZH puKodFsyP3OvOPP0r/TfNiur4v1HfYMSClHpN/4S4XSm5fmkGw1u4ZHiEnEstLKEA2 SIPnsojb+gYRt1gsJHROr/htvPf6NFPczWgzodZX9op66pJxVL/EMSkhTQ/t1+4wmm gaotJfvvN6EBWkXUnuns/hKYSlPLDVVKra6XH0sUBRzKQfqKW+ZU9g+gy0HESBEe9V hjCapDw8QMNIg== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id 3315B404F8; Fri, 4 Dec 2026 06:14:11 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id C85FEE0 for ; Fri, 4 Dec 2026 06:14:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id AE29A60E00 for ; Fri, 4 Dec 2026 06:14:09 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 1eln1Auo5e44 for ; Fri, 4 Dec 2026 06:14:08 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 9701D60E4B Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip="2600:3c04:e001:324:0:1991:8:25" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=sashiko-bot@kernel.org; receiver= Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=O+ty2k5R Received: from tor.source.kernel.org (tor.source.kernel.org [IPv6:2600:3c04:e001:324:0:1991:8:25]) by smtp3.osuosl.org (Postfix) with ESMTPS id 9701D60E4B for ; Fri, 4 Dec 2026 06:14:08 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 2A31560239; Fri, 4 Dec 2026 06:14:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A03FC1F0092C; Fri, 4 Dec 2026 06:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796364846; bh=XlTheWwd65Z2JjU0WoJcEiZ5uMqKoubPXmJhT7N68u4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=O+ty2k5RCZjeU2kiJyF2j36GbM72JU1KFrXg64ELEUqmgTSgdKsunuf2EPqBUT2bz PR7CYicv5jg/1KWL9N6GgjGJo07dc1dYc4ItGwsJWq96HjvUo8iQXtamdMjmDqAo55 uZWwkDhAB6i+YVmBzPagcSXlrkY74sbogAUccdpDDyGirHkgYC92bwbbPJouRBWCcg QI8Snj3PqrXOafpQrPUSZTpPBuwjgD7Q9JMPHAkqUos1zKcetLWQ24BUh/7TeMzgOx 4ThEo6DvodNT53U2VQCwk1QQ6cU3ifMw8qrzu08QT67E4ANWulgCAvGi8cSg6f7uxC 01DshGp7fqMpg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH iwl-next v2 3/4] e1000: attach a CE4100 PHY through phylink To: "Joseph Telaak" Cc: intel-wired-lan@lists.osuosl.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261203-e1000-phylink-v2-3-0a8f80515363@telaak.dev> References: <20261203-e1000-phylink-v2-0-0a8f80515363@telaak.dev> <20261203-e1000-phylink-v2-3-0a8f80515363@telaak.dev> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 06:14:06 +0000 X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] e1000: unchecked reg shift in e1000_ce4100_mdio_read()/write() - [Medium] e1000: e1000_mdio_register() rejects valid DT mdio nodes without phylink - [Medium] e1000: PHY state machine left polling BAR 1 MDIO in D3hot with WoL enabled -- commit 37b0dd6aa7b1616c73701607700385f94c7c3b35 Author: Joseph Telaak e1000: attach a CE4100 PHY through phylink This commit extends CE4100 phylink support to attach a PHY described by phy-handle on open, and registers the MAC's MDIO bus when an mdio child node is present in the device tree. > diff --git a/drivers/net/ethernet/intel/e1000/e1000_hw.c b/drivers/net/et= hernet/intel/e1000/e1000_hw.c > index f367b87938f14..3a2a9713e3b20 100644 > --- a/drivers/net/ethernet/intel/e1000/e1000_hw.c > +++ b/drivers/net/ethernet/intel/e1000/e1000_hw.c [ ... ] > +int e1000_ce4100_mdio_read(struct e1000_hw *hw, int addr, int reg) > +{ > + int ret; > + u32 sts; > + > + ret =3D e1000_ce4100_mdio_cmd(hw, (reg << E1000_MDIC_REG_SHIFT) | > + (addr << E1000_MDIC_PHY_SHIFT) | > + INTEL_CE_GBE_MDIC_OP_READ); > + if (ret) > + return ret; > + > + sts =3D readl(E1000_MDIO_STS); > + if (sts & INTEL_CE_GBE_MDIC_READ_ERROR) > + return -EIO; > + > + return sts & 0xffff; > +} > + > +/** > + * e1000_ce4100_mdio_write - write a register of a PHY on the CE4100 MDI= O bus > + * @hw: Struct containing variables accessed by shared code > + * @addr: PHY address > + * @reg: register number > + * @val: value to write > + * > + * Return: 0, or a negative error code. > + */ > +int e1000_ce4100_mdio_write(struct e1000_hw *hw, int addr, int reg, u16 = val) > +{ > + return e1000_ce4100_mdio_cmd(hw, val | (reg << E1000_MDIC_REG_SHIFT) | > + (addr << E1000_MDIC_PHY_SHIFT) | > + INTEL_CE_GBE_MDIC_OP_WRITE); > +} [Severity: Medium] Can an out-of-range reg value in e1000_ce4100_mdio_read() or e1000_ce4100_mdio_write() corrupt adjacent fields in E1000_MDIO_CMD? e1000_mii_ioctl() delegates SIOCGMIIREG and SIOCSMIIREG to phylink_mii_ioctl(), which passes the 16-bit mii->reg_num through __mdiobus_read() and __mdiobus_write() without range-checking regnum. Shifting reg left by E1000_MDIC_REG_SHIFT (16) unmasked lets bits 9:5 overwrite the PHY address field and bit 10 set INTEL_CE_GBE_MDIC_OP_WRITE, turning a read-only SIOCGMIIREG into a write of 0x0000. Values with reg >=3D 0x8000 also shift into the sign bit of signed int reg. Validating reg <=3D MAX_PHY_REG_ADDRESS (returning -EINVAL, as in e1000_read_phy_reg_ex()) or using FIELD_PREP() after bounds-checking would avoid this. > diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/= ethernet/intel/e1000/e1000_main.c > index f07afc451d098..1ac21f2c18b8f 100644 > --- a/drivers/net/ethernet/intel/e1000/e1000_main.c > +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c [ ... ] > +static int e1000_mdio_register(struct e1000_adapter *adapter) > +{ > + struct device *dev =3D &adapter->pdev->dev; > + struct device_node *np; > + struct mii_bus *bus; > + int err; > + > + np =3D of_get_available_child_by_name(dev->of_node, "mdio"); > + if (!np) > + return 0; > + > + /* Without phylink, e1000's own PHY code would drive the bus too */ > + if (!adapter->phylink) { > + e_dev_err("an mdio node needs a phy-handle or a fixed-link\n"); > + err =3D -EINVAL; > + goto out; > + } [Severity: Medium] As reported by Maxime Chevallier on v1 [1], should e1000_mdio_register() register the MDIO bus whenever an mdio child node is present instead of returning -EINVAL without phylink? Documentation/devicetree/bindings/net/intel,ce4100-gbe.yaml allows an mdio child node without phy-handle or fixed-link (for example, when another MAC or a switch uses devices on this bus), so returning -EINVAL here aborts e1000_probe() on valid DT configurations. Serializing CE4100 MDIO register access with e1000_phy_lock would allow registering the bus independently of phylink. [ ... ] > @@ -1549,6 +1631,13 @@ int e1000_open(struct net_device *netdev) > =20 > netif_carrier_off(netdev); > =20 > + if (adapter->phylink) { > + err =3D phylink_of_phy_connect(adapter->phylink, > + adapter->pdev->dev.of_node, 0); > + if (err) > + return err; > + } [Severity: Medium] With Wake-on-LAN enabled, can the PHY state machine keep polling BAR 1 MDIO registers after the PCI device enters PCI_D3hot? e1000_phylink_init() sets mac_managed_pm =3D true, so mdio_bus_phy_suspend() skips phy_stop_machine(). When WoL is enabled, __e1000_shutdown() passes mac_wol =3D true to phylink_suspend(), which takes the MAC-WoL branch and also skips phylink_stop() and phy_stop(). Because phydev->state_queue runs on the non-freezable system_power_efficient_wq, it can fire after pci_prepare_to_sleep() or e1000_shutdown() puts the device into PCI_D3hot. e1000_ce4100_mdio_cmd() then reads 0xffffffff and returns -ETIMEDOUT, causing _phy_state_machine() to trigger WARN(1) via phy_error_precise() and leave the PHY stuck in PHY_ERROR after phylink_resume(). [1] https://lore.kernel.org/r/80f76cd1-5fac-4809-8ab9-c6ccbce647fd@bootlin.= com --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-e1000-phyl= ink-v2-0-0a8f80515363@telaak.dev?part=3D3