generic: Add additional bugfitx from 5.5
authorHauke Mehrtens <hauke@hauke-m.de>
Sat, 29 Feb 2020 18:07:40 +0000 (19:07 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 12 Mar 2020 22:47:13 +0000 (23:47 +0100)
18 files changed:
target/linux/generic/backport-4.19/745-v5.5-net-phylink-fix-failure-to-register-on-x86-systems.patch [new file with mode: 0644]
target/linux/generic/backport-4.19/762-v5.6-net-sfp-derive-interface-mode-from-ethtool-link-mode.patch
target/linux/generic/backport-4.19/765-v5.6-net-sfp-move-phy_start-phy_stop-to-phylink.patch
target/linux/generic/backport-4.19/767-v5.6-net-phylink-re-split-__phylink_connect_phy.patch
target/linux/generic/backport-4.19/768-v5.6-net-phylink-support-Clause-45-PHYs-on-SFP-modules.patch
target/linux/generic/backport-4.19/769-v5.6-net-phylink-split-link_an_mode-configured-and-curren.patch
target/linux/generic/backport-4.19/770-v5.6-net-phylink-split-phylink_sfp_module_insert.patch
target/linux/generic/backport-4.19/771-v5.6-net-phylink-delay-MAC-configuration-for-copper-SFP-m.patch
target/linux/generic/backport-4.19/772-v5.6-net-phylink-make-Broadcom-BCM84881-based-SFPs-work.patch
target/linux/generic/backport-5.4/745-v5.5-net-phylink-fix-failure-to-register-on-x86-systems.patch [new file with mode: 0644]
target/linux/generic/backport-5.4/762-v5.6-net-sfp-derive-interface-mode-from-ethtool-link-mode.patch
target/linux/generic/backport-5.4/765-v5.6-net-sfp-move-phy_start-phy_stop-to-phylink.patch
target/linux/generic/backport-5.4/767-v5.6-net-phylink-re-split-__phylink_connect_phy.patch
target/linux/generic/backport-5.4/768-v5.6-net-phylink-support-Clause-45-PHYs-on-SFP-modules.patch
target/linux/generic/backport-5.4/769-v5.6-net-phylink-split-link_an_mode-configured-and-curren.patch
target/linux/generic/backport-5.4/770-v5.6-net-phylink-split-phylink_sfp_module_insert.patch
target/linux/generic/backport-5.4/771-v5.6-net-phylink-delay-MAC-configuration-for-copper-SFP-m.patch
target/linux/generic/backport-5.4/772-v5.6-net-phylink-make-Broadcom-BCM84881-based-SFPs-work.patch

diff --git a/target/linux/generic/backport-4.19/745-v5.5-net-phylink-fix-failure-to-register-on-x86-systems.patch b/target/linux/generic/backport-4.19/745-v5.5-net-phylink-fix-failure-to-register-on-x86-systems.patch
new file mode 100644 (file)
index 0000000..2b44ef4
--- /dev/null
@@ -0,0 +1,36 @@
+From eed70fd9452fe0fcd1a221731a4333b51a8081f2 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Fri, 3 Jan 2020 15:13:56 +0000
+Subject: net: phylink: fix failure to register on x86 systems
+
+The kernel test robot reports a boot failure with qemu in 5.5-rc,
+referencing commit 2203cbf2c8b5 ("net: sfp: move fwnode parsing into
+sfp-bus layer"). This is caused by phylink_create() being passed a
+NULL fwnode, causing fwnode_property_get_reference_args() to return
+-EINVAL.
+
+Don't attempt to attach to a SFP bus if we have no fwnode, which
+avoids this issue.
+
+Reported-by: kernel test robot <rong.a.chen@intel.com>
+Fixes: 2203cbf2c8b5 ("net: sfp: move fwnode parsing into sfp-bus layer")
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/phy/phylink.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -541,6 +541,9 @@ static int phylink_register_sfp(struct p
+       struct sfp_bus *bus;
+       int ret;
++      if (!fwnode)
++              return 0;
++
+       bus = sfp_bus_find_fwnode(fwnode);
+       if (IS_ERR(bus)) {
+               ret = PTR_ERR(bus);
index f20b66eae716fad756b9f307097ee022152b5020..ff02570b746566a8bd12f7ac323c20e5b2607d84 100644 (file)
@@ -29,7 +29,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                dev_err(&phydev->mdio.dev, "incompatible SFP module inserted\n");
 --- a/drivers/net/phy/phylink.c
 +++ b/drivers/net/phy/phylink.c
-@@ -1663,7 +1663,7 @@ static int phylink_sfp_module_insert(voi
+@@ -1666,7 +1666,7 @@ static int phylink_sfp_module_insert(voi
  
        linkmode_copy(support1, support);
  
index a646fcd409ea5e1807110d00a9bf9a449dd6d373..6833b3a99efe1fffc22c838791e95df98250b747 100644 (file)
@@ -16,7 +16,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
 
 --- a/drivers/net/phy/phylink.c
 +++ b/drivers/net/phy/phylink.c
-@@ -1717,6 +1717,26 @@ static int phylink_sfp_module_insert(voi
+@@ -1720,6 +1720,26 @@ static int phylink_sfp_module_insert(voi
        return ret;
  }
  
@@ -43,7 +43,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  static void phylink_sfp_link_down(void *upstream)
  {
        struct phylink *pl = upstream;
-@@ -1752,6 +1772,8 @@ static const struct sfp_upstream_ops sfp
+@@ -1755,6 +1775,8 @@ static const struct sfp_upstream_ops sfp
        .attach = phylink_sfp_attach,
        .detach = phylink_sfp_detach,
        .module_insert = phylink_sfp_module_insert,
index c74a56c575cad1411b9008e49b981ca1157aec2a..260c7340d32bfd1e70a96d05665b7ed69ee085e8 100644 (file)
@@ -16,7 +16,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
 
 --- a/drivers/net/phy/phylink.c
 +++ b/drivers/net/phy/phylink.c
-@@ -728,11 +728,9 @@ static int phylink_bringup_phy(struct ph
+@@ -731,11 +731,9 @@ static int phylink_bringup_phy(struct ph
        return 0;
  }
  
@@ -30,7 +30,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED ||
                    (pl->link_an_mode == MLO_AN_INBAND &&
                     phy_interface_mode_is_8023z(interface))))
-@@ -741,15 +739,7 @@ static int __phylink_connect_phy(struct
+@@ -744,15 +742,7 @@ static int __phylink_connect_phy(struct
        if (pl->phydev)
                return -EBUSY;
  
@@ -47,7 +47,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  }
  
  /**
-@@ -769,13 +759,23 @@ static int __phylink_connect_phy(struct
+@@ -772,13 +762,23 @@ static int __phylink_connect_phy(struct
   */
  int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
  {
@@ -72,7 +72,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  }
  EXPORT_SYMBOL_GPL(phylink_connect_phy);
  
-@@ -1759,8 +1759,17 @@ static void phylink_sfp_link_up(void *up
+@@ -1762,8 +1762,17 @@ static void phylink_sfp_link_up(void *up
  static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
  {
        struct phylink *pl = upstream;
index 2cea118c82b44bb938389105555f92331b7cc46a..19d0337549b82b2dc712ef5c1ee93d1834f54a8c 100644 (file)
@@ -18,7 +18,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
 
 --- a/drivers/net/phy/phylink.c
 +++ b/drivers/net/phy/phylink.c
-@@ -671,7 +671,8 @@ static void phylink_phy_change(struct ph
+@@ -674,7 +674,8 @@ static void phylink_phy_change(struct ph
                   phy_duplex_to_str(phydev->duplex));
  }
  
@@ -28,7 +28,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  {
        struct phylink_link_state config;
        __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
-@@ -691,7 +692,7 @@ static int phylink_bringup_phy(struct ph
+@@ -694,7 +695,7 @@ static int phylink_bringup_phy(struct ph
        ethtool_convert_legacy_u32_to_link_mode(supported, phy->supported);
        ethtool_convert_legacy_u32_to_link_mode(config.advertising,
                                                phy->advertising);
@@ -37,7 +37,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  
        ret = phylink_validate(pl, supported, &config);
        if (ret)
-@@ -707,6 +708,7 @@ static int phylink_bringup_phy(struct ph
+@@ -710,6 +711,7 @@ static int phylink_bringup_phy(struct ph
        mutex_lock(&phy->lock);
        mutex_lock(&pl->state_mutex);
        pl->phydev = phy;
@@ -45,7 +45,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        linkmode_copy(pl->supported, supported);
        linkmode_copy(pl->link_config.advertising, config.advertising);
  
-@@ -771,7 +773,7 @@ int phylink_connect_phy(struct phylink *
+@@ -774,7 +776,7 @@ int phylink_connect_phy(struct phylink *
        if (ret < 0)
                return ret;
  
@@ -54,7 +54,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        if (ret)
                phy_detach(phy);
  
-@@ -824,7 +826,7 @@ int phylink_of_phy_connect(struct phylin
+@@ -827,7 +829,7 @@ int phylink_of_phy_connect(struct phylin
        if (!phy_dev)
                return -ENODEV;
  
@@ -63,7 +63,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        if (ret)
                phy_detach(phy_dev);
  
-@@ -1759,13 +1761,22 @@ static void phylink_sfp_link_up(void *up
+@@ -1762,13 +1764,22 @@ static void phylink_sfp_link_up(void *up
  static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
  {
        struct phylink *pl = upstream;
index f30d37f0c62ca3fce8ccd08e58ff4afada955837..618a363373386305c0feea10fb24f861f9159b9e 100644 (file)
@@ -91,7 +91,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                                             pl->cur_interface, pl->phydev);
  
                        netif_carrier_on(ndev);
-@@ -610,7 +611,7 @@ struct phylink *phylink_create(struct ne
+@@ -613,7 +614,7 @@ struct phylink *phylink_create(struct ne
                return ERR_PTR(ret);
        }
  
@@ -100,7 +100,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                ret = phylink_parse_fixedlink(pl, fwnode);
                if (ret < 0) {
                        kfree(pl);
-@@ -618,6 +619,8 @@ struct phylink *phylink_create(struct ne
+@@ -621,6 +622,8 @@ struct phylink *phylink_create(struct ne
                }
        }
  
@@ -109,7 +109,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        ret = phylink_register_sfp(pl, fwnode);
        if (ret < 0) {
                kfree(pl);
-@@ -733,8 +736,8 @@ static int phylink_bringup_phy(struct ph
+@@ -736,8 +739,8 @@ static int phylink_bringup_phy(struct ph
  static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy,
                              phy_interface_t interface)
  {
@@ -120,7 +120,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                     phy_interface_mode_is_8023z(interface))))
                return -EINVAL;
  
-@@ -801,8 +804,8 @@ int phylink_of_phy_connect(struct phylin
+@@ -804,8 +807,8 @@ int phylink_of_phy_connect(struct phylin
        int ret;
  
        /* Fixed links and 802.3z are handled without needing a PHY */
@@ -131,7 +131,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
             phy_interface_mode_is_8023z(pl->link_interface)))
                return 0;
  
-@@ -813,7 +816,7 @@ int phylink_of_phy_connect(struct phylin
+@@ -816,7 +819,7 @@ int phylink_of_phy_connect(struct phylin
                phy_node = of_parse_phandle(dn, "phy-device", 0);
  
        if (!phy_node) {
@@ -140,7 +140,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                        return -ENODEV;
                return 0;
        }
-@@ -876,7 +879,7 @@ int phylink_fixed_state_cb(struct phylin
+@@ -879,7 +882,7 @@ int phylink_fixed_state_cb(struct phylin
        /* It does not make sense to let the link be overriden unless we use
         * MLO_AN_FIXED
         */
@@ -149,7 +149,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                return -EINVAL;
  
        mutex_lock(&pl->state_mutex);
-@@ -926,7 +929,7 @@ void phylink_start(struct phylink *pl)
+@@ -929,7 +932,7 @@ void phylink_start(struct phylink *pl)
        ASSERT_RTNL();
  
        netdev_info(pl->netdev, "configuring for %s/%s link mode\n",
@@ -158,7 +158,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                    phy_modes(pl->link_config.interface));
  
        /* Always set the carrier off */
-@@ -948,7 +951,7 @@ void phylink_start(struct phylink *pl)
+@@ -951,7 +954,7 @@ void phylink_start(struct phylink *pl)
        clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
        phylink_run_resolve(pl);
  
@@ -167,7 +167,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                int irq = gpiod_to_irq(pl->link_gpio);
  
                if (irq > 0) {
-@@ -963,7 +966,7 @@ void phylink_start(struct phylink *pl)
+@@ -966,7 +969,7 @@ void phylink_start(struct phylink *pl)
                if (irq <= 0)
                        mod_timer(&pl->link_poll, jiffies + HZ);
        }
@@ -176,7 +176,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                mod_timer(&pl->link_poll, jiffies + HZ);
        if (pl->phydev)
                phy_start(pl->phydev);
-@@ -1090,7 +1093,7 @@ int phylink_ethtool_ksettings_get(struct
+@@ -1093,7 +1096,7 @@ int phylink_ethtool_ksettings_get(struct
  
        linkmode_copy(kset->link_modes.supported, pl->supported);
  
@@ -185,7 +185,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        case MLO_AN_FIXED:
                /* We are using fixed settings. Report these as the
                 * current link settings - and note that these also
-@@ -1163,7 +1166,7 @@ int phylink_ethtool_ksettings_set(struct
+@@ -1166,7 +1169,7 @@ int phylink_ethtool_ksettings_set(struct
                /* If we have a fixed link (as specified by firmware), refuse
                 * to change link parameters.
                 */
@@ -194,7 +194,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                    (s->speed != pl->link_config.speed ||
                     s->duplex != pl->link_config.duplex))
                        return -EINVAL;
-@@ -1175,7 +1178,7 @@ int phylink_ethtool_ksettings_set(struct
+@@ -1178,7 +1181,7 @@ int phylink_ethtool_ksettings_set(struct
                __clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, config.advertising);
        } else {
                /* If we have a fixed link, refuse to enable autonegotiation */
@@ -203,7 +203,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                        return -EINVAL;
  
                config.speed = SPEED_UNKNOWN;
-@@ -1217,7 +1220,7 @@ int phylink_ethtool_ksettings_set(struct
+@@ -1220,7 +1223,7 @@ int phylink_ethtool_ksettings_set(struct
         * configuration. For a fixed link, this isn't able to change any
         * parameters, which just leaves inband mode.
         */
@@ -212,7 +212,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
            !test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state)) {
                phylink_mac_config(pl, &pl->link_config);
                phylink_mac_an_restart(pl);
-@@ -1307,7 +1310,7 @@ int phylink_ethtool_set_pauseparam(struc
+@@ -1310,7 +1313,7 @@ int phylink_ethtool_set_pauseparam(struc
                                   pause->tx_pause);
        } else if (!test_bit(PHYLINK_DISABLE_STOPPED,
                             &pl->phylink_disable_state)) {
@@ -221,7 +221,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                case MLO_AN_FIXED:
                        /* Should we allow fixed links to change against the config? */
                        phylink_resolve_flow(pl, config);
-@@ -1496,7 +1499,7 @@ static int phylink_mii_read(struct phyli
+@@ -1499,7 +1502,7 @@ static int phylink_mii_read(struct phyli
        struct phylink_link_state state;
        int val = 0xffff;
  
@@ -230,7 +230,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        case MLO_AN_FIXED:
                if (phy_id == 0) {
                        phylink_get_fixed_state(pl, &state);
-@@ -1524,7 +1527,7 @@ static int phylink_mii_read(struct phyli
+@@ -1527,7 +1530,7 @@ static int phylink_mii_read(struct phyli
  static int phylink_mii_write(struct phylink *pl, unsigned int phy_id,
                             unsigned int reg, unsigned int val)
  {
@@ -239,7 +239,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        case MLO_AN_FIXED:
                break;
  
-@@ -1698,10 +1701,10 @@ static int phylink_sfp_module_insert(voi
+@@ -1701,10 +1704,10 @@ static int phylink_sfp_module_insert(voi
                linkmode_copy(pl->link_config.advertising, config.advertising);
        }
  
index 87d70d1434b831872a342604373e74860a0c6e75..7b734f1cc0ea39982ccdf73410630b0dc69caf40 100644 (file)
@@ -13,7 +13,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
 
 --- a/drivers/net/phy/phylink.c
 +++ b/drivers/net/phy/phylink.c
-@@ -1633,25 +1633,21 @@ static void phylink_sfp_detach(void *ups
+@@ -1636,25 +1636,21 @@ static void phylink_sfp_detach(void *ups
        pl->netdev->sfp_bus = NULL;
  }
  
@@ -46,7 +46,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        config.interface = PHY_INTERFACE_MODE_NA;
        config.speed = SPEED_UNKNOWN;
        config.duplex = DUPLEX_UNKNOWN;
-@@ -1666,8 +1662,6 @@ static int phylink_sfp_module_insert(voi
+@@ -1669,8 +1665,6 @@ static int phylink_sfp_module_insert(voi
                return ret;
        }
  
@@ -55,7 +55,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        iface = sfp_select_interface(pl->sfp_bus, config.advertising);
        if (iface == PHY_INTERFACE_MODE_NA) {
                netdev_err(pl->netdev,
-@@ -1677,18 +1671,18 @@ static int phylink_sfp_module_insert(voi
+@@ -1680,18 +1674,18 @@ static int phylink_sfp_module_insert(voi
        }
  
        config.interface = iface;
@@ -77,7 +77,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                   __ETHTOOL_LINK_MODE_MASK_NBITS, support);
  
        if (phy_interface_mode_is_8023z(iface) && pl->phydev)
-@@ -1701,15 +1695,15 @@ static int phylink_sfp_module_insert(voi
+@@ -1704,15 +1698,15 @@ static int phylink_sfp_module_insert(voi
                linkmode_copy(pl->link_config.advertising, config.advertising);
        }
  
@@ -96,7 +96,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                            phy_modes(config.interface));
        }
  
-@@ -1722,6 +1716,21 @@ static int phylink_sfp_module_insert(voi
+@@ -1725,6 +1719,21 @@ static int phylink_sfp_module_insert(voi
        return ret;
  }
  
index 358b9a10829d2c8c977050c62f1fa6783bdfdcb0..6b247c30737fb79c1368fd75bd81553a733f9479 100644 (file)
@@ -36,7 +36,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  };
  
  static inline void linkmode_zero(unsigned long *dst)
-@@ -1633,7 +1636,7 @@ static void phylink_sfp_detach(void *ups
+@@ -1636,7 +1639,7 @@ static void phylink_sfp_detach(void *ups
        pl->netdev->sfp_bus = NULL;
  }
  
@@ -45,7 +45,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                              const unsigned long *supported,
                              const unsigned long *advertising)
  {
-@@ -1707,7 +1710,7 @@ static int phylink_sfp_config(struct phy
+@@ -1710,7 +1713,7 @@ static int phylink_sfp_config(struct phy
                            phy_modes(config.interface));
        }
  
@@ -54,7 +54,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  
        if (changed && !test_bit(PHYLINK_DISABLE_STOPPED,
                                 &pl->phylink_disable_state))
-@@ -1720,15 +1723,20 @@ static int phylink_sfp_module_insert(voi
+@@ -1723,15 +1726,20 @@ static int phylink_sfp_module_insert(voi
                                     const struct sfp_eeprom_id *id)
  {
        struct phylink *pl = upstream;
@@ -79,7 +79,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  }
  
  static int phylink_sfp_module_start(void *upstream)
-@@ -1736,10 +1744,19 @@ static int phylink_sfp_module_start(void
+@@ -1739,10 +1747,19 @@ static int phylink_sfp_module_start(void
        struct phylink *pl = upstream;
  
        /* If this SFP module has a PHY, start the PHY now. */
@@ -102,7 +102,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  }
  
  static void phylink_sfp_module_stop(void *upstream)
-@@ -1773,10 +1790,30 @@ static void phylink_sfp_link_up(void *up
+@@ -1776,10 +1793,30 @@ static void phylink_sfp_link_up(void *up
  static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
  {
        struct phylink *pl = upstream;
index 1724d445b7087191fce2e359d024800c7ab46953..8d682ad31f4df632434b107c9a57766f8a47f848 100644 (file)
@@ -18,7 +18,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
 
 --- a/drivers/net/phy/phylink.c
 +++ b/drivers/net/phy/phylink.c
-@@ -1787,12 +1787,22 @@ static void phylink_sfp_link_up(void *up
+@@ -1790,12 +1790,22 @@ static void phylink_sfp_link_up(void *up
        phylink_run_resolve(pl);
  }
  
@@ -41,7 +41,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        int ret;
  
        /*
-@@ -1807,8 +1817,13 @@ static int phylink_sfp_connect_phy(void
+@@ -1810,8 +1820,13 @@ static int phylink_sfp_connect_phy(void
        ethtool_convert_legacy_u32_to_link_mode(supported, phy->supported);
        ethtool_convert_legacy_u32_to_link_mode(advertising, phy->advertising);
  
diff --git a/target/linux/generic/backport-5.4/745-v5.5-net-phylink-fix-failure-to-register-on-x86-systems.patch b/target/linux/generic/backport-5.4/745-v5.5-net-phylink-fix-failure-to-register-on-x86-systems.patch
new file mode 100644 (file)
index 0000000..04790b9
--- /dev/null
@@ -0,0 +1,36 @@
+From eed70fd9452fe0fcd1a221731a4333b51a8081f2 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Fri, 3 Jan 2020 15:13:56 +0000
+Subject: net: phylink: fix failure to register on x86 systems
+
+The kernel test robot reports a boot failure with qemu in 5.5-rc,
+referencing commit 2203cbf2c8b5 ("net: sfp: move fwnode parsing into
+sfp-bus layer"). This is caused by phylink_create() being passed a
+NULL fwnode, causing fwnode_property_get_reference_args() to return
+-EINVAL.
+
+Don't attempt to attach to a SFP bus if we have no fwnode, which
+avoids this issue.
+
+Reported-by: kernel test robot <rong.a.chen@intel.com>
+Fixes: 2203cbf2c8b5 ("net: sfp: move fwnode parsing into sfp-bus layer")
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/phy/phylink.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -568,6 +568,9 @@ static int phylink_register_sfp(struct p
+       struct sfp_bus *bus;
+       int ret;
++      if (!fwnode)
++              return 0;
++
+       bus = sfp_bus_find_fwnode(fwnode);
+       if (IS_ERR(bus)) {
+               ret = PTR_ERR(bus);
index 8158c78b0ea4062e2666cc7dfffcdb21971fe89a..1bfdc78af780544848da0c560cfb350d8bf6d82a 100644 (file)
@@ -29,7 +29,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                dev_err(&phydev->mdio.dev, "incompatible SFP module inserted\n");
 --- a/drivers/net/phy/phylink.c
 +++ b/drivers/net/phy/phylink.c
-@@ -1718,7 +1718,7 @@ static int phylink_sfp_module_insert(voi
+@@ -1721,7 +1721,7 @@ static int phylink_sfp_module_insert(voi
  
        linkmode_copy(support1, support);
  
index e88a81df2d6ca624301db7cce4a7b11bf3bce8f0..9a478357cc9306834cc117de08eca30646169ab4 100644 (file)
@@ -16,7 +16,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
 
 --- a/drivers/net/phy/phylink.c
 +++ b/drivers/net/phy/phylink.c
-@@ -1772,6 +1772,26 @@ static int phylink_sfp_module_insert(voi
+@@ -1775,6 +1775,26 @@ static int phylink_sfp_module_insert(voi
        return ret;
  }
  
@@ -43,7 +43,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  static void phylink_sfp_link_down(void *upstream)
  {
        struct phylink *pl = upstream;
-@@ -1807,6 +1827,8 @@ static const struct sfp_upstream_ops sfp
+@@ -1810,6 +1830,8 @@ static const struct sfp_upstream_ops sfp
        .attach = phylink_sfp_attach,
        .detach = phylink_sfp_detach,
        .module_insert = phylink_sfp_module_insert,
index d547a18d6e57bf476182a9ef7f15bdfd055d9cc1..d789af3182a12a18745135f3c9fa5fc64204fa6f 100644 (file)
@@ -16,7 +16,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
 
 --- a/drivers/net/phy/phylink.c
 +++ b/drivers/net/phy/phylink.c
-@@ -765,11 +765,9 @@ static int phylink_bringup_phy(struct ph
+@@ -768,11 +768,9 @@ static int phylink_bringup_phy(struct ph
        return 0;
  }
  
@@ -30,7 +30,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED ||
                    (pl->link_an_mode == MLO_AN_INBAND &&
                     phy_interface_mode_is_8023z(interface))))
-@@ -778,15 +776,7 @@ static int __phylink_connect_phy(struct
+@@ -781,15 +779,7 @@ static int __phylink_connect_phy(struct
        if (pl->phydev)
                return -EBUSY;
  
@@ -47,7 +47,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  }
  
  /**
-@@ -806,13 +796,23 @@ static int __phylink_connect_phy(struct
+@@ -809,13 +799,23 @@ static int __phylink_connect_phy(struct
   */
  int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
  {
@@ -72,7 +72,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  }
  EXPORT_SYMBOL_GPL(phylink_connect_phy);
  
-@@ -1814,8 +1814,17 @@ static void phylink_sfp_link_up(void *up
+@@ -1817,8 +1817,17 @@ static void phylink_sfp_link_up(void *up
  static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
  {
        struct phylink *pl = upstream;
index 673de1005a213898936f5b7fff8f7b7fd2ff36ed..09d728a253d2f1f7a3682a6df4de246233186d62 100644 (file)
@@ -18,7 +18,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
 
 --- a/drivers/net/phy/phylink.c
 +++ b/drivers/net/phy/phylink.c
-@@ -712,7 +712,8 @@ static void phylink_phy_change(struct ph
+@@ -715,7 +715,8 @@ static void phylink_phy_change(struct ph
                    phy_duplex_to_str(phydev->duplex));
  }
  
@@ -28,7 +28,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  {
        struct phylink_link_state config;
        __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
-@@ -730,7 +731,7 @@ static int phylink_bringup_phy(struct ph
+@@ -733,7 +734,7 @@ static int phylink_bringup_phy(struct ph
        memset(&config, 0, sizeof(config));
        linkmode_copy(supported, phy->supported);
        linkmode_copy(config.advertising, phy->advertising);
@@ -37,7 +37,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  
        ret = phylink_validate(pl, supported, &config);
        if (ret)
-@@ -746,6 +747,7 @@ static int phylink_bringup_phy(struct ph
+@@ -749,6 +750,7 @@ static int phylink_bringup_phy(struct ph
        mutex_lock(&phy->lock);
        mutex_lock(&pl->state_mutex);
        pl->phydev = phy;
@@ -45,7 +45,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        linkmode_copy(pl->supported, supported);
        linkmode_copy(pl->link_config.advertising, config.advertising);
  
-@@ -808,7 +810,7 @@ int phylink_connect_phy(struct phylink *
+@@ -811,7 +813,7 @@ int phylink_connect_phy(struct phylink *
        if (ret < 0)
                return ret;
  
@@ -54,7 +54,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        if (ret)
                phy_detach(phy);
  
-@@ -861,7 +863,7 @@ int phylink_of_phy_connect(struct phylin
+@@ -864,7 +866,7 @@ int phylink_of_phy_connect(struct phylin
        if (!phy_dev)
                return -ENODEV;
  
@@ -63,7 +63,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        if (ret)
                phy_detach(phy_dev);
  
-@@ -1814,13 +1816,22 @@ static void phylink_sfp_link_up(void *up
+@@ -1817,13 +1819,22 @@ static void phylink_sfp_link_up(void *up
  static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
  {
        struct phylink *pl = upstream;
index eaf21dbc87c4794d1718e8630b6656ed8ff40dff..68460081cbb2511d3986f00f99133d58c7024095 100644 (file)
@@ -94,7 +94,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                case MLO_AN_PHY:
                        link_state = pl->phy_state;
                        phylink_resolve_flow(pl, &link_state);
-@@ -649,7 +650,7 @@ struct phylink *phylink_create(struct ph
+@@ -652,7 +653,7 @@ struct phylink *phylink_create(struct ph
                return ERR_PTR(ret);
        }
  
@@ -103,7 +103,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                ret = phylink_parse_fixedlink(pl, fwnode);
                if (ret < 0) {
                        kfree(pl);
-@@ -657,6 +658,8 @@ struct phylink *phylink_create(struct ph
+@@ -660,6 +661,8 @@ struct phylink *phylink_create(struct ph
                }
        }
  
@@ -112,7 +112,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        ret = phylink_register_sfp(pl, fwnode);
        if (ret < 0) {
                kfree(pl);
-@@ -770,8 +773,8 @@ static int phylink_bringup_phy(struct ph
+@@ -773,8 +776,8 @@ static int phylink_bringup_phy(struct ph
  static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy,
                              phy_interface_t interface)
  {
@@ -123,7 +123,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                     phy_interface_mode_is_8023z(interface))))
                return -EINVAL;
  
-@@ -838,8 +841,8 @@ int phylink_of_phy_connect(struct phylin
+@@ -841,8 +844,8 @@ int phylink_of_phy_connect(struct phylin
        int ret;
  
        /* Fixed links and 802.3z are handled without needing a PHY */
@@ -134,7 +134,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
             phy_interface_mode_is_8023z(pl->link_interface)))
                return 0;
  
-@@ -850,7 +853,7 @@ int phylink_of_phy_connect(struct phylin
+@@ -853,7 +856,7 @@ int phylink_of_phy_connect(struct phylin
                phy_node = of_parse_phandle(dn, "phy-device", 0);
  
        if (!phy_node) {
@@ -143,7 +143,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                        return -ENODEV;
                return 0;
        }
-@@ -913,7 +916,7 @@ int phylink_fixed_state_cb(struct phylin
+@@ -916,7 +919,7 @@ int phylink_fixed_state_cb(struct phylin
        /* It does not make sense to let the link be overriden unless we use
         * MLO_AN_FIXED
         */
@@ -152,7 +152,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                return -EINVAL;
  
        mutex_lock(&pl->state_mutex);
-@@ -963,7 +966,7 @@ void phylink_start(struct phylink *pl)
+@@ -966,7 +969,7 @@ void phylink_start(struct phylink *pl)
        ASSERT_RTNL();
  
        phylink_info(pl, "configuring for %s/%s link mode\n",
@@ -161,7 +161,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                     phy_modes(pl->link_config.interface));
  
        /* Always set the carrier off */
-@@ -986,7 +989,7 @@ void phylink_start(struct phylink *pl)
+@@ -989,7 +992,7 @@ void phylink_start(struct phylink *pl)
        clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
        phylink_run_resolve(pl);
  
@@ -170,7 +170,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                int irq = gpiod_to_irq(pl->link_gpio);
  
                if (irq > 0) {
-@@ -1001,7 +1004,7 @@ void phylink_start(struct phylink *pl)
+@@ -1004,7 +1007,7 @@ void phylink_start(struct phylink *pl)
                if (irq <= 0)
                        mod_timer(&pl->link_poll, jiffies + HZ);
        }
@@ -179,7 +179,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                mod_timer(&pl->link_poll, jiffies + HZ);
        if (pl->phydev)
                phy_start(pl->phydev);
-@@ -1128,7 +1131,7 @@ int phylink_ethtool_ksettings_get(struct
+@@ -1131,7 +1134,7 @@ int phylink_ethtool_ksettings_get(struct
  
        linkmode_copy(kset->link_modes.supported, pl->supported);
  
@@ -188,7 +188,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        case MLO_AN_FIXED:
                /* We are using fixed settings. Report these as the
                 * current link settings - and note that these also
-@@ -1200,7 +1203,7 @@ int phylink_ethtool_ksettings_set(struct
+@@ -1203,7 +1206,7 @@ int phylink_ethtool_ksettings_set(struct
                /* If we have a fixed link (as specified by firmware), refuse
                 * to change link parameters.
                 */
@@ -197,7 +197,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                    (s->speed != pl->link_config.speed ||
                     s->duplex != pl->link_config.duplex))
                        return -EINVAL;
-@@ -1212,7 +1215,7 @@ int phylink_ethtool_ksettings_set(struct
+@@ -1215,7 +1218,7 @@ int phylink_ethtool_ksettings_set(struct
                __clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, config.advertising);
        } else {
                /* If we have a fixed link, refuse to enable autonegotiation */
@@ -206,7 +206,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                        return -EINVAL;
  
                config.speed = SPEED_UNKNOWN;
-@@ -1254,7 +1257,7 @@ int phylink_ethtool_ksettings_set(struct
+@@ -1257,7 +1260,7 @@ int phylink_ethtool_ksettings_set(struct
         * configuration. For a fixed link, this isn't able to change any
         * parameters, which just leaves inband mode.
         */
@@ -215,7 +215,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
            !test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state)) {
                phylink_mac_config(pl, &pl->link_config);
                phylink_mac_an_restart(pl);
-@@ -1344,7 +1347,7 @@ int phylink_ethtool_set_pauseparam(struc
+@@ -1347,7 +1350,7 @@ int phylink_ethtool_set_pauseparam(struc
                                   pause->tx_pause);
        } else if (!test_bit(PHYLINK_DISABLE_STOPPED,
                             &pl->phylink_disable_state)) {
@@ -224,7 +224,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                case MLO_AN_FIXED:
                        /* Should we allow fixed links to change against the config? */
                        phylink_resolve_flow(pl, config);
-@@ -1551,7 +1554,7 @@ static int phylink_mii_read(struct phyli
+@@ -1554,7 +1557,7 @@ static int phylink_mii_read(struct phyli
        struct phylink_link_state state;
        int val = 0xffff;
  
@@ -233,7 +233,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        case MLO_AN_FIXED:
                if (phy_id == 0) {
                        phylink_get_fixed_state(pl, &state);
-@@ -1579,7 +1582,7 @@ static int phylink_mii_read(struct phyli
+@@ -1582,7 +1585,7 @@ static int phylink_mii_read(struct phyli
  static int phylink_mii_write(struct phylink *pl, unsigned int phy_id,
                             unsigned int reg, unsigned int val)
  {
@@ -242,7 +242,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        case MLO_AN_FIXED:
                break;
  
-@@ -1753,10 +1756,10 @@ static int phylink_sfp_module_insert(voi
+@@ -1756,10 +1759,10 @@ static int phylink_sfp_module_insert(voi
                linkmode_copy(pl->link_config.advertising, config.advertising);
        }
  
index b840d71c43db29c887a4af36a2ae33ce391117a7..f69186e9cdff2b9e27ca7a902ace776528cf68e1 100644 (file)
@@ -13,7 +13,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
 
 --- a/drivers/net/phy/phylink.c
 +++ b/drivers/net/phy/phylink.c
-@@ -1688,25 +1688,21 @@ static void phylink_sfp_detach(void *ups
+@@ -1691,25 +1691,21 @@ static void phylink_sfp_detach(void *ups
        pl->netdev->sfp_bus = NULL;
  }
  
@@ -46,7 +46,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        config.interface = PHY_INTERFACE_MODE_NA;
        config.speed = SPEED_UNKNOWN;
        config.duplex = DUPLEX_UNKNOWN;
-@@ -1721,8 +1717,6 @@ static int phylink_sfp_module_insert(voi
+@@ -1724,8 +1720,6 @@ static int phylink_sfp_module_insert(voi
                return ret;
        }
  
@@ -55,7 +55,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
        iface = sfp_select_interface(pl->sfp_bus, config.advertising);
        if (iface == PHY_INTERFACE_MODE_NA) {
                phylink_err(pl,
-@@ -1732,18 +1726,18 @@ static int phylink_sfp_module_insert(voi
+@@ -1735,18 +1729,18 @@ static int phylink_sfp_module_insert(voi
        }
  
        config.interface = iface;
@@ -77,7 +77,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                    __ETHTOOL_LINK_MODE_MASK_NBITS, support);
  
        if (phy_interface_mode_is_8023z(iface) && pl->phydev)
-@@ -1756,15 +1750,15 @@ static int phylink_sfp_module_insert(voi
+@@ -1759,15 +1753,15 @@ static int phylink_sfp_module_insert(voi
                linkmode_copy(pl->link_config.advertising, config.advertising);
        }
  
@@ -96,7 +96,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
                             phy_modes(config.interface));
        }
  
-@@ -1777,6 +1771,21 @@ static int phylink_sfp_module_insert(voi
+@@ -1780,6 +1774,21 @@ static int phylink_sfp_module_insert(voi
        return ret;
  }
  
index 667170a39811a31dbe34166437a48c63a5942e84..5f0f14cf24e79d96ae0952f1cf392917c0b4743a 100644 (file)
@@ -37,7 +37,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  };
  
  #define phylink_printk(level, pl, fmt, ...) \
-@@ -1688,7 +1691,7 @@ static void phylink_sfp_detach(void *ups
+@@ -1691,7 +1694,7 @@ static void phylink_sfp_detach(void *ups
        pl->netdev->sfp_bus = NULL;
  }
  
@@ -46,7 +46,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
                              const unsigned long *supported,
                              const unsigned long *advertising)
  {
-@@ -1762,7 +1765,7 @@ static int phylink_sfp_config(struct phy
+@@ -1765,7 +1768,7 @@ static int phylink_sfp_config(struct phy
                             phy_modes(config.interface));
        }
  
@@ -55,7 +55,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  
        if (changed && !test_bit(PHYLINK_DISABLE_STOPPED,
                                 &pl->phylink_disable_state))
-@@ -1775,15 +1778,20 @@ static int phylink_sfp_module_insert(voi
+@@ -1778,15 +1781,20 @@ static int phylink_sfp_module_insert(voi
                                     const struct sfp_eeprom_id *id)
  {
        struct phylink *pl = upstream;
@@ -80,7 +80,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  }
  
  static int phylink_sfp_module_start(void *upstream)
-@@ -1791,10 +1799,19 @@ static int phylink_sfp_module_start(void
+@@ -1794,10 +1802,19 @@ static int phylink_sfp_module_start(void
        struct phylink *pl = upstream;
  
        /* If this SFP module has a PHY, start the PHY now. */
@@ -103,7 +103,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  }
  
  static void phylink_sfp_module_stop(void *upstream)
-@@ -1828,10 +1845,26 @@ static void phylink_sfp_link_up(void *up
+@@ -1831,10 +1848,26 @@ static void phylink_sfp_link_up(void *up
  static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
  {
        struct phylink *pl = upstream;
index d58304410a0d907f7b856899aeeec6b83f93934d..f0a8cb4a75bb44c53137df1e49807d5ba8b5525c 100644 (file)
@@ -20,7 +20,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
 
 --- a/drivers/net/phy/phylink.c
 +++ b/drivers/net/phy/phylink.c
-@@ -1842,10 +1842,20 @@ static void phylink_sfp_link_up(void *up
+@@ -1845,10 +1845,20 @@ static void phylink_sfp_link_up(void *up
        phylink_run_resolve(pl);
  }
  
@@ -41,7 +41,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
        int ret;
  
        /*
-@@ -1857,9 +1867,13 @@ static int phylink_sfp_connect_phy(void
+@@ -1860,9 +1870,13 @@ static int phylink_sfp_connect_phy(void
         */
        phy_support_asym_pause(phy);