Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp769623imw; Fri, 15 Jul 2022 12:30:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sLF8NYaMboPyMElX4R3qumnI3o5gZILMsNRmHPksextlO9szqySPaKi+cDwYVmAKWjcF1C X-Received: by 2002:a05:6808:181f:b0:33a:204:9aa9 with SMTP id bh31-20020a056808181f00b0033a02049aa9mr10912388oib.99.1657913459811; Fri, 15 Jul 2022 12:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657913459; cv=none; d=google.com; s=arc-20160816; b=R9Ju79odPCl/9D4tZt6e0ZN27wkd6pnwlODfNGz5PtLlc0Hx6mkABZP/UVeDD84VRq lkz6VN3Hd7pjffm+Mmd8b9yMxcWWaKn1WGlpeTSCwTx5M1qCHFdFy+ypAx7RX62nDQKz ozI4j8JLRznRrSyyjFQzHXIZ+qS02nuMSmjnXGlEBsP9P+ZJOjxNtf3gEj6rgqERonKN 4n+CgQReowXJebW5SWMQh9CgpkQi3PNvHUKVGNK4qFDGhLedZ5xXC40Slrfr2vGR3xtV pkvvSiOKxHryPecgoGKeBx4y6JQua74O1PldOjVo2zLpvOVn52Ufxd9lgAWNqJgO9hkA SuYw== 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=Bpg96p9CI9yLaQw3VjuOVFIoT69AC7E3OsyVn7VvpkQ=; b=dd6u9dV302mS57dTEWSXTCvpKKRafofb0u38Y1r16Y2BG/XfFv0t6Lz6vPqtMKZNjK /xy/8eYuNIz7jT9vr2YtlzI5jOtJ+WY8C2+nn8TBBbxwUIHVRvxbAw0w0n2V3idbqCP4 ovVVjV2YZKFGygzo4qewQK4BSE7tycnErWi3iHNTjeefJrlLLWVcr09yDtZ4C/pmhAxb DpBausWGbNQjwirfGcGi6eEHyEkbQwmSlmIPHqDN1VAntbnhbaQzo8DC6LUURa++ap48 mX2zXO4RmEz/DSbltE+3REAscIFhA3g9I8q8Q09sxzWH7ST7p2bXmMRSts9yPMgd9NYK ZnTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fawt43s9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cp28-20020a056830661c00b0061c47c0794dsi3821071otb.295.2022.07.15.12.30.46; Fri, 15 Jul 2022 12:30:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fawt43s9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230517AbiGOTJV (ORCPT + 99 others); Fri, 15 Jul 2022 15:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbiGOTJT (ORCPT ); Fri, 15 Jul 2022 15:09:19 -0400 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAAEC13D47 for ; Fri, 15 Jul 2022 12:09:18 -0700 (PDT) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-31c8bb90d09so55821627b3.8 for ; Fri, 15 Jul 2022 12:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Bpg96p9CI9yLaQw3VjuOVFIoT69AC7E3OsyVn7VvpkQ=; b=fawt43s9lWKSGEk4xJU0OI7i1mjn821E5ZvRrpLHMKajZfiWvU/QaXMR7zmawKrJsD ToIrGV1QMzqRimiwaWZMiIHBttDe3IJFC1VvFLODmZagp7jIq4Ye2CZh+Wvb3Be+TVdx k4hmorXYWxsu5HeWyRaRCRxd9/G2xSMI+Gwz3OPlHGChS2FtWWaR7t+t2dmGJWnEdPnI n5CvmbVJkgshfYYCRi6niHpx3IAR9wrNEK5EkEoaKGqEE3B+pC7E8EW36aH+LDJUd9tR v4xeVx7wqniEscy3iBlGJ83ceqBjdtlslH3hZeEtdl/zsdscb+G9S4UM2R97ux4yRm4s MpBA== 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=Bpg96p9CI9yLaQw3VjuOVFIoT69AC7E3OsyVn7VvpkQ=; b=LD/w+wnYCJGVZr69reItdgGC5UIEWyGXnYeJPeXQmxuK5sSOhKOKfrOmBQHwi2WKIj YRVmdfESHw0/5ugpExftKtvWWydVVmKj9ihj5ienqmE6iShS+7pUZvJZEZ6Qm0sSZhr7 YoUc407+GeP062ErheXQGGcN44YGYkXu+RhCwA3BZn/QEE2rjmTm51bu0CbN+Y6IvIQk B3RXtXOmltpETD+E+5BJ56xvpT5gvjI+cyJyU1P5SlxLAG0oiyHw6kHPfktKc4qeK58/ rfPC4u60MzUoSfmnYPXdjmuvb43J68N5qAzd/+NilvkwZ75XQ4rYZ65C3nS1/bpeq2oo HfQg== X-Gm-Message-State: AJIora9gJavuxRqD5STDxwPQi7pQL0Cjf1kzO8EydSJ83lmGSvPiJdfs 1lJIc/l8fNzV/pgwG1Wozzx8TNi8uGoWpFB0TLIflw== X-Received: by 2002:a81:17ca:0:b0:31c:9a75:1f2b with SMTP id 193-20020a8117ca000000b0031c9a751f2bmr18251239ywx.83.1657912157915; Fri, 15 Jul 2022 12:09:17 -0700 (PDT) MIME-Version: 1.0 References: <1656618906-29881-1-git-send-email-radhey.shyam.pandey@amd.com> In-Reply-To: From: Saravana Kannan Date: Fri, 15 Jul 2022 12:08:42 -0700 Message-ID: Subject: Re: [PATCH net-next v2] net: macb: In shared MDIO usecase make MDIO producer ethernet node to probe first To: "Pandey, Radhey Shyam" Cc: Andrew Lunn , "nicolas.ferre@microchip.com" , "claudiu.beznea@microchip.com" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" , "hkallweit1@gmail.com" , "linux@armlinux.org.uk" , "gregkh@linuxfoundation.org" , "rafael@kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "git (AMD-Xilinx)" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 Fri, Jul 15, 2022 at 12:00 PM Pandey, Radhey Shyam wrote: > > > -----Original Message----- > > From: Saravana Kannan > > Sent: Wednesday, July 6, 2022 12:28 AM > > To: Pandey, Radhey Shyam > > Cc: Andrew Lunn ; nicolas.ferre@microchip.com; > > claudiu.beznea@microchip.com; davem@davemloft.net; > > edumazet@google.com; kuba@kernel.org; pabeni@redhat.com; > > hkallweit1@gmail.com; linux@armlinux.org.uk; > > gregkh@linuxfoundation.org; rafael@kernel.org; netdev@vger.kernel.org; > > linux-kernel@vger.kernel.org; git (AMD-Xilinx) > > Subject: Re: [PATCH net-next v2] net: macb: In shared MDIO usecase make > > MDIO producer ethernet node to probe first > > > > On Tue, Jul 5, 2022 at 11:49 AM Pandey, Radhey Shyam > > wrote: > > > > > > > -----Original Message----- > > > > From: Andrew Lunn > > > > Sent: Friday, July 1, 2022 2:44 PM > > > > To: Pandey, Radhey Shyam > > > > Cc: nicolas.ferre@microchip.com; claudiu.beznea@microchip.com; > > > > davem@davemloft.net; edumazet@google.com; kuba@kernel.org; > > > > pabeni@redhat.com; hkallweit1@gmail.com; linux@armlinux.org.uk; > > > > gregkh@linuxfoundation.org; rafael@kernel.org; > > saravanak@google.com; > > > > netdev@vger.kernel.org; linux-kernel@vger.kernel.org; git > > > > (AMD-Xilinx) > > > > Subject: Re: [PATCH net-next v2] net: macb: In shared MDIO usecase > > > > make MDIO producer ethernet node to probe first > > > > > > > > On Fri, Jul 01, 2022 at 01:25:06AM +0530, Radhey Shyam Pandey wrote: > > > > > In shared MDIO suspend/resume usecase for ex. with MDIO producer > > > > > (0xff0c0000) eth1 and MDIO consumer(0xff0b0000) eth0 there is a > > > > > constraint that ethernet interface(ff0c0000) MDIO bus producer has > > > > > to be resumed before the consumer ethernet interface(ff0b0000). > > > > > > > > > > However above constraint is not met when GEM0(ff0b0000) is resumed > > first. > > > > > There is phy_error on GEM0 and interface becomes non-functional on > > > > resume. > > > > > > > > > > suspend: > > > > > [ 46.477795] macb ff0c0000.ethernet eth1: Link is Down [ > > > > > 46.483058] macb ff0c0000.ethernet: gem-ptp-timer ptp clock > > unregistered. > > > > > [ 46.490097] macb ff0b0000.ethernet eth0: Link is Down [ > > > > > 46.495298] macb ff0b0000.ethernet: gem-ptp-timer ptp clock > > unregistered. > > > > > > > > > > resume: > > > > > [ 46.633840] macb ff0b0000.ethernet eth0: configuring for > > > > > phy/sgmii link mode macb_mdio_read -> pm_runtime_get_sync(GEM1) > > it > > > > > return - > > > > EACCES error. > > > > > > > > > > The suspend/resume is dependent on probe order so to fix this > > > > > dependency ensure that MDIO producer ethernet node is always > > > > > probed first followed by MDIO consumer ethernet node. > > > > > > > > > > During MDIO registration find out if MDIO bus is shared and check > > > > > if MDIO producer platform node(traverse by 'phy-handle' property) > > > > > is bound. If not bound then defer the MDIO consumer ethernet node > > probe. > > > > > Doing it ensures that in suspend/resume MDIO producer is resumed > > > > > followed by MDIO consumer ethernet node. > > > > > > > > I don't think there is anything specific to MACB here. There are > > > > Freescale boards which have an MDIO bus shared by two interfaces etc. > > > > > > > > Please try to solve this in a generic way, not specific to one MAC > > > > and MDIO combination. > > > > > > Thanks for the review. I want to get your thoughts on the outline of > > > the generic solution. Is the current approach fine and we can extend > > > it for all shared MDIO use cases/ or do we see any limitations? > > > > > > a) Figure out if the MDIO bus is shared. (new binding or reuse > > > existing) > > > b) If the MDIO bus is shared based on DT property then figure out if > > > the MDIO producer platform device is probed. If not, defer MDIO > > > consumer MDIO bus registration. > > > > Radhey, > > > > I think Andrew added me because he's pointing you towards fw_devlink. > > > > Andrew, > > > > I have intentionally not added phy-handle support to fw_devlink because it > > would also prevent the generic driver from binding/cause issues with DSA. I > > have some high level ideas on fixing that but haven't gotten around to it yet. > > Thanks, just want to understand on implementation when phy-handle support is > added to fw_devlink. Does it ensure that supplier node is probed first? Or it uses > device_link framework to specify suspend/resume dependency and don't care > on consumer/producer probe order. fw_devlink will enforce probe ordering and suspend/resume ordering. Btw, fw_devlink uses device links underneath. It just used the firmware (Eg: DT) to figure out the dependencies. That's why it's called fw_devlink. -Saravana