Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp208595iob; Mon, 2 May 2022 17:15:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCaUhsmJCfJnpKKyFPJFs5TzpFn5W/NGOljQr8q1pXzUvqA12MFQERBrsSVt96JV1GCxyU X-Received: by 2002:a17:902:a404:b0:14b:1100:aebc with SMTP id p4-20020a170902a40400b0014b1100aebcmr14235288plq.133.1651536934932; Mon, 02 May 2022 17:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651536934; cv=none; d=google.com; s=arc-20160816; b=jSH1Za1fGiezDli0jQRqIH/u2OQkQII2r2PlBv6uFLOjgFP4afC7ptmqCmSuTlYdFr o9qFcfUloJA8N7f01+dZUHtaY4Dzo5y7tVUbr8duqlD5808LiXUiXrH7HR1kfq6tFkMw AB4ZBBoP9xKXqr4+vTKN7kjn9ZWBa7+4VtUQPKLQ6YpUhsdLnzBGS0T2uFhdTXwWAZiR 7tNzlAZScqVFyRp0ldK3PPjjFiiBxz7QGCf3yeHDSmlCmxENyPNFJ9wcjhYG9r+dZSHv XB2aDfkLo8fNp+M6+XvCRmCN26zl8mf5M7tQErKZ+N8LyW4/HtnMnQZO6kK938ELmhCe 6Mzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FZ/8JNTm7vpbFc2YOEAMd+Fo9SryLJ8pTwtRQk4/FOk=; b=iqtLTSBAeXOq/MKPsbdV3FNWy+hJyc63lOamSYJU+EHlb8lAZu7lad/Tk+sYGYnRe4 CCb9qEscTUYsgoQ9JCxO4ehwOOpKgTjAN+qbSbcGPML3Q7PEzGWJkUZVqdTrt/KcDwPn 2PR2dsYHGu7CZmaVy658Bb5f0aSqE/jJEyTvsnLzcXzvKKAURZaUc6DkPC1rXhKrzHGd hRmq77wza+2bF+tbNnoU4JdanZzZJAnmWB5oB3ygOi7G3PYMX2yZGZ7RZlDcUXYbiCPc DG16JomTtX8zLbWHm2bX3dQshJRoIHUjo1MFzYeaogivrXQ/80EsCr/irKbUVE9JEAAb SwkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WpO4+NLt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f18-20020a056a001ad200b0050dfc3c58fbsi2447827pfv.5.2022.05.02.17.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:15:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WpO4+NLt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 933D713CC7; Mon, 2 May 2022 17:13:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359550AbiD2Mz2 (ORCPT + 99 others); Fri, 29 Apr 2022 08:55:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245070AbiD2Mz0 (ORCPT ); Fri, 29 Apr 2022 08:55:26 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70548CA0E4; Fri, 29 Apr 2022 05:52:07 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id y2so14274412ybi.7; Fri, 29 Apr 2022 05:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FZ/8JNTm7vpbFc2YOEAMd+Fo9SryLJ8pTwtRQk4/FOk=; b=WpO4+NLt8Ukw2ZwcrHbAnQOpf98OVlUhSt5NXSdanwU6n/UsXzPSEXnAhaRaWv+umA oNaoj/qqNLSY1rADzGLWH33peBDOWAbfw07ezxxVLrnvFkQ2VJ5sm05LM/1AB+12Ayfp vwPoaUdjKMiHlXSnxykyEnD+dNeN69tef5GI2MYDqqbM45RC2sU7A5E+jHLaOD5MOV8S cXdlSabecyTUnhGXGC51P+VKEBPjw+L7YB+JN1bbywbd1s2/ikRZV8PJnZAWGHcFKVIr t9l+jgDRDnCXoB7q+rwC6kfur/qnMXQCxKXf6/mrUbNcpF2ov8+un6as/MfOks3OBGhw GhSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FZ/8JNTm7vpbFc2YOEAMd+Fo9SryLJ8pTwtRQk4/FOk=; b=F7zKvD2bKgDprIwElUEKbXJq6BUWHV9Yi3ElB9E5Qv4tXt0e10yqA6aITlpiContiV GBViNEvR/YjoIDGlbJLIyu1akcXAoBMl4skrs+d1QlXol37HEOWrxV61V2F0HnVf449T j0Wi0Wi1JBWi/hMuEk/qZvbtjeMGSCwSnr6RUqEIMWIxkpgMl79MDD/P4u7TMU5xOML8 Pxt+UFbSASd7OEW+aw0MQOLXi5ONE/cdKb1J79nG99Js+Svl6Dre1fa5w5iOq5PHd/nc n2lByNsBg3SLEjlyjsH0xPVUm0WzlUc2ynTAhq8Ql4xgg1e14v4c50bGAK3KSEI1o6Rs 7Wqg== X-Gm-Message-State: AOAM530VwUi2I6+P2Xwe8xyloW0R8O6H9/80YQSFWY53f6/tVf7D9pnN wEsaLrzCk7Mz8IcxAAPOZ0pz7ZwypoO5jyJQ+mE= X-Received: by 2002:a25:600b:0:b0:648:ef9b:172d with SMTP id u11-20020a25600b000000b00648ef9b172dmr9893719ybb.585.1651236726660; Fri, 29 Apr 2022 05:52:06 -0700 (PDT) MIME-Version: 1.0 References: <20220228233057.1140817-1-pgwipeout@gmail.com> In-Reply-To: From: Peter Geis Date: Fri, 29 Apr 2022 08:51:54 -0400 Message-ID: Subject: Re: [PATCH v1] net: phy: fix motorcomm module automatic loading To: "Russell King (Oracle)" Cc: Andrew Lunn , Heiner Kallweit , "David S. Miller" , Jakub Kicinski , "open list:ARM/Rockchip SoC..." , Linux Kernel Network Developers , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 28, 2022 at 7:44 PM Peter Geis wrote: > > On Mon, Feb 28, 2022 at 7:14 PM Russell King (Oracle) > wrote: > > > > On Mon, Feb 28, 2022 at 06:30:57PM -0500, Peter Geis wrote: > > > The sentinel compatible entry whitespace causes automatic module loading > > > to fail with certain userspace utilities. Fix this by removing the > > > whitespace and sentinel comment, which is unnecessary. > > > > Umm. How does it fail? > > It simply does not auto load the module by device id match. > Manually loading the module after the fact works fine. > > > > > > static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = { > > > { PHY_ID_MATCH_EXACT(PHY_ID_YT8511) }, > > > - { /* sentinal */ } > > > + {} > > > > These two should be 100% identical in terms of the object code produced, > > and thus should have no bearing on the ability for the module to be > > loaded. > > > > Have you investigated the differences in the produced object code? > > Yes, you are correct, I just compared the produced files and they are identical. > This patch can get dropped then. > I'm curious now why it seemed to make a difference. > > I am not familiar enough with how the various userspace elements > decide to match the modules to determine exactly why this is failing. > It seems to be hit or miss if userspace decides to auto load this, for > instance Ubuntu 20.04 was happy to load my kernel module built with > the arm64 official toolchain, but Manjaro will not load their self > built kernel module. > I originally suspected it was due to the manufacturer id being all zeros. > Unless there's some weird compiler optimization that I'm not seeing in > my configuration. > > Any ideas would be appreciated. > Thanks! Good Morning, After testing various configurations I found what is actually happening here. When libphy is built in but the phy drivers are modules and not available in the initrd, the generic phy driver binds here. This allows the phy to come up but it is not functional. It also prevents the module driver from binding when it becomes available. https://elixir.bootlin.com/linux/v5.18-rc4/source/drivers/net/phy/phy_device.c#L1383 It seems there is an implicit dependency between phy_device and the device specific drivers that isn't realized in the configuration. I can think of a few ways to fix this, but I think the simplest is to make the device specific drivers have a kconfig dependency on libphy (which builds phy_device). This means that the only time the device specific phy drivers can be modules is if libphy is as well, otherwise if libphy is built in, the device specific drivers would need to be as well. There are more elegant and complicated solutions I can think of here, such as breaking out the generic driver as a module or having a device-tree flag that annotates that we need a device specific driver. This isn't realized with most of the common devices such as the Realtek driver because they have cross dependencies that ensure they are likely to be built in. Very Respectfully, Peter Geis > > > If not, please do so, and describe what they were. Thanks. > > > > -- > > RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ > > FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!