From patchwork Thu May 20 12:51:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 12270243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41C52C433ED for ; Thu, 20 May 2021 12:58:44 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3AD861004 for ; Thu, 20 May 2021 12:58:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3AD861004 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZzFxHWuv0znSNGVW1DhASoQSXlddZWaX+cumkFUbmcU=; b=ET9H9w2oymjuomkS1dt5/mdC9u yrAI/gRg4i9wlskNkqytLbg3ZrZhyWaWrkrK5Og4JPvvUL5To7ybKp/sVvhP5IZbTsrLfOmfhbCNb m8a0nXsXPlKsKG/uXWueGegRN/gEARhUWUs1MIzmWIlFU603GFg1yp4r0Wi1df7H3lJwrEydfaKMI YSOmeYLpcZ/p+MiCnfkqhU5gsYMfImds2wzPtxeuajAv0s0YHBFObNmW8r9FPl0AIhMyodc6Uah77 NWEuqDAkZ50YBgvRGJtt/YkfkrHzTnnMIHrVQiIz9qe1jzSx6pOrAwD52i/1Zyog40GuLbwhRHrdW k2XozwWw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ljiEE-0012WH-4J; Thu, 20 May 2021 12:56:43 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lji9H-000z2G-OP for linux-arm-kernel@desiato.infradead.org; Thu, 20 May 2021 12:51:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ipw5TmPIB0VYSze72pR/m0DdVCMChjEwVDAkFx+bL50=; b=nXxCng1ZFvGBIGEZkzpEKdvjC6 7CMQBiXWVDyAFzChl2ZzpKE7MsvmvCkSqKobDyYgFm5dZ7Zu802kFmHzcbES3J+1a8aCPrRNGbDR4 3viP+kYMjnH6NEPPNqj9dhlNtCpFHsHeODgC7ExMqt6pWpHdnafGMnbUqzicX7HV4+dEYkXcGebe7 PfUHTs/bOXwLQCLChjaFCnYBHhHdm1+BoG47OwfL8jOloiVEcMOrWKoopBc1xa6/mh3amsBlu/Wkv zdhgqy4aA9pBY6gORVHvwozGyqCbeoG0ox0eHvMjMKaY1tiUwYcTJtTfjPmJJTNzidD3nFTiGIf1M lFgcCiAQ==; Received: from mail-am6eur05on2059.outbound.protection.outlook.com ([40.107.22.59] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lji9F-00GL5j-3T for linux-arm-kernel@lists.infradead.org; Thu, 20 May 2021 12:51:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nvWvog/jAXZ+CHu0aKRfssGnwb6nKs+9GD04HaiNpqTOU69f4rnIU32Lg1mA9df9kV3d9MO3mD9cEAr9gqyvnl8PkJD5/+2flJ5XQX1taziXNKf/ks4BGfT2zzPuydKHoDUWB5W55WG8+aK36MgoYYdf3pKUsgVrbwKZkhrJJPvRvh0tVHvc+5fcrxf4XneZ/kRQkv1atjux+u0Jw6jklG7KXPR40w3yHDNZ4rKqywdHQURIu/TX1iAScL38yklWOfeDeG0r+cNJcwN7PA2HoN0V/POacWYCXU3R2ScKM5zDNB+jZ3oUtI4W+8yKlYyRdR9JI8nwR+U+ftt318r46g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ipw5TmPIB0VYSze72pR/m0DdVCMChjEwVDAkFx+bL50=; b=OC4a9FwypnPVZN0Eas7tTjxGTKnDpR00RZQSquCiUIrNhFhqeswBAsgvUz+h7m1veVD9UB/7CcTMvsttjwMLHnmfGvbsw8o/qlLiJeajKgREArxCqJEjScSfg0bG7NKqu61FydAUYGIj3Nc47+GgzqLp09cZRVkZWR3EMZ1141QnSymSl/3ELaVUlZ8HcCId15A8XMFfelkXUQ7dwJKagfHs6dmdDptUXQDWy3Elp6EYa0FLLRSlMTWFAa3XGyHwfIKUPkIU+AOE/erLx8d56kI0oLLlzNDe/eZc6BIFlQG1FAzPv0Ag+LnQxfurhoZaFd7emyoIwjWNK1qZAJ3XMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ipw5TmPIB0VYSze72pR/m0DdVCMChjEwVDAkFx+bL50=; b=GjaYId9aPEM0ICJgHtPwNDGvL/zxvhyEwVUneQwHtyCgMnlAkwDLLCg+nkutbdF3yEqXIrWDEGY136k0HD4DFhepthDj7dGvfNbOpoueKzLEhgmcje/n3+qaerZDRXakQ5vKOhjwgWCw5YR/dkXERU5uVH9Z3UC3a2/c1cp3w6w= Authentication-Results: st.com; dkim=none (message not signed) header.d=none;st.com; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB8PR04MB6345.eurprd04.prod.outlook.com (2603:10a6:10:106::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23; Thu, 20 May 2021 12:51:30 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::3400:b139:f681:c8cf]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::3400:b139:f681:c8cf%9]) with mapi id 15.20.4129.034; Thu, 20 May 2021 12:51:30 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org, mcoquelin.stm32@gmail.com, andrew@lunn.ch Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH net 2/2] net: stmmac: fix system hang if change mac address after interface ifdown Date: Thu, 20 May 2021 20:51:17 +0800 Message-Id: <20210520125117.1015-3-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210520125117.1015-1-qiangqing.zhang@nxp.com> References: <20210520125117.1015-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR06CA0095.apcprd06.prod.outlook.com (2603:1096:3:14::21) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SG2PR06CA0095.apcprd06.prod.outlook.com (2603:1096:3:14::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.32 via Frontend Transport; Thu, 20 May 2021 12:51:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 99d00032-fe4c-465e-096e-08d91b8dfd66 X-MS-TrafficTypeDiagnostic: DB8PR04MB6345: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: weWILU04lxGfCL0thB8HM/nIBV9YKzWKFOmWJCLGAG4Q6kjUoh4WgbGHZrVxmlybLXyClzwbi97zK2PQTJb0ixEwCMi5KAoj9pSUKPcGTKNVRyYxxq0+KlNJCCVO9o0mXip6M7mScBk1o2d4Lb1fHgN/G+hytJN+cZBGhFs08FymOsUMXRxxnhu4mECer2gyZ2dLTty1Iohfl7amEynL0v0DzfV/zpe5+sPJ0EFSDOxy92nmrfZcVBl6Zw1644B64egOfmJ3R5zkAAhJ2NYu8WCcAxpZlWntc4gnhqP4dWRnOhqiVJPriuutjH8j26lCrTpebPTSQpJ1HWEfns6AlZvc5zEu5w58z6FWSe+PXydPwsBa0GDUOqSDTM8hjZd3v5McP7Dg5G2nIj+IPNvoWAD6P/qCAPumpaSUff21DM7Bcuj2u02o/Z8OzoXdabiQwxiyIwcTE8UmnH/4FRhctWfT5x0LNL+FqsafoDofW7/04+eFxqhUg2TwGIjRz5DB14cIKF6DgcpU76SLYCgYJxt7gHED4v5eVELK5AgcwxPCBzQ4nQ0slKzXnsvQk2OCh9kN/HXnX43O9Z26Re9eTvPH7UHxB3xqV80k/ww8As/JJ9LhBytuDUoobcffS431uy1ksHcQZiDZLjOiMfh+ei/sQ3roS3CGnIQPmQ9kZuGLmW7F6CQTcSgvarr5L1fJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(346002)(396003)(366004)(136003)(8936002)(38100700002)(38350700002)(6512007)(956004)(36756003)(52116002)(4326008)(8676002)(7416002)(1076003)(6506007)(5660300002)(86362001)(316002)(26005)(83380400001)(478600001)(2616005)(66946007)(6666004)(66476007)(66556008)(6486002)(2906002)(186003)(16526019)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: o6K9mIckWmq9UfBF+Re6uwQWly3wynROghxGs0eDu4DhZEKe5ttB5WSq/TaSnkQ6bmiRL9vVTSiQfr5cvfO+SjcEBhnI1g3XTKVCdhKukrkN5JGRq85omv+tqoPJgrj3uqmKC5Ens4h2gWHfo2uJRghhqyN/+xsEH2poF/Cd3sToLtkeyfEziEaMpMxqHqnLcRI3GDegVfVVO6lQhbt0+q8/+4F0lL4HCfYF/NpCjbeOyUD16quif8tAprLNklWTNu3bs+0O3IJUz/O7GW9byh3Nlazufzd9T91cx/1LmYqdJNrHV+fmRiztyQ19pimttQyc9/Ah97pA8NBNHj12tPK4CwVHkbV8Nlna8LPG7sbbyh4YG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thSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2021 12:51:30.8383 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uTWExuoGviA1rfE5TZIinm7rcpC720G2X3nHuuw3UDUFdR82FnW22CG6f9AevWaoUE2OBUh1yiFpUNWUWfgfXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6345 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210520_055133_166537_98844E69 X-CRM114-Status: GOOD ( 12.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fix system hang with below sequences: ~# ifconfig ethx down ~# ifconfig ethx hw ether xx:xx:xx:xx:xx:xx After ethx down, stmmac all clocks gated off and then register access causes system hang. Fixes: 5ec55823438e ("net: stmmac: add clocks management for gmac driver") Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index df4ce5977fad..5d956a553434 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5891,12 +5891,21 @@ static int stmmac_set_mac_address(struct net_device *ndev, void *addr) struct stmmac_priv *priv = netdev_priv(ndev); int ret = 0; + ret = pm_runtime_get_sync(priv->device); + if (ret < 0) { + pm_runtime_put_noidle(priv->device); + return ret; + } + ret = eth_mac_addr(ndev, addr); if (ret) - return ret; + goto set_mac_error; stmmac_set_umac_addr(priv, priv->hw, ndev->dev_addr, 0); +set_mac_error: + pm_runtime_put(priv->device); + return ret; }