Received: by 2002:ab2:7a09:0:b0:1f8:46dc:890e with SMTP id k9csp149995lqo; Wed, 15 May 2024 10:03:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUPJCkCqph136hCtvuGRM1dS/kyl6b5Me0l+lbl5qz15z0HKzbiOAj6duOUmFJ4RaLEhh/x7y/MhEV6kkB9oLD7F2ZePrsEGCfzTmO1oQ== X-Google-Smtp-Source: AGHT+IHN01esFiNaoY3eOB3+APAVnf+kV+Xg8lTkaHRG09Jqvzyf3s1dC4QGeB3JWnot1OhqAqCj X-Received: by 2002:a05:620a:171e:b0:792:bf10:3ebf with SMTP id af79cd13be357-792c75ffdd0mr2368686185a.56.1715792586715; Wed, 15 May 2024 10:03:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715792585; cv=pass; d=google.com; s=arc-20160816; b=afGNpgNUNVr/FmtiYhYJkIEaMFYR8WGKrm6Xwt7L0oGS2NpjsoMCHl9yXNyWsqkAJf fnfN8hAqTXqAjvssQU3LfbqNBRt4rPIbOQgQ1vNOP8E3HsbeMtUKiSEV5yt5McE/1xEm H3GzOU4V42nxyyVmNeOhLdrNzEDFRmkUcVeWRZwfyWW5ltBZHakcLi6fEMSXljNIIZ9p DKE970/dQwSoy1cZwNtVC4nlISRmaQrUOvj3zgaALuRXtJjksGCczb7xAKz0nPoT/nl4 ktW64gZW3a4CasLIon0IoiOLEut/DlQ7Mge6ksgrYoYT9S0a7vo5UwKtrycNJcaODYYa 3Naw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=L3Vo0d5VwaX4qZlTaEZTB/3VuEDc51WJXZUAoiq8vUM=; fh=Gt8aWvDrkMamjPpHxnILkymiV50TSlXiuoBx5cYSPV8=; b=G8iEcmuSCRkaBKny8LS/zMRwc8TKnwsqA8yFSYYW5BX4xJaL/hRnMPvva4QP6/MDJ6 ksm9kmxE5dweebsHoNdUTbj9/IQ6z5mbBuYRiwIF6dkh7tdy2X1rQoAGiw4mWrE0P5M+ 1FVA9zAD0D+LmR6uVO98Nphwe5ob4ygvePz2yw3ZbUkzhuzG+cecteb+DIL43Ktv++aQ Vc3hRNCDlTfpDB1LxQZIbumLXzOdA7+c94cu1yoGy+7g5x7bqCoPgr9GN1/KlhFVC7tU aEuF05CKyDp1Mk10yZlm7MVPigadE4sh1Ae82wAedu0WIj4mj+eh+/6J6K5u+mKFfEE3 MhVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=BL3kQwea; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-180186-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180186-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-792bf277a92si1428928885a.29.2024.05.15.10.03.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 10:03:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180186-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=BL3kQwea; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-180186-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180186-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3BC731C210E9 for ; Wed, 15 May 2024 17:03:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23F2175815; Wed, 15 May 2024 17:02:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="BL3kQwea" Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF11238FA0; Wed, 15 May 2024 17:02:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.205 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715792559; cv=none; b=ag38/6gcQ5UoT7vh/3VtWBD3BVa0SLZPposSg/0ov/kgpE8LLg3DPF8WPp+xwWC0kgUeac/7qlISOnhkOOAfoqwzN4IAC73017FWNLizjCKze7AKU4//AXGM1jU0zf2e4fpDRFqNspmFYsWVSEEXC/CeoAksz2AkgWF8Xo7gqVc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715792559; c=relaxed/simple; bh=wfpDHIRJQm5gfTfqfa13pyUDBBZ0QpYN48zGNn2baqs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n1zx1M1T7OYIAhbb0riiPZ4m7ICKFh2jteiXq+OWVT3pGoZeWO7CMWz/EByAkYVaPBAGuDvzbghwthhOFAu7WML2P+LB+NAHNiezgMR7kibPdwUtADllpEHPHKWUu3f6E0gHqOtrfX+45xLPKCA2JHWPcTpx6eqdeq5F9s7QFkM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=BL3kQwea; arc=none smtp.client-ip=192.19.144.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 5FC50C0000F1; Wed, 15 May 2024 10:02:31 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 5FC50C0000F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1715792551; bh=wfpDHIRJQm5gfTfqfa13pyUDBBZ0QpYN48zGNn2baqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BL3kQweaKBHbSmufdV4U5fMWg1V9v1uHBiRp72cvbeLVQdSJKFcVkJtjTDievyOtc N8jHEnMPUOdSH5sApWTFdR1N1FfoLfWv1MI/8hdba29JC18YX8Wwf6vVm8b1JCgmww UmsyFkj+vbW4EBW8IpjuIDkONP/aGR3TUkkiFQL4= Received: from fainelli-desktop.igp.broadcom.net (fainelli-desktop.dhcp.broadcom.net [10.67.48.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id 6188918041CAC7; Wed, 15 May 2024 10:02:29 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: broonie@kernel.org, Doug Berger , stable@vger.kernel.org, Florian Fainelli , "David S . Miller" , Florian Fainelli , Broadcom internal kernel review list , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org (open list:BROADCOM GENET ETHERNET DRIVER), Greg Kroah-Hartman , Sasha Levin Subject: [PATCH stable 6.1 2/4] net: bcmgenet: synchronize EXT_RGMII_OOB_CTRL access Date: Wed, 15 May 2024 10:02:25 -0700 Message-Id: <20240515170227.1679927-3-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515170227.1679927-1-florian.fainelli@broadcom.com> References: <20240515170227.1679927-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Doug Berger commit d85cf67a339685beae1d0aee27b7f61da95455be upstream The EXT_RGMII_OOB_CTRL register can be written from different contexts. It is predominantly written from the adjust_link handler which is synchronized by the phydev->lock, but can also be written from a different context when configuring the mii in bcmgenet_mii_config(). The chances of contention are quite low, but it is conceivable that adjust_link could occur during resume when WoL is enabled so use the phydev->lock synchronizer in bcmgenet_mii_config() to be sure. Fixes: afe3f907d20f ("net: bcmgenet: power on MII block for all MII modes") Cc: stable@vger.kernel.org Signed-off-by: Doug Berger Acked-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Florian Fainelli --- drivers/net/ethernet/broadcom/genet/bcmmii.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c index cc3afb605b1e..07bb7a4e517c 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c @@ -2,7 +2,7 @@ /* * Broadcom GENET MDIO routines * - * Copyright (c) 2014-2017 Broadcom + * Copyright (c) 2014-2024 Broadcom */ #include @@ -274,6 +274,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) * block for the interface to work, unconditionally clear the * Out-of-band disable since we do not need it. */ + mutex_lock(&phydev->lock); reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL); reg &= ~OOB_DISABLE; if (priv->ext_phy) { @@ -285,6 +286,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) reg |= RGMII_MODE_EN; } bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL); + mutex_unlock(&phydev->lock); if (init) dev_info(kdev, "configuring instance for %s\n", phy_name); -- 2.34.1