Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1334323pxm; Sat, 26 Feb 2022 12:07:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfO0sEZHMIM8VPvIOiKZf1WJ/TzLnE5ixRnPz3MCfnoGxLaOE/TC4YzPAbN5H1obscikE/ X-Received: by 2002:a63:4a44:0:b0:372:db13:5583 with SMTP id j4-20020a634a44000000b00372db135583mr11192647pgl.210.1645906036384; Sat, 26 Feb 2022 12:07:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645906036; cv=none; d=google.com; s=arc-20160816; b=0AsmbecwUbzLZ7KInkLuhjW+OAWR/PVILZvUvVmvBsQbSB4Jbq8J/68NweFcihWLPk t5b0kUy6tRZwZBfV1P21MPtxRORAHDAmIlalwx1A4Rj2maBKSFHV6VoZ/4mkB6fJFAKk XKdCvYN+lWZgWVAET+S7pBWMv8ZH+z++5J9aB5Jv6YhintC/f8wopFEPmC8/AwTySKVh 1QTIJxLq4WbA2t5sJuRGPjkg9K7a1R1TCHVnU0wF2XjrlJE7ZaY9bW6RIMrrP9xnb2w5 ViQmrhR6u9NJfc4cAAop2g0roCOWDvcJKzhvkqD7ZsFiTUggybcjIszsNn2swP0V6k5M nu9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=6OjByrZL/8WN1XwAV8cA5zlopGQjph2v70guM/ZhHrY=; b=u9wypLKuggIiEVF50sH+m36K4t+lVLGIsXMD0Gh7DCksHRQHilFwIh80g0HSYfdLWK EIAfTct5ab2C+IFtQ3CAk7kJQ6wrndJXjxOs50KCrFN65Nhwq6F0/Vb7ZtT1EE2SUXN0 UgDly01VIu5GSnRt7P8yXfCy02gUHY4SqEFDoU86Hj5l28W6KWvuhaEMaGZ4VjtaTWE+ VOdhhGuzapN0NZoRM8zWGz5XNESrI0c8B7VaJSraac8TuQIjQBTZZQGV+xAH2Ltud3QM 20eSkEZi5y85XPCRGqVkGPQe0oiQL9PBM4gxoaNFYul22mVvOxQ9+aamC0Pa28ncN2L1 q1FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=wrgqqkrM; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l6-20020a170902f68600b0014fe96a23f4si5888711plg.359.2022.02.26.12.07.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 12:07:16 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=wrgqqkrM; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2F99D20FCAF; Sat, 26 Feb 2022 12:05:55 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232333AbiBZQcq (ORCPT + 99 others); Sat, 26 Feb 2022 11:32:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232022AbiBZQcq (ORCPT ); Sat, 26 Feb 2022 11:32:46 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB5AE24DECC; Sat, 26 Feb 2022 08:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6OjByrZL/8WN1XwAV8cA5zlopGQjph2v70guM/ZhHrY=; b=wrgqqkrMVWZpQ2F7HPiyR4Y6fI jrY2BXk+vHM6o0e/2+zlEqqbQFiuLORisxaZ93IZR0FbdSwPh7NNw3Sw9XFGyLIAIm7uVlYGBv4my lDCMT36GIPLX3bRN/5uDLl5cQ7cNFGKFw9WtACxzWZJkX6gaL7/N6zQF4zHCFJe1YiyhJyiINBndc tFyYQHpK11SSsMxUUy/MncvXEsBElh5droIeDW5E/sp9LdUZd5ArYXCDIUTWGkORVj2JdqYW/6llu Ssi9uUy+FXpaTxOlh+kjZ8Y0zXKkD6VQZ56dXpu1mT7M/62HOeRUVw5tyAT+m97pI/FSAdtsC4vdu xR2BqFKg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:57524) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nNzzF-0006m6-6I; Sat, 26 Feb 2022 16:32:01 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nNzzB-0004G5-Sk; Sat, 26 Feb 2022 16:31:57 +0000 Date: Sat, 26 Feb 2022 16:31:57 +0000 From: "Russell King (Oracle)" To: Raag Jadav Cc: Andrew Lunn , Heiner Kallweit , "David S. Miller" , Jakub Kicinski , Steen Hegelund , Bjarni Jonasson , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: phy: mscc: enable MAC SerDes autonegotiation Message-ID: References: <1644043492-31307-1-git-send-email-raagjadav@gmail.com> <20220226072327.GA6830@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220226072327.GA6830@localhost> Sender: Russell King (Oracle) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 Sat, Feb 26, 2022 at 12:53:27PM +0530, Raag Jadav wrote: > On Thu, Feb 24, 2022 at 10:48:57AM +0000, Russell King (Oracle) wrote: > > Sorry for the late comment on this patch. > > > > On Sat, Feb 05, 2022 at 12:14:52PM +0530, Raag Jadav wrote: > > > +static int vsc85xx_config_inband_aneg(struct phy_device *phydev, bool enabled) > > > +{ > > > + int rc; > > > + u16 reg_val = 0; > > > + > > > + if (enabled) > > > + reg_val = MSCC_PHY_SERDES_ANEG; > > > + > > > + mutex_lock(&phydev->lock); > > > + > > > + rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED_3, > > > + MSCC_PHY_SERDES_PCS_CTRL, MSCC_PHY_SERDES_ANEG, > > > + reg_val); > > > + > > > + mutex_unlock(&phydev->lock); > > > > What is the reason for the locking here? > > > > phy_modify_paged() itself is safe due to the MDIO bus lock, so you > > shouldn't need locking around it. > > > > True. > > My initial thought was to have serialized access at PHY level, > as we have multiple ports to work with. > But I guess MDIO bus lock could do the job as well. The MDIO bus lock is the only lock that will guarantee that no other users can nip onto the bus and possibly access your PHY in the middle of an operation that requires more than one access to complete. Adding local locking at PHY driver level does not give you those guarantees. This is exactly why phy_modify() etc was added - because phy_read().. phy_write() does not give that guarantee. As an example of something that could interfere - the userspace MII ioctls. > I've gone through Vladimir's patches and they look more promising > than this approach. > Let me know if I could be of any help. I haven't seen them - so up to you. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!