Re: [PATCH 5.10 000/149] 5.10.156-rc1 review

From: Arnd Bergmann
Date: Fri Nov 25 2022 - 05:02:52 EST


On Fri, Nov 25, 2022, at 09:05, Naresh Kamboju wrote:
> On Fri, 25 Nov 2022 at 12:57, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>> On Thu, Nov 24, 2022 at 09:17:36PM +0530, Naresh Kamboju wrote:
>> >
>> > Daniel bisected this reported problem and found the first bad commit,
>> >
>> > YueHaibing <yuehaibing@xxxxxxxxxx>
>> > net: broadcom: Fix BCMGENET Kconfig
>>
>> But that is in 5.10.155, 5.15.79, 6.0.9, and 6.1-rc5. It is not new to
>> this -rc release.
>
> It started from 5.10.155 and this is only seen on 5.10 and other
> branches 5.15, 6.0 and mainline are looking good.

I think the original patch is wrong and should be fixed upstream.
The backported patch in question is a one-line Kconfig change doing

diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig
index f4e1ca68d831..55dfdb34e37b 100644
--- a/drivers/net/ethernet/broadcom/Kconfig
+++ b/drivers/net/ethernet/broadcom/Kconfig
@@ -77,7 +77,7 @@ config BCMGENET
select BCM7XXX_PHY
select MDIO_BCM_UNIMAC
select DIMLIB
- select BROADCOM_PHY if ARCH_BCM2835
+ select BROADCOM_PHY if (ARCH_BCM2835 && PTP_1588_CLOCK_OPTIONAL)
help
This driver supports the built-in Ethernet MACs found in the
Broadcom BCM7xxx Set Top Box family chipset.

which fixes the build on kernels that contain 99addbe31f55 ("net:
broadcom: Select BROADCOM_PHY for BCMGENET") and enable
BCMGENET=y but PTP_1588_CLOCK_OPTIONAL=m, which otherwise
leads to a link failure.

The patch unfortunately solves it by replacing it with a runtime
failure by no longer linking in the PHY driver (as found by Naresh).

I think the correct fix would be to propagate the dependency down
to BCMGENET:

diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig
index f4e1ca68d831..f4ca0c6c0f51 100644
--- a/drivers/net/ethernet/broadcom/Kconfig
+++ b/drivers/net/ethernet/broadcom/Kconfig
@@ -71,6 +71,7 @@ config BCM63XX_ENET
config BCMGENET
tristate "Broadcom GENET internal MAC support"
depends on HAS_IOMEM
+ depends on PTP_1588_CLOCK_OPTIONAL || !ARCH_BCM2835
select MII
select PHYLIB
select FIXED_PHY

With this change, the broken config is no longer possible, instead
forcing BCMGENET to be =m when building for ARCH_BCM2835 with
PTP_1588_CLOCK=m.

Arnd